/* ============================================================
   AdPlatform SaaS — Global Styles
   ============================================================ */

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #a5b4fc;
  --facebook: #1877F2;
  --google: #4285F4;
  --youtube: #FF0000;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --transition: 0.2s ease;
}

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

#app { min-height: 100vh; }

/* ─── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ─── Loading Screen ─────────────────────────────────────────── */
.loading-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  color: white;
}

.loading-logo {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 8px;
  animation: pulse 1.5s ease-in-out infinite;
}

.loading-subtitle {
  font-size: 0.9rem;
  opacity: 0.8;
  margin-bottom: 40px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.7; } }
@keyframes fadeIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
@keyframes slideIn { from { opacity:0; transform:translateX(-20px); } to { opacity:1; transform:translateX(0); } }
@keyframes scaleIn { from { opacity:0; transform:scale(0.95); } to { opacity:1; transform:scale(1); } }

/* ─── Login Page ────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.login-left {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  color: white;
  position: relative;
  overflow: hidden;
}

.login-left::before {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
  top: -100px;
  right: -100px;
}

.login-left::after {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
  bottom: -80px;
  left: -80px;
}

.login-brand {
  position: relative;
  z-index: 1;
  text-align: center;
}

.login-brand-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  display: block;
}

.login-brand h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 8px;
}

.login-brand p {
  font-size: 1rem;
  opacity: 0.85;
  max-width: 320px;
  line-height: 1.5;
  margin-bottom: 48px;
}

.login-features {
  list-style: none;
  text-align: left;
  width: 100%;
  max-width: 320px;
  position: relative;
  z-index: 1;
}

.login-features li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  font-size: 0.9rem;
  opacity: 0.9;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.login-features li:last-child { border-bottom: none; }

.login-features li i {
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.85rem;
}

.login-right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  background: white;
}

.login-form-container {
  width: 100%;
  max-width: 400px;
  animation: fadeIn 0.4s ease;
}

.login-form-container h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 8px;
}

.login-form-container .subtitle {
  color: var(--gray-500);
  font-size: 0.9rem;
  margin-bottom: 32px;
}

.demo-hint {
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 24px;
  font-size: 0.8rem;
  color: #92400e;
}

.demo-hint strong { display: block; margin-bottom: 4px; }

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

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--gray-800);
  background: white;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  -webkit-appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--gray-400); }

.form-input.error,
.form-select.error { border-color: var(--danger); }

.form-error {
  font-size: 0.8rem;
  color: var(--danger);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: 36px;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--gray-500);
  margin-top: 4px;
}

.input-prefix-group {
  display: flex;
}

.input-prefix {
  padding: 10px 14px;
  background: var(--gray-100);
  border: 1.5px solid var(--gray-200);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  font-size: 0.9rem;
  color: var(--gray-500);
  white-space: nowrap;
}

.input-prefix-group .form-input {
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1.5px solid var(--gray-200);
}
.btn-secondary:hover:not(:disabled) { background: var(--gray-200); }

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover:not(:disabled) { background: #059669; transform: translateY(-1px); }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover:not(:disabled) { background: #dc2626; }

.btn-warning {
  background: var(--warning);
  color: white;
}
.btn-warning:hover:not(:disabled) { background: #d97706; }

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
}
.btn-ghost:hover:not(:disabled) { background: var(--gray-100); }

.btn-sm { padding: 7px 14px; font-size: 0.8rem; }
.btn-lg { padding: 13px 28px; font-size: 1rem; }
.btn-block { width: 100%; }

.btn-facebook { background: #1877F2; color: white; }
.btn-facebook:hover:not(:disabled) { background: #166fe5; }
.btn-google { background: white; color: var(--gray-700); border: 1.5px solid var(--gray-200); }
.btn-google:hover:not(:disabled) { background: var(--gray-50); }

/* ─── App Layout ─────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: 260px;
  background: var(--gray-900);
  color: white;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.sidebar-logo-text span {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  opacity: 0.5;
  letter-spacing: 0;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
}

.sidebar-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.35);
  padding: 16px 20px 6px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  font-size: 0.875rem;
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  transition: all var(--transition);
  border-radius: 8px;
  margin: 1px 8px;
  position: relative;
}

.sidebar-nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: white;
}

.sidebar-nav-item.active {
  background: rgba(99, 102, 241, 0.2);
  color: white;
}

.sidebar-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
  margin-left: -8px;
}

.sidebar-nav-item i {
  width: 20px;
  text-align: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.sidebar-nav-item .badge {
  margin-left: auto;
  background: var(--primary);
  color: white;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
}

.sidebar-user:hover { background: rgba(255,255,255,0.05); }

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.4);
}

/* ─── Main Content ───────────────────────────────────────────── */
.main-content {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Topbar ─────────────────────────────────────────────────── */
.topbar {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  flex: 1;
}

.topbar-title h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
}

.topbar-title p {
  font-size: 0.78rem;
  color: var(--gray-500);
}

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

.topbar-search {
  position: relative;
}

.topbar-search input {
  padding: 8px 14px 8px 36px;
  border: 1.5px solid var(--gray-200);
  border-radius: 20px;
  font-size: 0.875rem;
  background: var(--gray-50);
  outline: none;
  width: 200px;
  transition: all var(--transition);
}

.topbar-search input:focus {
  border-color: var(--primary);
  background: white;
  width: 240px;
}

.topbar-search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 0.8rem;
}

.topbar-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  border: none;
  cursor: pointer;
  color: var(--gray-600);
  transition: all var(--transition);
  position: relative;
}

.topbar-icon-btn:hover {
  background: var(--gray-200);
  color: var(--gray-800);
}

.topbar-icon-btn .notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid white;
}

/* ─── Page Content ───────────────────────────────────────────── */
.page-content {
  padding: 32px;
  flex: 1;
  animation: fadeIn 0.3s ease;
}

/* ─── Stats Grid ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-100);
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}

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

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  background: currentColor;
  opacity: 0.04;
  border-radius: 50%;
  transform: translate(20px, -20px);
}

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

.stat-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.stat-card-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
}

.stat-card-badge.positive { background: #d1fae5; color: #065f46; }
.stat-card-badge.negative { background: #fee2e2; color: #991b1b; }
.stat-card-badge.neutral  { background: #f3f4f6; color: var(--gray-600); }

.stat-card-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1.1;
  margin-bottom: 6px;
}

.stat-card-label {
  font-size: 0.8rem;
  color: var(--gray-500);
  font-weight: 500;
}

/* ─── Cards ──────────────────────────────────────────────────── */
.card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-100);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 24px;
}

.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
}

/* ─── Grid Layout ────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }

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

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

thead th {
  text-align: left;
  padding: 10px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}

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

tbody tr:hover td { background: var(--gray-50); }

/* ─── Badges / Status ────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-ativa       { background: #d1fae5; color: #065f46; }
.badge-pausada     { background: #fef3c7; color: #92400e; }
.badge-rascunho    { background: #f3f4f6; color: var(--gray-600); }
.badge-concluída   { background: #ede9fe; color: #5b21b6; }
.badge-erro        { background: #fee2e2; color: #991b1b; }

.badge-facebook  { background: #dbeafe; color: #1e40af; }
.badge-google    { background: #e0e7ff; color: #3730a3; }
.badge-youtube   { background: #fee2e2; color: #991b1b; }

.platform-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot-facebook { background: #1877F2; }
.dot-google   { background: #4285F4; }
.dot-youtube  { background: #FF0000; }

/* ─── Platform Selector ──────────────────────────────────────── */
.platform-selector {
  padding: 48px 40px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 60%, #06b6d4 100%);
  border-radius: var(--radius-xl);
  color: white;
  margin-bottom: 32px;
}

.platform-selector-header {
  text-align: center;
  margin-bottom: 40px;
}

.platform-selector-header h2 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.platform-selector-header p {
  font-size: 0.95rem;
  opacity: 0.85;
}

.platforms-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.platform-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  cursor: pointer;
  transition: all 0.25s ease;
  border: 3px solid transparent;
  display: flex;
  flex-direction: column;
  color: var(--gray-800);
}

.platform-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 32px rgba(0,0,0,0.15);
}

.platform-card.selected {
  border-color: #fbbf24;
  background: #fffbf0;
}

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

.platform-emoji { font-size: 2.5rem; }

.platform-card-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gray-900);
}

.platform-card-complexity {
  font-size: 0.78rem;
  color: var(--gray-500);
  margin-top: 2px;
}

.platform-stats-mini {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
  padding: 14px;
  background: var(--gray-50);
  border-radius: var(--radius);
}

.platform-stat-mini {
  text-align: center;
}

.platform-stat-mini .label {
  font-size: 0.65rem;
  color: var(--gray-400);
  display: block;
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.platform-stat-mini .value {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gray-700);
}

.platform-objectives-list {
  margin-bottom: 20px;
}

.platform-objectives-list .obj-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: block;
}

.obj-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.obj-tag {
  background: var(--gray-100);
  color: var(--gray-600);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 500;
}

.obj-tag-more {
  background: var(--primary);
  color: white;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 500;
}

.platform-select-btn {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 12px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  width: 100%;
  margin-top: auto;
}

.platform-select-btn:hover { background: var(--primary-dark); }

.platform-card.selected .platform-select-btn {
  background: #fbbf24;
  color: #78350f;
}

/* ─── Campaign Form ──────────────────────────────────────────── */
.campaign-form {
  max-width: 840px;
  margin: 0 auto;
}

.form-section {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-100);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow: hidden;
}

.form-section-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--gray-50);
}

.form-section-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.85rem;
}

.form-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gray-900);
}

.form-section-subtitle {
  font-size: 0.78rem;
  color: var(--gray-500);
}

.form-section-body {
  padding: 24px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
}

/* ─── Keywords Tag Input ─────────────────────────────────────── */
.tag-input-wrapper {
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  cursor: text;
  transition: border-color var(--transition), box-shadow var(--transition);
  min-height: 48px;
  background: white;
}

.tag-input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.tag-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ede9fe;
  color: #5b21b6;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
}

.tag-item button {
  background: none;
  border: none;
  cursor: pointer;
  color: #7c3aed;
  font-size: 0.9rem;
  padding: 0;
  line-height: 1;
  opacity: 0.7;
  transition: opacity var(--transition);
}

.tag-item button:hover { opacity: 1; }

.tag-input {
  border: none;
  outline: none;
  font-size: 0.875rem;
  flex: 1;
  min-width: 120px;
  padding: 4px 6px;
  color: var(--gray-800);
}

.tag-input::placeholder { color: var(--gray-400); }

/* ─── Objective Cards ────────────────────────────────────────── */
.objectives-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.objective-option {
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.objective-option:hover {
  border-color: var(--primary-light);
  background: #f5f3ff;
}

.objective-option.selected {
  border-color: var(--primary);
  background: #ede9fe;
}

.objective-option .emoji {
  font-size: 1.8rem;
  display: block;
  margin-bottom: 8px;
}

.objective-option .name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 4px;
}

.objective-option .desc {
  font-size: 0.72rem;
  color: var(--gray-500);
  line-height: 1.3;
}

/* ─── Progress Steps ─────────────────────────────────────────── */
.form-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 32px;
  padding: 0 4px;
}

.form-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  position: relative;
}

.form-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 16px;
  left: calc(50% + 16px);
  right: calc(-50% + 16px);
  height: 2px;
  background: var(--gray-200);
  z-index: 0;
}

.form-step.done:not(:last-child)::after {
  background: var(--primary);
}

.step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  border: 2px solid var(--gray-200);
  background: white;
  color: var(--gray-400);
  z-index: 1;
  transition: all var(--transition);
}

.form-step.active .step-circle {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.form-step.done .step-circle {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.step-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--gray-400);
  text-align: center;
}

.form-step.active .step-label,
.form-step.done .step-label { color: var(--primary); }

/* ─── Dashboard Charts ───────────────────────────────────────── */
.chart-container {
  position: relative;
  height: 280px;
}

.chart-container-sm {
  position: relative;
  height: 200px;
}

/* ─── Compare Table ──────────────────────────────────────────── */
.compare-bar-wrap {
  height: 8px;
  background: var(--gray-100);
  border-radius: 4px;
  overflow: hidden;
}

.compare-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* ─── Platform Connection ────────────────────────────────────── */
.platform-connection-card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-100);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: box-shadow var(--transition);
}

.platform-connection-card:hover {
  box-shadow: var(--shadow-md);
}

.platform-connection-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.platform-icon-circle {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.platform-connection-text h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 4px;
}

.platform-connection-text p {
  font-size: 0.8rem;
  color: var(--gray-500);
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
}

.connection-status.connected { color: var(--success); }
.connection-status.disconnected { color: var(--gray-400); }

.connection-status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.connection-status.connected .dot { background: var(--success); }
.connection-status.disconnected .dot { background: var(--gray-300); }

/* ─── Alerts / Toasts ────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: white;
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  max-width: 400px;
  pointer-events: auto;
  animation: slideInRight 0.3s ease;
  border-left: 4px solid;
}

.toast-success { border-color: var(--success); }
.toast-error   { border-color: var(--danger); }
.toast-warning { border-color: var(--warning); }
.toast-info    { border-color: var(--primary); }

.toast-icon { font-size: 1.1rem; }
.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon   { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon    { color: var(--primary); }

.toast-content { flex: 1; }
.toast-title { font-size: 0.85rem; font-weight: 700; color: var(--gray-900); }
.toast-message { font-size: 0.78rem; color: var(--gray-500); margin-top: 2px; }

.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  font-size: 1rem;
  padding: 0;
  flex-shrink: 0;
  transition: color var(--transition);
}
.toast-close:hover { color: var(--gray-600); }

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ─── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: white;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: scaleIn 0.25s ease;
}

.modal-header {
  padding: 24px 28px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-900);
}

.modal-close {
  background: var(--gray-100);
  border: none;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--gray-500);
  font-size: 1rem;
  transition: all var(--transition);
  flex-shrink: 0;
}

.modal-close:hover { background: var(--gray-200); color: var(--gray-700); }

.modal-body { padding: 28px; }

.modal-footer {
  padding: 20px 28px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ─── Empty State ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 40px;
  color: var(--gray-400);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.4;
  display: block;
}

.empty-state h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.85rem;
  margin-bottom: 24px;
}

/* ─── Dropdown ───────────────────────────────────────────────── */
.dropdown-wrapper {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: 200;
  overflow: hidden;
  animation: fadeIn 0.15s ease;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 0.85rem;
  color: var(--gray-700);
  cursor: pointer;
  transition: background var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover { background: var(--gray-50); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: #fef2f2; }
.dropdown-divider { height: 1px; background: var(--gray-100); margin: 4px 0; }

/* ─── Tabs ───────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 24px;
}

.tab-btn {
  padding: 12px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-500);
  background: none;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.tab-btn:hover { color: var(--gray-700); }

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-count {
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 0.7rem;
  padding: 1px 7px;
  border-radius: 20px;
  font-weight: 700;
}

.tab-btn.active .tab-count {
  background: #ede9fe;
  color: var(--primary);
}

/* ─── Filter Bar ─────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-select {
  padding: 8px 32px 8px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: 20px;
  font-size: 0.825rem;
  background: white;
  color: var(--gray-700);
  outline: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 8px center;
  background-repeat: no-repeat;
  background-size: 14px;
  -webkit-appearance: none;
  transition: border-color var(--transition);
}

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

.filter-search {
  flex: 1;
  max-width: 280px;
  position: relative;
}

.filter-search input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1.5px solid var(--gray-200);
  border-radius: 20px;
  font-size: 0.825rem;
  outline: none;
  transition: border-color var(--transition);
}

.filter-search input:focus { border-color: var(--primary); }

.filter-search i {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 0.75rem;
}

/* ─── Responsive (tablet / notebook / celular) ───────────────── */
/* Botão de menu (hambúrguer) e backdrop — escondidos no desktop */
.topbar-menu-btn {
  display: none;
  background: none; border: none; cursor: pointer;
  font-size: 1.25rem; color: var(--gray-700);
  width: 42px; height: 42px; border-radius: 10px; flex-shrink: 0;
}
.topbar-menu-btn:hover { background: var(--gray-100); }
.sidebar-backdrop {
  display: none; position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,0.45); backdrop-filter: blur(2px);
}
.sidebar-backdrop.show { display: block; }
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Notebook / tablet largo */
@media (max-width: 1100px) {
  .sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0,0,0,0.3); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .topbar-menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  .platforms-grid { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

/* Tablet */
@media (max-width: 820px) {
  .login-page { grid-template-columns: 1fr; }
  .login-left { display: none; }
  .page-content { padding: 18px 14px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .grid-3, .platforms-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
  .topbar-search { display: none; }
  .topbar-title h1 { font-size: 1.05rem; }
  .topbar-title p { display: none; }
}

/* Celular */
@media (max-width: 560px) {
  .topbar { height: 58px; gap: 6px; }
  .topbar-actions { gap: 6px; }
  .topbar-actions .btn span,
  .topbar-actions .btn { font-size: 0.78rem; }
  .topbar-icon-btn { width: 38px; height: 38px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .page-content { padding: 14px 12px; }
  .card-header { flex-wrap: wrap; gap: 8px; }
  .card-body { padding: 16px; }
  .modal { width: 94vw !important; max-width: 94vw !important; }
  h1 { font-size: 1.3rem; }
  /* botões e campos com toque confortável */
  .btn { min-height: 40px; }
  input, select, textarea, .form-input, .form-select { font-size: 16px; } /* evita zoom no iOS */
  .sidebar { width: 82vw; max-width: 300px; }
}

/* Celular pequeno */
@media (max-width: 380px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* ─── Campaign Detail ────────────────────────────────────────── */
.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #10b981;
  animation: livepulse 1.5s ease-in-out infinite;
  display: inline-block;
}
@keyframes livepulse {
  0%,100% { opacity:1; transform:scale(1); }
  50% { opacity:0.5; transform:scale(1.3); }
}

/* ─── Landing Page Builder ───────────────────────────────────── */
.lp-section-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
}
.lp-section-toggle:last-child { border-bottom: none; }

/* ─── Tutorials ──────────────────────────────────────────────── */
.tutorial-step {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--gray-100);
}
.tutorial-step:last-child { border-bottom: none; }
.tutorial-step-num {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem;
  flex-shrink: 0; color: white;
}

/* ─── Utilities ──────────────────────────────────────────────── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--gray-500); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.w-full { width: 100%; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Linha de campanha selecionada (multi-seleção) */
tr.row-selected td { background: #eef2ff; }
.help-tip:hover { background: var(--primary, #6366f1) !important; color: #fff !important; }

/* Dropdown de busca (interesses / cidades do Facebook) */
.search-dropdown {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 50;
  background: #fff; border: 1px solid var(--gray-200); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12); max-height: 280px; overflow-y: auto; margin-top: 4px;
}
.search-dropdown-item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid #f3f4f6; }
.search-dropdown-item:hover { background: #eef2ff; }

/* ─── Tabelas viram cartões no celular (só .responsive-table) ──── */
@media (max-width: 640px) {
  .responsive-table thead { display: none; }
  .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; width: 100%; }
  .responsive-table tr {
    border: 1px solid var(--gray-200); border-radius: 14px; margin-bottom: 12px;
    padding: 10px 14px; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  }
  .responsive-table td {
    border: none; padding: 7px 0; display: flex; align-items: center; justify-content: space-between;
    gap: 12px; text-align: right; font-size: 0.85rem;
  }
  .responsive-table td::before {
    content: attr(data-label); font-weight: 600; color: var(--gray-500);
    font-size: 0.74rem; text-align: left; text-transform: uppercase; letter-spacing: 0.3px;
  }
  .responsive-table td.cell-check { display: none; } /* seleção em massa fica só no desktop */
  .responsive-table td.cell-title {
    justify-content: flex-start; text-align: left;
    border-bottom: 1px solid var(--gray-100); padding-bottom: 9px; margin-bottom: 4px;
  }
  .responsive-table td.cell-title::before { content: none; }
  .responsive-table td.cell-title .truncate { max-width: 100% !important; white-space: normal; }
  .responsive-table td.cell-actions {
    justify-content: flex-start; flex-wrap: wrap; padding-top: 10px;
    border-top: 1px solid var(--gray-100); margin-top: 4px;
  }
  .responsive-table td.cell-actions::before { content: none; }
  .responsive-table td.cell-actions .btn { flex: 1; min-width: 60px; }
}
