/* ============================================================
   THEME-NEW.CSS — Design system AI Agency
   Chargé après app.css — overrides layout + tokens
   Préfixe tn- pour tous les nouveaux composants
   ============================================================ */

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

/* ── DESIGN TOKENS ─────────────────────────────────────────── */
:root {
  --bg:                  #0c0e0f;
  --surface:             #121415;
  --surface-low:         #1a1c1d;
  --surface-mid:         #1e2021;
  --surface-high:        #282a2b;
  --surface-highest:     #333536;
  --on-surface:          #e2e2e3;
  --on-surface-muted:    #bbc9cf;
  --outline:             #859398;
  --outline-dim:         #3c494e;
  --primary:             #00d4ff;
  --primary-dim:         #3cd7ff;
  --primary-soft:        rgba(0, 212, 255, 0.08);
  --primary-glow:        rgba(0, 212, 255, 0.15);
  --secondary:           #ffb695;
  --secondary-dark:      #923900;
  --error-new:           #ffb4ab;

  --radius-sm:   0.25rem;
  --radius:      0.5rem;
  --radius-md:   0.75rem;
  --radius-lg:   1rem;
  --radius-xl:   1.5rem;
  --radius-full: 9999px;

  --font-head: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;

  --sidebar-w: 220px;
  --topbar-h:  56px;
}

/* ── BASE ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  background: var(--bg) !important;
  color: var(--on-surface) !important;
  font-family: var(--font-body) !important;
  font-size: 15px;
}

/* Overflow cadenassé uniquement quand le shell est présent */
body:has(.app-shell) {
  overflow: hidden;
  height: 100%;
}
html:has(.app-shell) {
  height: 100%;
}

/* ── SCROLLBAR ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--outline-dim); border-radius: 2px; }

/* ── APP SHELL ─────────────────────────────────────────────── */
body > .container,
body > div.container {
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  height: 100vh;
  width: 100%;
  position: fixed;
  inset: 0;
}

/* nav-container transparent → ses enfants participent à la grille */
#nav-container {
  display: contents;
}

/* ── TOPBAR ────────────────────────────────────────────────── */
.tn-topbar {
  grid-column: 1 / -1;
  grid-row: 1;
  background: var(--surface);
  border-bottom: 1px solid var(--outline-dim);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  position: relative;
  z-index: 200;
  flex-shrink: 0;
}

.tn-topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  width: var(--sidebar-w);
  padding-right: 16px;
  border-right: 1px solid var(--outline-dim);
  flex-shrink: 0;
  min-width: 0;
}

.tn-logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), #0066ff);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 12px;
  color: #001f27;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.3);
  overflow: hidden;
}

.tn-logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius);
}

.tn-logo-text {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 12px;
  line-height: 1.2;
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tn-logo-sub {
  font-size: 9px;
  color: var(--on-surface-muted);
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.tn-topbar-search {
  flex: 1;
  max-width: 320px;
  background: var(--surface-mid);
  border: 1px solid var(--outline-dim);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 32px;
}

.tn-topbar-search input {
  background: none;
  border: none;
  outline: none;
  color: var(--on-surface);
  font-family: var(--font-body);
  font-size: 13px;
  flex: 1;
  cursor: default;
}

.tn-topbar-search input::placeholder { color: var(--outline); }
.tn-topbar-search svg { color: var(--outline); flex-shrink: 0; }

.tn-topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tn-topbar-sep {
  width: 1px;
  height: 20px;
  background: var(--outline-dim);
  flex-shrink: 0;
}

/* Bouton topbar */
.tn-btn {
  height: 32px;
  min-width: 32px;
  border-radius: var(--radius);
  background: var(--surface-mid);
  border: 1px solid var(--outline-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--on-surface-muted);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  gap: 6px;
  padding: 0 10px;
  white-space: nowrap;
  text-decoration: none;
}

.tn-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.tn-btn-icon {
  padding: 0;
  width: 32px;
  min-width: 32px;
}

.tn-btn-label { display: inline; }

.tn-user-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px 3px 3px;
  background: var(--surface-mid);
  border: 1px solid var(--outline-dim);
  border-radius: var(--radius-full);
  cursor: default;
}

.tn-user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #0066ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #001f27;
  flex-shrink: 0;
}

.tn-user-email {
  font-size: 12px;
  color: var(--on-surface-muted);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tn-btn-logout {
  padding: 0 12px;
  height: 32px;
  background: transparent;
  border: 1px solid var(--outline-dim);
  border-radius: var(--radius);
  color: var(--on-surface-muted);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: border-color 0.15s, color 0.15s;
}

.tn-btn-logout:hover {
  border-color: var(--error-new);
  color: var(--error-new);
}

/* ── SIDEBAR ────────────────────────────────────────────────── */
.tn-sidebar {
  grid-column: 1;
  grid-row: 2;
  background: var(--surface);
  border-right: 1px solid var(--outline-dim);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0;
}

.tn-nav-section {
  padding: 0 10px;
  margin-bottom: 4px;
}

.tn-nav-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--outline);
  padding: 8px 8px 4px;
}

.tn-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--on-surface-muted);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  transition: background 0.12s, color 0.12s;
  position: relative;
  text-decoration: none;
  border: 1px solid transparent;
  line-height: 1.3;
}

.tn-nav-item:hover {
  background: var(--surface-mid);
  color: var(--on-surface);
  text-decoration: none;
}

.tn-nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: rgba(0, 212, 255, 0.15);
}

.tn-nav-item.active::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px var(--primary);
}

.tn-nav-item svg { flex-shrink: 0; opacity: 0.75; }
.tn-nav-item.active svg { opacity: 1; }

.tn-nav-divider {
  height: 1px;
  background: var(--outline-dim);
  margin: 6px 10px;
}

.tn-sidebar-footer {
  margin-top: auto;
  padding: 10px;
}

.tn-sidebar-footer-text {
  font-size: 10px;
  color: var(--outline);
  text-align: center;
  font-family: var(--font-body);
}

.tn-nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #001f27;
  flex-shrink: 0;
  min-width: 18px;
  text-align: center;
}

/* ── MAIN CONTENT ───────────────────────────────────────────── */
.tn-main {
  grid-column: 2;
  grid-row: 2;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg);
  padding: 28px 32px;
}

/* .section dans .tn-main : toujours visible (app.css le masque) */
.tn-main .section,
.tn-main .section.active {
  display: block !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  animation: none !important;
}

/* ── PAGE HEADER ─────────────────────────────────────────────── */
.tn-page-header { margin-bottom: 24px; }

.tn-page-title {
  font-family: var(--font-head);
  font-size: 26px;
  font-weight: 700;
  color: var(--on-surface);
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin: 0;
}

.tn-page-subtitle {
  font-size: 13px;
  color: var(--on-surface-muted);
  margin-top: 4px;
}

/* ── KPI CARDS ──────────────────────────────────────────────── */
.tn-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.tn-kpi-card {
  background: var(--surface);
  border: 1px solid var(--outline-dim);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
  animation: tn-fadeUp 0.4s ease both;
}

.tn-kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), transparent);
}

.tn-kpi-card:hover {
  border-color: rgba(0, 212, 255, 0.25);
  transform: translateY(-1px);
}

.tn-kpi-card.secondary::before { background: linear-gradient(90deg, var(--secondary), transparent); }
.tn-kpi-card.error::before     { background: linear-gradient(90deg, var(--error-new), transparent); }

.tn-kpi-card:nth-child(1) { animation-delay: 0.05s; }
.tn-kpi-card:nth-child(2) { animation-delay: 0.10s; }
.tn-kpi-card:nth-child(3) { animation-delay: 0.15s; }

.tn-kpi-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.tn-kpi-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--on-surface-muted);
}

.tn-kpi-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tn-kpi-icon.cyan   { background: rgba(0, 212, 255, 0.12);  color: var(--primary); }
.tn-kpi-icon.orange { background: rgba(255, 182, 149, 0.12); color: var(--secondary); }
.tn-kpi-icon.red    { background: rgba(255, 180, 171, 0.12); color: var(--error-new); }

.tn-kpi-value {
  font-family: var(--font-head);
  font-size: 30px;
  font-weight: 700;
  color: var(--on-surface);
  line-height: 1;
  letter-spacing: -0.02em;
}

.tn-kpi-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 7px;
}

.tn-kpi-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.tn-kpi-badge.up      { background: rgba(0, 212, 255, 0.1);  color: var(--primary); }
.tn-kpi-badge.neutral { background: var(--surface-high);      color: var(--outline); }
.tn-kpi-badge.down    { background: rgba(255, 180, 171, 0.1); color: var(--error-new); }

.tn-kpi-trend-text { font-size: 10px; color: var(--outline); }

/* ── PANELS ─────────────────────────────────────────────────── */
.tn-panel {
  background: var(--surface);
  border: 1px solid var(--outline-dim);
  border-radius: var(--radius-lg);
  overflow: hidden;
  animation: tn-fadeUp 0.4s ease both;
  animation-delay: 0.2s;
}

.tn-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--outline-dim);
}

.tn-panel-title {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  color: var(--on-surface);
}

.tn-panel-body { padding: 18px; }

/* ── GRILLES ────────────────────────────────────────────────── */
.tn-grid-2 {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 14px;
  margin-bottom: 20px;
}

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

/* ── BOUTONS INTERNES ───────────────────────────────────────── */
.tn-btn-sm {
  padding: 5px 12px;
  height: 28px;
  background: var(--surface-mid);
  border: 1px solid var(--outline-dim);
  border-radius: var(--radius);
  color: var(--on-surface-muted);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: border-color 0.15s, color 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.tn-btn-sm:hover {
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}

.tn-btn-primary {
  padding: 7px 16px;
  background: var(--primary);
  border: none;
  border-radius: var(--radius);
  color: #001f27;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, box-shadow 0.15s;
  box-shadow: 0 0 14px rgba(0, 212, 255, 0.18);
}

.tn-btn-primary:hover {
  background: #33ddff;
  box-shadow: 0 0 22px rgba(0, 212, 255, 0.32);
}

/* ── BADGES ─────────────────────────────────────────────────── */
.tn-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}
.tn-badge.ok   { background: rgba(74, 222, 128, 0.1); color: #4ade80; }
.tn-badge.warn { background: rgba(255, 182, 149, 0.1); color: var(--secondary); }
.tn-badge.up   { background: rgba(0, 212, 255, 0.1);  color: var(--primary); }

/* ── CHART ──────────────────────────────────────────────────── */
.tn-chart-wrap { position: relative; height: 200px; }

/* ── ACTIVITY FEED ──────────────────────────────────────────── */
.tn-activity-list { display: flex; flex-direction: column; }

.tn-activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--outline-dim);
}
.tn-activity-item:last-child { border-bottom: none; padding-bottom: 0; }

.tn-activity-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}
.tn-activity-dot.cyan   { background: var(--primary);    box-shadow: 0 0 5px var(--primary); }
.tn-activity-dot.orange { background: var(--secondary);  box-shadow: 0 0 5px var(--secondary); }
.tn-activity-dot.gray   { background: var(--outline); }

.tn-activity-text {
  font-size: 12px;
  color: var(--on-surface);
  line-height: 1.4;
  flex: 1;
}
.tn-activity-text strong { color: var(--primary); font-weight: 600; }
.tn-activity-time { font-size: 10px; color: var(--outline); flex-shrink: 0; margin-top: 2px; }

/* ── ARTICLE LIST ───────────────────────────────────────────── */
.tn-article-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--outline-dim);
}
.tn-article-item:last-child { border-bottom: none; }

.tn-article-status {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  white-space: nowrap;
}
.tn-article-status.published { background: rgba(0, 212, 255, 0.1);  color: var(--primary); }
.tn-article-status.pending   { background: rgba(255, 182, 149, 0.1); color: var(--secondary); }
.tn-article-status.draft     { background: var(--surface-high);       color: var(--outline); }

.tn-article-info { flex: 1; min-width: 0; }
.tn-article-title { font-size: 12px; color: var(--on-surface); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tn-article-cat   { font-size: 10px; color: var(--outline); margin-top: 1px; }

/* ── STATUS / MONITORING ────────────────────────────────────── */
.tn-status-list { display: flex; flex-direction: column; gap: 9px; }

.tn-status-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.tn-status-indicator {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  animation: tn-pulse 2s infinite;
}
.tn-status-indicator.green  { background: #4ade80; box-shadow: 0 0 5px #4ade80; }
.tn-status-indicator.cyan   { background: var(--primary);   box-shadow: 0 0 5px var(--primary); }
.tn-status-indicator.orange { background: var(--secondary); box-shadow: 0 0 5px var(--secondary); }

.tn-status-name { font-size: 12px; color: var(--on-surface); flex: 1; }

/* ── QUICK ACTIONS ──────────────────────────────────────────── */
.tn-quick-actions { display: flex; flex-direction: column; gap: 7px; }

.tn-quick-action {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border-radius: var(--radius-md);
  background: var(--surface-mid);
  border: 1px solid var(--outline-dim);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  color: var(--on-surface-muted);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-body);
}
.tn-quick-action:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}
.tn-quick-action svg { flex-shrink: 0; }

/* ── ANIMATIONS ─────────────────────────────────────────────── */
@keyframes tn-fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes tn-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

/* ── LOADING OVERLAY ────────────────────────────────────────── */
.loading-overlay {
  background: rgba(8, 10, 11, 0.85) !important;
}
.loading-content {
  background: var(--surface) !important;
  border: 1px solid var(--outline-dim) !important;
  border-radius: var(--radius-lg) !important;
  color: var(--on-surface) !important;
  padding: 28px 32px !important;
  text-align: center !important;
  box-shadow: none !important;
}
.loading-content p { color: var(--on-surface-muted) !important; font-size: 13px; margin-top: 12px; }
/* compat classe mt-3 (pas bootstrap ici, juste margin) */
.mt-3 { margin-top: 12px !important; }

.spinner {
  border: 3px solid rgba(255,255,255,0.08) !important;
  border-top-color: var(--primary) !important;
}

/* ── TOAST ──────────────────────────────────────────────────── */
#toastContainer {
  position: fixed !important;
  bottom: 20px !important;
  right: 20px !important;
  z-index: 9999 !important;
  pointer-events: none;
}
#toastContainer > * { pointer-events: auto; }

/* ── MODALES ────────────────────────────────────────────────── */
.modal {
  background: rgba(0, 0, 0, 0.78) !important;
}

.modal-content {
  background: var(--surface-low) !important;
  border: 1px solid var(--outline-dim) !important;
  border-radius: var(--radius-lg) !important;
  color: var(--on-surface) !important;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6) !important;
}

.modal-header {
  background: var(--surface) !important;
  border-bottom: 1px solid var(--outline-dim) !important;
  color: var(--on-surface) !important;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
}

.modal-footer {
  background: var(--surface) !important;
  border-top: 1px solid var(--outline-dim) !important;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg) !important;
}

.modal h2, .modal h3, .modal h4, .modal h5 {
  color: var(--on-surface) !important;
  font-family: var(--font-head) !important;
}

.modal label {
  color: var(--on-surface-muted) !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
}

/* ── FORMULAIRES (global) ───────────────────────────────────── */
.form-control,
input[type="text"], input[type="email"], input[type="number"],
input[type="date"], input[type="tel"], input[type="url"],
input[type="password"], input[type="search"],
select, textarea {
  background-color: var(--surface-mid) !important;
  border-color: var(--outline-dim) !important;
  color: var(--on-surface) !important;
  border-radius: var(--radius) !important;
}

.form-control:focus,
input:focus, select:focus, textarea:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px var(--primary-glow) !important;
  outline: none !important;
}

.form-group label {
  color: var(--on-surface-muted) !important;
}

/* ── TABLES ─────────────────────────────────────────────────── */
.table, table { color: var(--on-surface) !important; border-color: var(--outline-dim) !important; }
.table th, table th {
  background: var(--surface-high) !important;
  color: var(--on-surface-muted) !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  letter-spacing: 0.05em !important;
  text-transform: uppercase !important;
  border-color: var(--outline-dim) !important;
}
.table td, table td {
  border-color: var(--outline-dim) !important;
  color: var(--on-surface) !important;
  background: var(--surface) !important;
}
.table tbody tr, table tbody tr {
  background: var(--surface) !important;
}
.table tbody tr:hover, table tbody tr:hover {
  background: var(--surface-mid) !important;
}
.table tbody tr:hover td, table tbody tr:hover td {
  background: var(--surface-mid) !important;
}
/* Boutons dans les cellules action */
.table-actions, td .flex, td .btn-group {
  background: transparent !important;
}
td .btn, .table td .btn {
  background-color: var(--surface-high) !important;
  border-color: var(--outline-dim) !important;
  color: var(--on-surface-muted) !important;
}
td .btn-info    { background-color: rgba(0,212,255,0.12) !important; border-color: var(--primary) !important; color: var(--primary) !important; }
td .btn-success { background-color: rgba(74,222,128,0.12) !important; border-color: #4ade80 !important; color: #4ade80 !important; }
td .btn-danger  { background-color: rgba(255,180,171,0.12) !important; border-color: var(--error-new) !important; color: var(--error-new) !important; }
td .btn-warning { background-color: rgba(255,182,149,0.12) !important; border-color: var(--secondary) !important; color: var(--secondary) !important; }
td .btn-secondary { background-color: var(--surface-high) !important; border-color: var(--outline-dim) !important; color: var(--on-surface-muted) !important; }

/* ── FILE LIST ──────────────────────────────────────────────── */
.file-list-item {
  background: var(--surface-mid) !important;
  border-color: var(--outline-dim) !important;
  color: var(--on-surface) !important;
}
.file-list-item:hover {
  background: var(--surface-high) !important;
  border-color: var(--primary) !important;
}
.file-list-item .file-name,
.file-info .file-name,
.file-list-item a.file-name {
  color: var(--primary) !important;
  text-decoration: none !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60vw;
}
.file-list-item .file-name:hover,
.file-info .file-name:hover {
  color: var(--primary-dim) !important;
  text-decoration: underline !important;
}
.file-list-item .file-icon {
  color: var(--on-surface-muted) !important;
}
.file-actions .text-muted {
  color: var(--outline) !important;
}

/* ── CARDS LEGACY ───────────────────────────────────────────── */
.card {
  background: var(--surface) !important;
  border: 1px solid var(--outline-dim) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: none !important;
  color: var(--on-surface) !important;
}
.card-header {
  background: var(--surface-high) !important;
  border-bottom: 1px solid var(--outline-dim) !important;
  color: var(--on-surface) !important;
}
.card-body { background: var(--surface) !important; color: var(--on-surface) !important; }
.card-title { color: var(--on-surface) !important; font-family: var(--font-head) !important; }

/* ── SITEWEB DARK ───────────────────────────────────────────── */
.siteweb-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.siteweb-stat-card {
  background: var(--surface) !important;
  border: 1px solid var(--outline-dim) !important;
  border-radius: var(--radius-lg) !important;
  color: var(--on-surface) !important;
  padding: 20px !important;
  text-align: left !important;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.siteweb-stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), transparent);
}
.siteweb-stat-card:hover {
  border-color: rgba(0,212,255,.3) !important;
  transform: translateY(-1px);
}
.siteweb-stat-card .number {
  font-family: var(--font-head) !important;
  font-size: 32px !important;
  font-weight: 700 !important;
  color: var(--on-surface) !important;
  line-height: 1 !important;
  margin-bottom: 6px !important;
}
.siteweb-stat-card .label {
  font-size: 10px !important;
  font-weight: 600 !important;
  letter-spacing: .07em !important;
  text-transform: uppercase !important;
  color: var(--on-surface-muted) !important;
  opacity: 1 !important;
  margin: 0 !important;
}
/* Tabs siteweb */
.siteweb-tabs {
  border-bottom-color: var(--outline-dim) !important;
  margin-bottom: 20px !important;
}
.siteweb-tab {
  color: var(--on-surface-muted) !important;
  font-family: var(--font-body) !important;
  font-size: 13px !important;
  background: transparent !important;
}
.siteweb-tab:hover { background: var(--surface-mid) !important; color: var(--on-surface) !important; }
.siteweb-tab.active {
  background: transparent !important;
  color: var(--primary) !important;
  border-bottom: 2px solid var(--primary) !important;
  border-radius: 0 !important;
}
.siteweb-tab .count {
  background: var(--primary) !important;
  color: #001f27 !important;
}
/* Table articles */
.articles-table th {
  background: var(--surface-high) !important;
  color: var(--on-surface-muted) !important;
  border-color: var(--outline-dim) !important;
}
.articles-table td {
  border-bottom-color: var(--outline-dim) !important;
  color: var(--on-surface) !important;
  background: var(--surface) !important;
}
.articles-table tr:hover td { background: var(--surface-mid) !important; }
/* Indicateur last update */
#siteweb-last-update { color: var(--outline) !important; }
/* Bouton générer article (gradient violet conservé) */

/* ── MODALES — ÉLÉMENTS INTERNES COMPLETS ───────────────────── */
.modal-body {
  background: var(--surface-low) !important;
  color: var(--on-surface) !important;
}
/* Contenu preview article */
.article-preview-content,
#preview-content {
  background: var(--surface-mid) !important;
  color: var(--on-surface) !important;
  border: 1px solid var(--outline-dim) !important;
  border-radius: var(--radius-md) !important;
  padding: 16px !important;
}
.article-preview-content *,
#preview-content * {
  color: var(--on-surface) !important;
  background: transparent !important;
}
.article-preview-content h1, .article-preview-content h2,
.article-preview-content h3, .article-preview-content h4,
#preview-content h1, #preview-content h2,
#preview-content h3, #preview-content h4 {
  color: var(--on-surface) !important;
  font-family: var(--font-head) !important;
  border-bottom-color: var(--outline-dim) !important;
}
.article-preview-content a, #preview-content a { color: var(--primary) !important; }
.article-preview-content blockquote, #preview-content blockquote {
  border-left-color: var(--primary) !important;
  background: var(--surface-high) !important;
  color: var(--on-surface-muted) !important;
}
.article-preview-content code, #preview-content code,
.article-preview-content pre,  #preview-content pre {
  background: var(--surface-high) !important;
  color: var(--primary-dim) !important;
}
/* Textes muted dans modales */
.modal p, .modal span, .modal li, .modal small { color: var(--on-surface) !important; }
.modal .text-muted, .modal small { color: var(--on-surface-muted) !important; }
/* Inputs dans modales */
.modal input, .modal select, .modal textarea {
  background: var(--surface-mid) !important;
  border-color: var(--outline-dim) !important;
  color: var(--on-surface) !important;
}
/* Dividers */
.modal hr, .modal .divider {
  border-color: var(--outline-dim) !important;
  background: var(--outline-dim) !important;
}
/* Cellules sticky tables dans modales */
.modal td[style*="background: var(--white)"],
.modal th[style*="background: var(--white)"] {
  background: var(--surface-high) !important;
}
/* Éditeur textarea article */
#edit-article-content {
  background: var(--surface-mid) !important;
  color: var(--on-surface) !important;
  border-color: var(--outline-dim) !important;
  font-family: var(--font-body) !important;
  font-size: 13px !important;
  min-height: 300px !important;
}

/* ── MESSAGERIE DARK ────────────────────────────────────────── */
.messaging-container {
  border-color: var(--outline-dim) !important;
  background: var(--surface) !important;
}
.messaging-conversations {
  background: var(--surface) !important;
  border-right-color: var(--outline-dim) !important;
}
.conversation-item {
  border-bottom-color: var(--outline-dim) !important;
  color: var(--on-surface) !important;
}
.conversation-item:hover { background: var(--surface-mid) !important; }
.conversation-item.active {
  background: var(--primary-soft) !important;
  color: var(--primary) !important;
  border-left: 2px solid var(--primary);
}
.conversation-item .conv-name   { color: var(--on-surface) !important; font-weight: 600; }
.conversation-item .conv-preview { color: var(--on-surface-muted) !important; font-size: 12px; }
.conversation-item .conv-time   { color: var(--outline) !important; font-size: 11px; }

.chat-header {
  background: var(--surface) !important;
  border-bottom-color: var(--outline-dim) !important;
  color: var(--on-surface) !important;
}
.chat-messages {
  background: var(--bg) !important;
}
.message-content {
  background: var(--surface-mid) !important;
  color: var(--on-surface) !important;
  box-shadow: none !important;
}
.message.sent .message-content {
  background: var(--primary) !important;
  color: #001f27 !important;
}
.message-time { color: var(--outline) !important; }

.chat-input {
  background: var(--surface) !important;
  border-top-color: var(--outline-dim) !important;
}

/* ── FULLCALENDAR DARK ──────────────────────────────────────── */
#calendar { color: var(--on-surface) !important; }

.fc { color: var(--on-surface) !important; font-family: var(--font-body) !important; }

/* Toolbar */
.fc .fc-toolbar { flex-wrap: wrap; gap: 8px; margin-bottom: 16px !important; }
.fc .fc-toolbar-title { font-family: var(--font-head) !important; font-size: 20px !important; font-weight: 700 !important; color: var(--on-surface) !important; }
.fc .fc-button {
  background: var(--surface-mid) !important;
  border-color: var(--outline-dim) !important;
  color: var(--on-surface-muted) !important;
  font-family: var(--font-body) !important;
  font-size: 12px !important;
  box-shadow: none !important;
}
.fc .fc-button:hover { border-color: var(--primary) !important; color: var(--primary) !important; background: var(--primary-soft) !important; }
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #001f27 !important;
}
.fc .fc-today-button { opacity: 1 !important; }

/* Table header jours */
.fc .fc-col-header-cell { background: var(--surface) !important; border-color: var(--outline-dim) !important; }
.fc .fc-col-header-cell-cushion { color: var(--on-surface-muted) !important; font-size: 11px !important; font-weight: 600 !important; letter-spacing: .05em !important; text-transform: uppercase !important; text-decoration: none !important; }

/* Cellules jours */
.fc .fc-daygrid-day { background: var(--surface) !important; border-color: var(--outline-dim) !important; }
.fc .fc-daygrid-day:hover { background: var(--surface-mid) !important; }
.fc .fc-daygrid-day.fc-day-today { background: var(--primary-soft) !important; }
.fc .fc-daygrid-day-number { color: var(--on-surface-muted) !important; font-size: 12px !important; text-decoration: none !important; }
.fc .fc-day-today .fc-daygrid-day-number {
  background: var(--primary) !important;
  color: #001f27 !important;
  border-radius: 50% !important;
  width: 24px !important; height: 24px !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  font-weight: 700 !important;
}
.fc .fc-day-other .fc-daygrid-day-number { color: var(--outline) !important; }

/* Bordures globales */
.fc-theme-standard td, .fc-theme-standard th, .fc-theme-standard .fc-scrollgrid { border-color: var(--outline-dim) !important; }

/* Événements */
.fc .fc-event {
  border-radius: var(--radius-sm) !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  border: none !important;
  padding: 2px 5px !important;
}
.fc .fc-daygrid-event-dot { border-color: var(--primary) !important; }

/* Vue liste */
.fc .fc-list-day-cushion { background: var(--surface-high) !important; color: var(--on-surface) !important; }
.fc .fc-list-event:hover td { background: var(--surface-mid) !important; }
.fc .fc-list-empty { background: var(--surface) !important; color: var(--on-surface-muted) !important; }

/* ── PORTAL GRID ────────────────────────────────────────────── */
.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
/* Tool cards dans le portail */
.portal-grid .card {
  background: var(--surface) !important;
  border: 1px solid var(--outline-dim) !important;
  border-radius: var(--radius-lg) !important;
  transition: border-color .15s, transform .15s !important;
  cursor: pointer;
}
.portal-grid .card:hover {
  border-color: var(--primary) !important;
  transform: translateY(-2px) !important;
}
.portal-grid .card .card-body {
  background: transparent !important;
}
.portal-grid .card h3.card-title {
  color: var(--on-surface) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
}
/* Footer de la card (bouton supprimer) */
.portal-grid .card > div:last-child {
  background: var(--surface-mid) !important;
  border-top-color: var(--outline-dim) !important;
}

/* ── STAT CARDS LEGACY (prospection) ───────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface) !important;
  border: 1px solid var(--outline-dim) !important;
  border-radius: var(--radius-lg) !important;
  color: var(--on-surface) !important;
  padding: 18px 20px !important;
  text-align: left !important;
}
.stat-card h3 {
  font-family: var(--font-head) !important;
  font-size: 28px !important;
  font-weight: 700 !important;
  color: var(--on-surface) !important;
  margin-bottom: 4px !important;
}
.stat-card p {
  font-size: 10px !important;
  font-weight: 600 !important;
  letter-spacing: .06em !important;
  text-transform: uppercase !important;
  color: var(--on-surface-muted) !important;
  opacity: 1 !important;
}

/* ── SEARCH CONTROLS (prospection) ─────────────────────────── */
.search-controls {
  display: flex !important;
  gap: 10px !important;
  flex-wrap: wrap !important;
  margin-bottom: 16px !important;
}
.search-controls input,
.search-controls select {
  background: var(--surface-mid) !important;
  border-color: var(--outline-dim) !important;
  color: var(--on-surface) !important;
}
.search-controls input { flex: 1; min-width: 200px; }
.search-controls select { width: auto !important; }

/* ── PROSPECT CARDS ─────────────────────────────────────────── */
.prospect-card {
  background: var(--surface) !important;
  border: 1px solid var(--outline-dim) !important;
  border-left: 3px solid var(--primary) !important;
  border-radius: var(--radius-lg) !important;
  color: var(--on-surface) !important;
  margin-bottom: 10px !important;
}
.prospect-card:hover {
  border-color: var(--primary) !important;
  background: var(--surface-mid) !important;
  transform: none !important;
}
.prospect-header {
  border-bottom-color: var(--outline-dim) !important;
}
.prospect-company {
  color: var(--on-surface) !important;
  font-size: 1.1rem !important;
}
.prospect-meta-item {
  color: var(--on-surface-muted) !important;
}
/* Status badges dark */
.status-draft       { background: rgba(251,191,36,0.12) !important; color: #fbbf24 !important; }
.status-ready       { background: rgba(96,165,250,0.12) !important; color: #60a5fa !important; }
.status-sent        { background: rgba(74,222,128,0.12) !important; color: #4ade80 !important; }
.status-replied     { background: rgba(167,139,250,0.12) !important; color: #a78bfa !important; }
.status-unsubscribed{ background: rgba(255,180,171,0.12) !important; color: var(--error-new) !important; }
/* AI insight block */
.prospect-ai-insight {
  background: rgba(0,212,255,0.05) !important;
  border-left-color: var(--secondary) !important;
}
.prospect-ai-insight h4 { color: var(--secondary) !important; }
.prospect-ai-insight p  { color: var(--on-surface-muted) !important; }
/* Prospect info sections (modal détail) */
.prospect-info-item .info-value { color: var(--on-surface) !important; }
.prospect-info-item .info-label { color: var(--outline) !important; }
.prospect-reviews-box {
  background: var(--surface-mid) !important;
  color: var(--on-surface-muted) !important;
  border: 1px solid var(--outline-dim) !important;
}
/* Email preview */
.email-preview {
  background: var(--surface-mid) !important;
  border-color: var(--outline-dim) !important;
  color: var(--on-surface) !important;
}
.email-preview-subject {
  color: var(--on-surface) !important;
  border-bottom-color: var(--outline-dim) !important;
}
.email-preview-body {
  color: var(--on-surface-muted) !important;
}

/* ── UPLOAD AREA ────────────────────────────────────────────── */
.upload-area,
.ai-upload-area {
  background: var(--surface-mid) !important;
  border-color: var(--outline-dim) !important;
  color: var(--on-surface-muted) !important;
}
.upload-area:hover,
.ai-upload-area:hover {
  background: var(--surface-high) !important;
  border-color: var(--primary) !important;
}
.upload-area i, .ai-upload-area i { color: var(--outline) !important; }
.upload-area p, .ai-upload-area p { color: var(--on-surface-muted) !important; }
/* Neutralise le focus/active blanc natif */
.upload-area:focus, .upload-area:active,
.ai-upload-area:focus, .ai-upload-area:active {
  background: var(--surface-high) !important;
  outline: 2px solid var(--primary) !important;
  outline-offset: 2px !important;
}

/* ── ONGLETS / TAB BUTTONS ──────────────────────────────────── */
.client-folder-tab,
.siteweb-tab {
  background: var(--surface-mid) !important;
  border-color: var(--outline-dim) !important;
  color: var(--on-surface-muted) !important;
  font-family: var(--font-body) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  border-radius: var(--radius) !important;
}
.client-folder-tab.active,
.siteweb-tab.active {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #001f27 !important;
  font-weight: 700 !important;
}
.client-folder-tab:hover:not(.active),
.siteweb-tab:hover:not(.active) {
  background: var(--surface-high) !important;
  border-color: var(--outline) !important;
  color: var(--on-surface) !important;
}

/* ── BOUTONS LEGACY ─────────────────────────────────────────── */
.btn { border-radius: var(--radius) !important; font-family: var(--font-body) !important; }
.btn:hover { transform: none !important; }

.btn-primary {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #001f27 !important;
}
.btn-primary:hover { background: #33ddff !important; border-color: #33ddff !important; }

.btn-secondary {
  background: var(--surface-high) !important;
  border-color: var(--outline-dim) !important;
  color: var(--on-surface-muted) !important;
}
.btn-secondary:hover { border-color: var(--outline) !important; color: var(--on-surface) !important; }

.btn-danger {
  background: var(--error-new) !important;
  border-color: var(--error-new) !important;
  color: #001f27 !important;
}
.btn-warning {
  background: var(--secondary) !important;
  border-color: var(--secondary) !important;
  color: #001f27 !important;
}
.btn-info {
  background: var(--surface-mid) !important;
  border-color: var(--primary) !important;
  color: var(--primary) !important;
}
.btn-success {
  background: rgba(74, 222, 128, 0.12) !important;
  border-color: #4ade80 !important;
  color: #4ade80 !important;
}

/* ── SECTIONS & CONTENT LEGACY ──────────────────────────────── */
.section, .content {
  background: transparent !important;
  box-shadow: none !important;
  color: var(--on-surface) !important;
}

/* ── PAGES SANS APP-SHELL (non migrées) ─────────────────────── */
/* Topbar sticky + sidebar cachée */
body:not(:has(.app-shell)) .tn-topbar {
  position: sticky;
  top: 0;
  width: 100%;
  z-index: 200;
}
body:not(:has(.app-shell)) .tn-sidebar {
  display: none;
}

/* Content des pages non migrées : padding après topbar */
body:not(:has(.app-shell)) .content,
body:not(:has(.app-shell)) #page-content {
  padding-top: 20px;
}

/* ── STICKY HEADER GÉNÉRIQUE (sections legacy) ──────────────── */
.sticky-header-generic,
.clients-sticky-header,
.catalog-sticky-header,
.finances-sticky-header,
.planning-sticky-header {
  background: transparent !important;
  border-bottom: none !important;
  color: var(--on-surface) !important;
  padding: 0 !important;
  margin-bottom: 20px !important;
  border-radius: 0 !important;
}
.sticky-header-generic h2,
.clients-sticky-header h2,
.catalog-sticky-header h2 {
  font-family: var(--font-head) !important;
  font-size: 26px !important;
  font-weight: 700 !important;
  color: var(--on-surface) !important;
  margin: 0 0 4px 0 !important;
  letter-spacing: -0.01em !important;
}

/* ── SITEWEB — source badge, contact cards ───────────────────── */
.source-badge {
  background: var(--surface-mid) !important;
  color: var(--on-surface-muted) !important;
  border-color: var(--outline-dim) !important;
}
.source-badge.ai {
  background: rgba(139, 92, 246, 0.12) !important;
  color: #a78bfa !important;
  border-color: rgba(139, 92, 246, 0.35) !important;
}
.source-badge.n8n {
  background: rgba(255, 107, 53, 0.12) !important;
  color: var(--accent) !important;
  border-color: rgba(255, 107, 53, 0.35) !important;
}
.contact-card-site {
  background: var(--surface-mid) !important;
  border-color: var(--outline-dim) !important;
}
.contact-card-site:hover {
  border-color: var(--primary) !important;
}
.contact-card-site h4 {
  color: var(--on-surface) !important;
}
.contact-card-header small {
  color: var(--on-surface-muted) !important;
}
.contact-card-meta {
  color: var(--on-surface-muted) !important;
}
.contact-card-message {
  background: var(--surface-high) !important;
  color: var(--on-surface) !important;
}

/* ── RECHERCHE GLOBALE ───────────────────────────────────────── */
#global-search-input {
  background: none;
  border: none;
  outline: none;
  color: var(--on-surface);
  font-size: 13px;
  width: 100%;
  cursor: text;
}
#global-search-input::placeholder { color: var(--on-surface-muted); }

.gs-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 380px;
  background: var(--surface-mid);
  border: 1px solid var(--outline-dim);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 9999;
  overflow: hidden;
  max-height: 420px;
  overflow-y: auto;
}
.gs-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--outline-dim);
  transition: background 0.1s;
}
.gs-item:last-child { border-bottom: none; }
.gs-item:hover, .gs-item.gs-active { background: var(--surface-high); }
.gs-item-icon {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  background: rgba(0,212,255,0.08);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--primary);
  font-size: 11px;
}
.gs-item-body { flex: 1; min-width: 0; }
.gs-item-label { font-size: 13px; font-weight: 500; color: var(--on-surface); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-item-sub   { font-size: 11px; color: var(--on-surface-muted); margin-top: 1px; }
.gs-item-type  { font-size: 10px; color: var(--outline); text-transform: uppercase; letter-spacing: .05em; flex-shrink: 0; }
.gs-loading, .gs-empty { color: var(--on-surface-muted); font-size: 12px; justify-content: center; cursor: default; }
.gs-loading:hover, .gs-empty:hover { background: none; }

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 48px; }

  .tn-nav-item span,
  .tn-nav-label,
  .tn-sidebar-footer-text,
  .tn-nav-badge { display: none; }

  .tn-nav-item { justify-content: center; padding: 9px; gap: 0; }
  .tn-nav-item.active::before { width: 3px; height: 70%; }
  .tn-topbar-logo { width: var(--sidebar-w); padding-right: 8px; }
  .tn-logo-text, .tn-logo-sub { display: none; }
  .tn-btn-label { display: none; }
  .tn-btn { min-width: 32px; padding: 0; width: 32px; }
  .tn-user-email { display: none; }
  .tn-grid-2 { grid-template-columns: 1fr; }
  .tn-grid-3 { grid-template-columns: 1fr; }
  .tn-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .tn-main { padding: 14px; }
  .tn-kpi-grid { grid-template-columns: 1fr; }
  .tn-topbar-search { display: none; }
  body:has(.app-shell) { overflow: auto; height: auto; }
  html:has(.app-shell) { height: auto; }
  .app-shell { position: relative; height: auto; }
  .tn-main { overflow: visible; }
}
