/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f0f2f8;
  color: #1e2140;
  line-height: 1.5;
}

/* ===== LAYOUT ===== */
.app-layout { display: flex; min-height: 100vh; }
.main-content {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.page-body { padding: 28px 32px; flex: 1; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: 240px;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  background: #111827;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 100;
  border-right: 1px solid rgba(255,255,255,0.05);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.project-switcher {
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.project-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
  margin-bottom: 6px;
}
.project-select-wrap { position: relative; }
.project-select {
  width: 100%;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  color: #e5e7eb;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
}
.project-select:focus { outline: none; border-color: #4361ee; }
.sidebar-nav { padding: 12px 10px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: #9ca3af;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s;
  margin-bottom: 2px;
}
.nav-item svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,0.07); color: #e5e7eb; }
.nav-item.active { background: rgba(67,97,238,0.2); color: #818cf8; }
.nav-item.active svg { stroke: #818cf8; }
.nav-logout:hover { color: #f87171; }
.sidebar-footer {
  padding: 10px 10px 16px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 4px;
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4361ee, #7c3aed);
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-name { font-size: 0.8rem; font-weight: 600; color: #e5e7eb; }
.user-email { font-size: 0.7rem; color: #6b7280; }

/* ===== TOP BAR ===== */
.topbar {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title h1 { font-size: 1.2rem; font-weight: 700; color: #111827; }
.topbar-title p { font-size: 0.8rem; color: #6b7280; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}
.btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: #4361ee; color: white; }
.btn-primary:hover { background: #3451d1; }
.btn-secondary { background: #f3f4f6; color: #374151; border: 1px solid #e5e7eb; }
.btn-secondary:hover { background: #e5e7eb; }
.btn-danger { background: #fee2e2; color: #dc2626; }
.btn-danger:hover { background: #fecaca; }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-outline { background: transparent; border: 1.5px solid #4361ee; color: #4361ee; }
.btn-outline:hover { background: #4361ee; color: white; }

/* ===== CARDS ===== */
.card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
}
.card-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title { font-size: 0.95rem; font-weight: 700; color: #111827; }
.card-body { padding: 20px 22px; }

/* ===== STAT CARDS ===== */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.si-blue { background: #eff6ff; color: #4361ee; }
.si-green { background: #ecfdf5; color: #10b981; }
.si-red { background: #fef2f2; color: #ef4444; }
.si-orange { background: #fff7ed; color: #f59e0b; }
.si-purple { background: #f5f3ff; color: #8b5cf6; }
.stat-value { font-size: 1.7rem; font-weight: 800; color: #111827; line-height: 1.1; }
.stat-label { font-size: 0.78rem; color: #6b7280; margin-top: 3px; }
.stat-change { font-size: 0.75rem; margin-top: 4px; font-weight: 600; }
.stat-change.up { color: #10b981; }
.stat-change.down { color: #ef4444; }

/* ===== CHARTS GRID ===== */
.charts-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 24px; }
.charts-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.chart-container { position: relative; height: 240px; }

/* ===== MENTIONS TABLE ===== */
.mentions-list { display: flex; flex-direction: column; gap: 0; }
.mention-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 22px;
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.1s;
}
.mention-row:last-child { border-bottom: none; }
.mention-row:hover { background: #fafafa; }
.mention-source { flex-shrink: 0; margin-top: 2px; }
.mention-content { flex: 1; min-width: 0; }
.mention-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mention-title a { color: inherit; text-decoration: none; }
.mention-title a:hover { color: #4361ee; }
.mention-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mention-author { font-size: 0.75rem; color: #6b7280; }
.mention-time { font-size: 0.72rem; color: #9ca3af; }
.mention-excerpt { font-size: 0.8rem; color: #6b7280; margin-top: 4px; }
.mention-stats { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.mention-stat { text-align: center; }
.mention-stat .v { font-size: 0.82rem; font-weight: 700; color: #374151; }
.mention-stat .l { font-size: 0.65rem; color: #9ca3af; }

/* ===== SOURCE ICONS ===== */
.src-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
}
.src-tw   { background: #e7f3ff; color: #1d9bf0; }
.src-fb   { background: #e7f0ff; color: #1877f2; }
.src-ig   { background: #fce4ec; color: #e1306c; }
.src-li   { background: #e8f4fb; color: #0a66c2; }
.src-yt   { background: #fee2e2; color: #ff0000; }
.src-tt   { background: #f3e8ff; color: #010101; }
.src-news { background: #fef9c3; color: #854d0e; }
.src-blog { background: #f0fdf4; color: #15803d; }
.src-forum{ background: #fff7ed; color: #9a3412; }
.src-web  { background: #f1f5f9; color: #475569; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}
.sent-pos { background: #d1fae5; color: #065f46; }
.sent-neg { background: #fee2e2; color: #991b1b; }
.sent-neu { background: #f3f4f6; color: #374151; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.82rem; font-weight: 600; color: #374151; margin-bottom: 6px; }
.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: inherit;
  color: #111827;
  background: #fff;
  transition: border-color 0.15s;
}
.form-control:focus { outline: none; border-color: #4361ee; box-shadow: 0 0 0 3px rgba(67,97,238,0.1); }
.form-control::placeholder { color: #9ca3af; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.form-hint { font-size: 0.75rem; color: #6b7280; margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-error { color: #dc2626; font-size: 0.82rem; background: #fef2f2; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; border-left: 3px solid #ef4444; }
.form-success { color: #065f46; font-size: 0.82rem; background: #d1fae5; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; border-left: 3px solid #10b981; }

/* ===== FILTERS BAR ===== */
.filters-bar {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.filter-group { display: flex; align-items: center; gap: 8px; }
.filter-label { font-size: 0.78rem; font-weight: 600; color: #6b7280; white-space: nowrap; }
.filter-select {
  padding: 6px 10px;
  border: 1.5px solid #e5e7eb;
  border-radius: 7px;
  font-size: 0.8rem;
  font-family: inherit;
  color: #374151;
  background: #f9fafb;
  cursor: pointer;
}
.filter-select:focus { outline: none; border-color: #4361ee; }
.search-input {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid #e5e7eb;
  border-radius: 7px;
  padding: 0 12px;
  background: #f9fafb;
  flex: 1;
  min-width: 200px;
}
.search-input svg { width: 15px; height: 15px; stroke: #9ca3af; fill: none; stroke-width: 2; flex-shrink: 0; }
.search-input input { border: none; background: none; padding: 6px 0; font-size: 0.82rem; font-family: inherit; color: #374151; width: 100%; }
.search-input input:focus { outline: none; }
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid #e5e7eb;
  background: #f9fafb;
  color: #6b7280;
  transition: all 0.15s;
}
.pill.active { background: #4361ee; color: white; border-color: #4361ee; }
.pill:hover:not(.active) { border-color: #4361ee; color: #4361ee; }

/* ===== ALERT ITEMS ===== */
.alert-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  border-bottom: 1px solid #f3f4f6;
}
.alert-item:last-child { border-bottom: none; }
.alert-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: #fff7ed;
  color: #f59e0b;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.alert-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.alert-active .alert-icon { background: #ecfdf5; color: #10b981; }
.alert-info { flex: 1; }
.alert-name { font-size: 0.88rem; font-weight: 600; color: #111827; }
.alert-desc { font-size: 0.75rem; color: #6b7280; }
.alert-toggle { display: flex; gap: 8px; align-items: center; }
.toggle-switch { position: relative; width: 40px; height: 22px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: #d1d5db;
  border-radius: 11px;
  cursor: pointer;
  transition: 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  left: 3px; top: 3px;
  transition: 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider { background: #4361ee; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ===== COMPETITOR CARDS ===== */
.comp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.comp-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
}
.comp-card-header {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.comp-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.comp-name { font-weight: 700; font-size: 0.95rem; color: #111827; }
.comp-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1px; background: #f3f4f6; }
.comp-stat-item { background: #fff; padding: 12px; text-align: center; }
.comp-stat-val { font-size: 1.1rem; font-weight: 800; color: #111827; }
.comp-stat-lbl { font-size: 0.68rem; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.04em; }
.comp-chart-wrap { padding: 16px 18px; }

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: #fff;
  border-radius: 14px;
  padding: 28px;
  width: 100%;
  max-width: 480px;
  transform: translateY(16px);
  transition: transform 0.2s;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-title { font-size: 1.05rem; font-weight: 700; color: #111827; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #9ca3af;
}
.empty-state svg { width: 48px; height: 48px; stroke: #d1d5db; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 16px; }
.empty-state h3 { font-size: 1rem; font-weight: 600; color: #6b7280; margin-bottom: 8px; }
.empty-state p { font-size: 0.85rem; }

/* ===== TAGS ===== */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 0.75rem;
  color: #374151;
}
.tag .remove { cursor: pointer; color: #9ca3af; margin-left: 2px; }
.tag .remove:hover { color: #ef4444; }
.tags-container { display: flex; flex-wrap: wrap; gap: 6px; }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; }
table.data-table th {
  background: #f9fafb;
  padding: 10px 16px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}
table.data-table td {
  padding: 12px 16px;
  font-size: 0.85rem;
  color: #374151;
  border-bottom: 1px solid #f3f4f6;
}
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: #fafafa; }

/* ===== PAGINATION ===== */
.pagination { display: flex; gap: 4px; align-items: center; justify-content: center; padding: 16px; }
.page-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid #e5e7eb;
  background: #fff;
  color: #374151;
  transition: all 0.15s;
  text-decoration: none;
}
.page-btn:hover { border-color: #4361ee; color: #4361ee; }
.page-btn.active { background: #4361ee; border-color: #4361ee; color: white; }
.page-btn.disabled { opacity: 0.4; pointer-events: none; }

/* ===== LOGIN PAGE ===== */
.auth-layout {
  min-height: 100vh;
  display: flex;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
}
.auth-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px;
  max-width: 520px;
}
.auth-right {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
}
.auth-brand { margin-bottom: 48px; }
.auth-brand .logo-wrap { display: flex; align-items: center; gap: 12px; margin-bottom: 40px; }
.auth-brand .logo-name { font-size: 1.5rem; font-weight: 800; color: white; }
.auth-brand h2 { font-size: 1.8rem; font-weight: 800; color: white; line-height: 1.2; margin-bottom: 10px; }
.auth-brand p { color: #94a3b8; font-size: 0.95rem; }
.auth-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  padding: 36px;
}
.auth-card .form-label { color: #e2e8f0; }
.auth-card .form-control {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.15);
  color: white;
}
.auth-card .form-control::placeholder { color: rgba(255,255,255,0.35); }
.auth-card .form-control:focus { border-color: #818cf8; background: rgba(255,255,255,0.12); }
.auth-card .btn-primary { width: 100%; justify-content: center; padding: 12px; background: #4361ee; }
.auth-card .btn-primary:hover { background: #3451d1; }
.auth-link { color: #818cf8; text-decoration: none; font-size: 0.85rem; }
.auth-link:hover { text-decoration: underline; }
.auth-sep { text-align: center; color: #64748b; font-size: 0.82rem; margin: 16px 0; }
.feature-list { display: flex; flex-direction: column; gap: 20px; max-width: 400px; }
.feature-item { display: flex; align-items: flex-start; gap: 14px; }
.feature-icon { width: 44px; height: 44px; border-radius: 10px; background: rgba(255,255,255,0.1); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.feature-icon svg { width: 22px; height: 22px; stroke: #818cf8; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.feature-item h4 { font-size: 0.92rem; font-weight: 700; color: white; margin-bottom: 3px; }
.feature-item p { font-size: 0.8rem; color: #94a3b8; }

/* ===== RAPPORT ===== */
.rapport-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.rapport-icon { width: 44px; height: 44px; border-radius: 10px; background: #eff6ff; color: #4361ee; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.rapport-icon svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rapport-info { flex: 1; }
.rapport-title { font-size: 0.9rem; font-weight: 700; color: #111827; }
.rapport-meta { font-size: 0.75rem; color: #6b7280; margin-top: 3px; }
.rapport-status { font-size: 0.75rem; font-weight: 600; padding: 3px 8px; border-radius: 20px; }
.rs-pret { background: #d1fae5; color: #065f46; }
.rs-cours { background: #fef3c7; color: #92400e; }

/* ===== SUJET CARD ===== */
.sujet-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  padding: 20px;
  transition: all 0.15s;
  cursor: pointer;
}
.sujet-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.06); border-color: #c7d2fe; }
.sujet-card .sc-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.sujet-card .sc-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; }
.sujet-card .sc-name { font-weight: 700; font-size: 0.95rem; color: #111827; }
.sujet-card .sc-desc { font-size: 0.8rem; color: #6b7280; margin-bottom: 14px; }
.sujet-card .sc-stats { display: flex; gap: 16px; }
.sujet-card .sc-stat-val { font-size: 1.1rem; font-weight: 800; color: #111827; }
.sujet-card .sc-stat-lbl { font-size: 0.68rem; color: #9ca3af; }

/* ===== GRID LAYOUTS ===== */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.four-col { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ===== UTILS ===== */
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.text-sm { font-size: 0.82rem; }
.text-xs { font-size: 0.72rem; }
.text-muted { color: #6b7280; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.divider { height: 1px; background: #f3f4f6; margin: 20px 0; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ===== WORD CLOUD ===== */
.word-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
  line-height: 1.8;
}
.wc-word {
  cursor: default;
  font-weight: 600;
  transition: transform 0.15s, opacity 0.15s;
  display: inline-block;
}
.wc-word:hover { transform: scale(1.15); opacity: 1 !important; }

/* ===== HEATMAP ===== */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.hm-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: #f3f4f6;
  transition: transform 0.1s;
  cursor: default;
  position: relative;
}
.hm-cell:hover { transform: scale(1.2); z-index: 2; }
.hm-cell.hm-1 { background: #bfdbfe; }
.hm-cell.hm-2 { background: #93c5fd; }
.hm-cell.hm-3 { background: #60a5fa; }
.hm-cell.hm-4 { background: #3b82f6; }
.hm-cell.hm-5 { background: #1d4ed8; }
.hm-days { display: flex; justify-content: space-around; margin-bottom: 4px; }
.hm-day-label { font-size: 0.65rem; color: #9ca3af; text-align: center; }

/* ===== AI INSIGHTS ===== */
.ai-card {
  background: linear-gradient(135deg, #f0f4ff 0%, #faf5ff 100%);
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  padding: 18px 22px;
}
.ai-card .ai-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.ai-badge { background: linear-gradient(135deg, #4361ee, #7c3aed); color: white; font-size: 0.68rem; font-weight: 700; padding: 3px 8px; border-radius: 20px; letter-spacing: 0.05em; }
.ai-insights { display: flex; flex-direction: column; gap: 10px; }
.ai-insight { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; background: white; border-radius: 8px; border: 1px solid #e0e7ff; }
.ai-insight-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.ai-insight-text { font-size: 0.83rem; color: #374151; line-height: 1.5; }
.ai-insight-text strong { color: #111827; }

/* ===== MOBILE MENU ===== */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 200;
  background: #111827;
  border: none;
  border-radius: 8px;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}
.sidebar-overlay.open { display: block; }

/* ===== TOPBAR SEARCH ===== */
.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f9fafb;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  padding: 0 12px;
  width: 240px;
}
.topbar-search svg { width: 15px; height: 15px; stroke: #9ca3af; fill: none; stroke-width: 2; flex-shrink: 0; }
.topbar-search input { border: none; background: none; padding: 8px 0; font-size: 0.82rem; font-family: inherit; color: #374151; width: 100%; }
.topbar-search input:focus { outline: none; }

/* ===== DATE RANGE PICKER ===== */
.date-range { display: flex; align-items: center; gap: 8px; }
.date-range input[type="date"] { padding: 6px 10px; border: 1.5px solid #e5e7eb; border-radius: 7px; font-size: 0.8rem; font-family: inherit; color: #374151; background: #f9fafb; }
.date-range input[type="date"]:focus { outline: none; border-color: #4361ee; }
.date-range-sep { color: #9ca3af; font-size: 0.82rem; }

/* ===== TRENDING BADGE ===== */
.trend-up   { color: #10b981; font-weight: 700; font-size: 0.78rem; }
.trend-down { color: #ef4444; font-weight: 700; font-size: 0.78rem; }
.trend-new  { color: #8b5cf6; font-weight: 700; font-size: 0.78rem; }

/* ===== ACTIVITY HEATMAP CALENDAR ===== */
.heatmap-wrap { overflow-x: auto; padding: 8px 0; }
.heatmap-table { display: flex; gap: 3px; }
.heatmap-week { display: flex; flex-direction: column; gap: 3px; }
.heatmap-square {
  width: 13px; height: 13px;
  border-radius: 2px;
  background: #f3f4f6;
  cursor: pointer;
  transition: transform 0.1s;
}
.heatmap-square:hover { transform: scale(1.3); }
.hm-l0 { background: #f3f4f6; }
.hm-l1 { background: #bfdbfe; }
.hm-l2 { background: #60a5fa; }
.hm-l3 { background: #2563eb; }
.hm-l4 { background: #1e3a8a; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  .comp-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-240px); transition: transform 0.25s ease; }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu-btn { display: flex; }
  .main-content { margin-left: 0; }
  .topbar { padding-left: 62px; }
  .page-body { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .two-col, .three-col, .four-col { grid-template-columns: 1fr; }
  .auth-left { max-width: 100%; padding: 40px 24px; }
  .auth-right { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .topbar-search { display: none; }
  .charts-grid-3 { grid-template-columns: 1fr; }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeInUp 0.3s ease; }

/* ===== BRAND HEALTH GAUGE ===== */
.health-gauge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
}
.health-gauge {
  position: relative;
  width: 140px;
  height: 80px;
  overflow: hidden;
}
.health-gauge svg { width: 140px; height: 140px; position: absolute; top: 0; left: 0; }
.health-score-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
}
.health-score-val { font-size: 1.8rem; font-weight: 800; color: #111827; line-height: 1; }
.health-score-sub { font-size: 0.7rem; color: #6b7280; }
.health-details { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 14px; }
.health-detail-item { text-align: center; }
.health-detail-bar { width: 60px; height: 4px; background: #f3f4f6; border-radius: 2px; overflow: hidden; margin: 4px auto 2px; }
.health-detail-fill { height: 100%; border-radius: 2px; background: #4361ee; }
.health-detail-lbl { font-size: 0.68rem; color: #9ca3af; }
.health-detail-val { font-size: 0.78rem; font-weight: 700; color: #374151; }

/* ===== VIRALITY SCORE ===== */
.virality-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
}
.vb-hot  { background: #fef2f2; color: #dc2626; }
.vb-warm { background: #fff7ed; color: #d97706; }
.vb-cool { background: #f0fdf4; color: #15803d; }
.vb-low  { background: #f3f4f6; color: #6b7280; }

/* ===== MENTION TAGS ===== */
.tag-urgent   { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.tag-traite   { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
.tag-surveiller { background: #fef3c7; color: #92400e; border-color: #fde68a; }

/* ===== NOTIFICATION PANEL ===== */
.nav-bell {
  margin-left: auto;
  position: relative;
  cursor: pointer;
  color: #6b7280;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.15s;
  flex-shrink: 0;
}
.nav-bell:hover { background: rgba(255,255,255,0.1); color: #e5e7eb; }
.nav-bell-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  animation: pulse-badge 2s infinite;
}
@keyframes pulse-badge {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
.notif-panel {
  background: #1e293b;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  border-top: 1px solid rgba(255,255,255,0.07);
}
.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 8px;
}
.notif-item {
  padding: 9px 16px;
  border-top: 1px solid rgba(255,255,255,0.05);
  cursor: pointer;
  transition: background 0.1s;
}
.notif-item:hover { background: rgba(255,255,255,0.05); }
.notif-item-title { font-size: 0.78rem; font-weight: 600; color: #e2e8f0; margin-bottom: 2px; }
.notif-item-msg { font-size: 0.72rem; color: #64748b; }
.notif-item-time { font-size: 0.68rem; color: #475569; margin-top: 2px; }
.notif-empty { padding: 20px 16px; text-align: center; font-size: 0.78rem; color: #475569; }

/* ===== DARK MODE ROW ===== */
.dark-mode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  margin-bottom: 4px;
}

/* ===== AUTO-REFRESH INDICATOR ===== */
.refresh-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  margin-left: 6px;
  animation: blink-dot 3s infinite;
}
@keyframes blink-dot {
  0%,80%,100% { opacity: 1; }
  40% { opacity: 0.2; }
}

/* ===== NOTE PREVIEW ===== */
.note-preview {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: #8b5cf6;
  cursor: pointer;
  background: #f5f3ff;
  padding: 2px 7px;
  border-radius: 10px;
  border: 1px solid #ede9fe;
  max-width: 120px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.note-preview:hover { background: #ede9fe; }

/* ===== SAVED SEARCHES ===== */
.saved-search-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #1e40af;
  cursor: pointer;
  transition: all 0.15s;
}
.saved-search-chip:hover { background: #dbeafe; }
.saved-search-chip .del { color: #93c5fd; margin-left: 2px; }
.saved-search-chip .del:hover { color: #ef4444; }

/* ===== PERIOD COMPARE ===== */
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.compare-kpi { padding: 16px 20px; }
.compare-kpi .period-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #6b7280; margin-bottom: 8px; }
.compare-change { font-size: 0.75rem; font-weight: 700; margin-top: 4px; }
.compare-change.up { color: #10b981; }
.compare-change.down { color: #ef4444; }
.compare-change.neutral { color: #9ca3af; }

/* ===== DARK MODE ===== */
html.dark-mode,
body.dark-mode {
  background: #0f172a;
  color: #e2e8f0;
}
.dark-mode .card,
.dark-mode .stat-card,
.dark-mode .comp-card,
.dark-mode .sujet-card,
.dark-mode .rapport-card { background: #1e293b; border-color: #334155; }
.dark-mode .topbar { background: #1e293b; border-color: #334155; }
.dark-mode .topbar-title h1 { color: #f1f5f9; }
.dark-mode .topbar-title p { color: #94a3b8; }
.dark-mode .card-title { color: #f1f5f9; }
.dark-mode .card-header { border-color: #334155; }
.dark-mode .card-body { background: transparent; }
.dark-mode .stat-value { color: #f1f5f9; }
.dark-mode .stat-label { color: #94a3b8; }
.dark-mode .stat-card { background: #1e293b; }
.dark-mode .mention-title { color: #f1f5f9; }
.dark-mode .mention-title a { color: #f1f5f9; }
.dark-mode .mention-title a:hover { color: #818cf8; }
.dark-mode .mention-row { border-color: #334155; }
.dark-mode .mention-row:hover { background: #0f172a; }
.dark-mode .mention-excerpt { color: #94a3b8; }
.dark-mode .mention-author { color: #94a3b8; }
.dark-mode .mention-time { color: #64748b; }
.dark-mode .mention-stat .v { color: #e2e8f0; }
.dark-mode .filters-bar { background: #1e293b; border-color: #334155; }
.dark-mode .filter-select { background: #0f172a; border-color: #334155; color: #e2e8f0; }
.dark-mode .filter-label { color: #94a3b8; }
.dark-mode .search-input { background: #0f172a; border-color: #334155; }
.dark-mode .search-input input { color: #e2e8f0; }
.dark-mode .topbar-search { background: #0f172a; border-color: #334155; }
.dark-mode .topbar-search input { color: #e2e8f0; }
.dark-mode table.data-table th { background: #0f172a; color: #94a3b8; border-color: #334155; }
.dark-mode table.data-table td { color: #cbd5e1; border-color: #1e293b; }
.dark-mode table.data-table tr:hover td { background: rgba(255,255,255,0.03); }
.dark-mode .ai-card { background: linear-gradient(135deg,#1e2a4a,#1e1b4b); border-color: #3730a3; }
.dark-mode .ai-insight { background: #0f172a; border-color: #1e3a8a; }
.dark-mode .ai-insight-text { color: #cbd5e1; }
.dark-mode .form-control { background: #0f172a; border-color: #334155; color: #e2e8f0; }
.dark-mode .form-control::placeholder { color: #475569; }
.dark-mode .form-label { color: #cbd5e1; }
.dark-mode .form-select { background-color: #0f172a; }
.dark-mode .btn-secondary { background: #334155; color: #e2e8f0; border-color: #475569; }
.dark-mode .btn-secondary:hover { background: #475569; }
.dark-mode .sent-neu { background: #334155; color: #e2e8f0; }
.dark-mode .text-muted { color: #94a3b8; }
.dark-mode .hm-l0 { background: #1e293b; }
.dark-mode .modal { background: #1e293b; }
.dark-mode .modal-title { color: #f1f5f9; }
.dark-mode .modal-overlay { background: rgba(0,0,0,0.7); }
.dark-mode .page-btn { background: #1e293b; border-color: #334155; color: #e2e8f0; }
.dark-mode .page-btn.active { background: #4361ee; border-color: #4361ee; }
.dark-mode .alert-item { border-color: #334155; }
.dark-mode .alert-name { color: #f1f5f9; }
.dark-mode .alert-desc { color: #94a3b8; }
.dark-mode .alert-icon { background: rgba(245,158,11,0.15); }
.dark-mode .alert-active .alert-icon { background: rgba(16,185,129,0.15); }
.dark-mode .tag { background: #334155; border-color: #475569; color: #e2e8f0; }
.dark-mode .pill { background: #1e293b; border-color: #334155; color: #94a3b8; }
.dark-mode .pill.active { background: #4361ee; border-color: #4361ee; color: white; }
.dark-mode .divider { background: #334155; }
.dark-mode .form-success { background: rgba(16,185,129,0.1); border-color: #10b981; color: #6ee7b7; }
.dark-mode .form-error { background: rgba(239,68,68,0.1); border-color: #ef4444; color: #fca5a5; }
.dark-mode .project-select { background: rgba(255,255,255,0.05); color: #e5e7eb; }
.dark-mode .empty-state svg { stroke: #334155; }
.dark-mode .empty-state h3 { color: #94a3b8; }
.dark-mode .health-score-val { color: #f1f5f9; }
.dark-mode .health-detail-val { color: #cbd5e1; }
.dark-mode .health-detail-bar { background: #334155; }
.dark-mode .saved-search-chip { background: #1e3a8a; border-color: #1e40af; color: #bfdbfe; }
.dark-mode .saved-search-chip:hover { background: #1e40af; }
.dark-mode .note-preview { background: #2d1f6e; border-color: #4c1d95; color: #c4b5fd; }
.dark-mode .note-preview:hover { background: #4c1d95; }
.dark-mode .si-blue  { background: rgba(67,97,238,0.2); }
.dark-mode .si-green { background: rgba(16,185,129,0.2); }
.dark-mode .si-orange{ background: rgba(245,158,11,0.2); }
.dark-mode .si-purple{ background: rgba(139,92,246,0.2); }
.dark-mode .vb-hot   { background: rgba(220,38,38,0.15); }
.dark-mode .vb-warm  { background: rgba(217,119,6,0.15); }
.dark-mode .vb-cool  { background: rgba(21,128,61,0.15); }
.dark-mode .vb-low   { background: #334155; color: #94a3b8; }
.dark-mode .dark-mode-row { color: #9ca3af; }
.dark-mode .toggle-slider { background: #475569; }
.dark-mode .toggle-switch input:checked + .toggle-slider { background: #4361ee; }
