/* ════════════════════════════════════════════════════════
   Sentinel — Design System v5 (UX Revamp 2026-04-21)
   ════════════════════════════════════════════════════════ */

/* ── Palette ────────────────────────────────────────────── */
:root {
  --bg: #fafbfc;
  --bg-card: #ffffff;
  --bg-hover: #f4f5f7;
  --bg-elevated: #ffffff;
  --bg-sidebar: #fbfbfc;
  --border: #e5e7eb;
  --border-subtle: #f0f1f3;
  --text: #111827;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: rgba(37,99,235,0.06);
  --green: #059669;
  --green-soft: rgba(5,150,105,0.06);
  --red: #dc2626;
  --red-soft: rgba(220,38,38,0.06);
  --orange: #d97706;
  --orange-soft: rgba(217,119,6,0.06);
  --purple: #7c3aed;
  --purple-soft: rgba(124,58,237,0.06);
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --transition: 0.15s cubic-bezier(0.4,0,0.2,1);

  /* Échelle typographique normalisée */
  --text-xs:   0.70rem;
  --text-sm:   0.78rem;
  --text-base: 0.85rem;
  --text-md:   0.92rem;
  --text-lg:   1.05rem;
  --text-xl:   1.25rem;
}

[data-theme="dark"] {
  --bg: #0f1117;
  --bg-card: #1a1d27;
  --bg-hover: #22262f;
  --bg-elevated: #1e2129;
  --bg-sidebar: #14161e;
  --border: #2a2e3a;
  --border-subtle: #1f222c;
  --text: #e5e7eb;
  --text-muted: #9ca3af;
  --text-faint: #6b7280;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-soft: rgba(59,130,246,0.1);
  --green: #34d399;
  --green-soft: rgba(52,211,153,0.1);
  --red: #f87171;
  --red-soft: rgba(248,113,113,0.1);
  --orange: #fbbf24;
  --orange-soft: rgba(251,191,36,0.1);
  --purple: #a78bfa;
  --purple-soft: rgba(167,139,250,0.1);
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.2);
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.2);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.4);
}

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

html, body {
  overflow-x: hidden;
  width: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.sidebar {
  width: 232px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 20px 0 12px;
  padding-top: max(20px, env(safe-area-inset-top));
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  position: fixed;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 300;
}

.sidebar-logo {
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 12px;
  text-decoration: none;
  display: block;
  cursor: pointer;
}
.sidebar-logo:hover h1 { color: var(--accent); }

.sidebar-logo h1 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-logo h1::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: var(--accent);
}
.sidebar-logo small {
  color: var(--text-faint);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-top: 2px;
  display: block;
  padding-left: 28px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  margin: 1px 8px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  background: none;
  width: calc(100% - 16px);
  text-align: left;
  font-size: 0.84rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
}

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

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

.main {
  flex: 1;
  margin-left: 232px;
  padding: 32px 48px;
  max-width: 1060px;
  margin-right: auto;
  overflow-x: hidden;
  min-width: 0;
  word-break: break-word;
}

/* ── Page headers ───────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 12px;
}

.page-header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text);
}

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  transition: box-shadow var(--transition), border-color var(--transition);
}
.stat-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--border);
}

.stat-card .label {
  color: var(--text-faint);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.stat-card .value {
  font-size: 1.75rem;
  font-weight: 700;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
  color: var(--text);
}
.stat-card .value.alert { color: var(--red); }
.stat-card .value.accent { color: var(--accent); }

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  transition: box-shadow var(--transition);
  overflow-x: auto;
  min-width: 0;
}
.card:hover {
  box-shadow: var(--shadow-xs);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.card-header h2 {
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: -0.2px;
}

/* ── Section titles ─────────────────────────────────────── */
.section-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-faint);
  margin-bottom: 12px;
}

/* ── Profile cards (dashboard) ─────────────────────────── */
.profile-dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.profile-dash-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.profile-dash-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
}

.profile-dash-card .profile-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.profile-dash-card .profile-meta {
  display: flex;
  gap: 16px;
  font-size: 0.76rem;
  color: var(--text-muted);
}
.profile-dash-card .profile-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Analysis items ─────────────────────────────────────── */
.analysis-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--transition);
}
.analysis-item:last-child { border-bottom: none; }
.analysis-item:hover {
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
}

.analysis-item .title {
  font-weight: 600;
  font-size: 0.86rem;
  margin-bottom: 4px;
  line-height: 1.4;
  color: var(--text);
}
.analysis-item .meta {
  color: var(--text-muted);
  font-size: 0.76rem;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.analysis-item .summary {
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.analysis-item-compact {
  padding: 10px 0;
}
.analysis-item-compact .title {
  font-size: 0.84rem;
  margin-bottom: 0;
}

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-alerte {
  background: var(--red-soft);
  color: var(--red);
}
.badge-rupture {
  background: var(--orange-soft);
  color: var(--orange);
}
.badge-inflexion {
  background: var(--purple-soft);
  color: var(--purple);
}
.badge-tendance {
  background: var(--accent-soft);
  color: var(--accent);
}
.badge-routine {
  background: var(--bg-hover);
  color: var(--text-faint);
}

.badge-category {
  display: inline-block;
  background: var(--bg-hover);
  color: var(--text-muted);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 500;
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--text-faint);
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 1px 2px rgba(37,99,235,0.2);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 6px rgba(37,99,235,0.25);
}
.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn-danger { color: var(--red); border-color: var(--red-soft); }
.btn-danger:hover { background: var(--red-soft); }
.btn-secondary { background: var(--bg-hover); border-color: var(--border); color: var(--text-muted); }

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
}
.action-btn:hover { background: var(--bg-hover); color: var(--text); }

/* ── Forms ──────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  margin-bottom: 5px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

input, textarea, select {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  font-family: var(--font);
  transition: border-color var(--transition), box-shadow var(--transition);
}

/* Checkboxes et radios : ne pas hériter des styles de texte/select */
input[type="checkbox"], input[type="radio"] {
  width: auto;
  padding: 0;
  background: initial;
  border: initial;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input::placeholder, textarea::placeholder {
  color: var(--text-faint);
}

textarea { resize: vertical; min-height: 80px; }

.tag-input {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 40px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 500;
}

.tag .remove { cursor: pointer; font-weight: bold; opacity: 0.6; }
.tag .remove:hover { opacity: 1; }

span.tag {
  display: inline-block;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ── Tables ─────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
table thead tr th {
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-faint);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
table tbody tr { transition: background 0.1s; }
table tbody tr:hover { background: var(--bg-hover); }
table td { padding: 10px 12px; font-size: 0.85rem; }

/* Signal chart */
.signal-chart { overflow: hidden; }
.signal-chart svg text { font-family: var(--font); }

/* ── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 720px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { transform: translateY(8px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal h2 {
  margin-bottom: 16px;
  font-size: 1.1rem;
  font-weight: 700;
}

/* ── Digest content ─────────────────────────────────────── */
.digest-content { line-height: 1.8; font-size: 0.9rem; }
.digest-content h1 { font-size: 1.15rem; margin: 24px 0 10px; color: var(--accent); font-weight: 700; }
.digest-content h2 { font-size: 1rem; margin: 20px 0 10px; color: var(--text); border-bottom: 1px solid var(--border-subtle); padding-bottom: 6px; }
.digest-content h3 { font-size: 0.92rem; margin: 16px 0 8px; color: var(--text); font-weight: 600; }
.digest-content ul { padding-left: 20px; margin: 8px 0; }
.digest-content li { margin: 4px 0; }
.digest-content p { margin: 8px 0; }
.digest-content table { width: 100%; border-collapse: collapse; font-size: 0.82rem; margin: 16px 0; }
.digest-content th { background: var(--bg-hover); font-weight: 600; text-align: left; padding: 8px 10px; border: 1px solid var(--border); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.3px; }
.digest-content td { padding: 6px 10px; border: 1px solid var(--border); }
.digest-content blockquote { border-left: 3px solid var(--accent); margin: 12px 0; padding: 8px 16px; color: var(--text-muted); background: var(--bg-hover); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.digest-content hr { border: none; border-top: 1px solid var(--border-subtle); margin: 20px 0; }

/* ── Toolbar ────────────────────────────────────────────── */
.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar select, .toolbar input { width: auto; min-width: 140px; }

/* ── Feedback stars ─────────────────────────────────────── */
.stars { display: flex; gap: 4px; }
.star { cursor: pointer; font-size: 1.2rem; color: var(--border); transition: color var(--transition); }
.star.active, .star:hover { color: var(--orange); }

/* ── Mobile header ──────────────────────────────────────── */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: calc(52px + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  align-items: center;
  gap: 12px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  z-index: 200;
}

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

.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 44px;
  height: 44px;
  padding: 14px 12px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.hamburger:hover { background: var(--bg-hover); }

.hamburger span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.25s;
  transform-origin: center;
}
.hamburger.active span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 299;
}
.sidebar-overlay.active { display: block; }

/* ── Responsive — Tablette (≤1024px) ───────────────────── */
@media (max-width: 1024px) {
  .mobile-header { display: flex; }
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    background: var(--bg-card);
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding: 24px; padding-top: calc(52px + env(safe-area-inset-top) + 16px); max-width: 100%; width: 100%; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .profiles-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .digest-layout { grid-template-columns: 1fr !important; }
  .digest-sidebar { position: static !important; }
  .prof-grid-2 { grid-template-columns: 1fr !important; }
  .prof-grid-3 { grid-template-columns: 1fr 1fr !important; }
  .dash-grid-2 { grid-template-columns: 1fr !important; }
  .page-header { flex-wrap: wrap; }
  .card { padding: 16px; }
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ── Responsive — Mobile (≤768px) ──────────────────────── */
@media (max-width: 768px) {
  .main { padding: 12px; padding-top: calc(52px + env(safe-area-inset-top) + 12px); padding-bottom: max(16px, env(safe-area-inset-bottom)); max-width: 100vw; }
  .card { padding: 12px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .nav-item { min-height: 44px; font-size: 0.9rem; padding: 10px 16px; }
  .modal { width: 100%; max-width: 100%; border-radius: var(--radius-lg) var(--radius-lg) 0 0; position: fixed; bottom: 0; left: 0; max-height: 85vh; }
  #toast-container { bottom: max(16px, env(safe-area-inset-bottom)); right: 16px; left: 16px; }
  .toast { min-width: 0; max-width: 100%; font-size: 0.88rem; }
  .toolbar { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .toolbar select, .toolbar input { min-width: 120px; }
  input, textarea, select { font-size: 16px; }
  .stat-card .value { font-size: 1.4rem; }
  .stat-card { padding: 12px; }
  .profiles-grid { grid-template-columns: 1fr; }
  .analysis-item { padding: 12px 0; }
  .analysis-item .title { font-size: 0.9rem; }
  .prof-grid-3 { grid-template-columns: 1fr !important; }
  .btn { min-height: 44px; font-size: 0.85rem; }
  .action-btn { min-height: 44px; }
  .settings-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .settings-row input[type="email"],
  .settings-row select { width: 100% !important; }
  .page-header h1 { font-size: 1.2rem; }
}

/* ── Responsive — Petit mobile (≤480px) ────────────────── */
@media (max-width: 480px) {
  .main { padding: 12px; padding-top: calc(52px + env(safe-area-inset-top) + 8px); }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .stat-card .label { font-size: 0.7rem; }
  .stat-card .value { font-size: 1.2rem; }
  h1 { font-size: 1.1rem; }
}

/* ── Spinner ────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty { text-align: center; padding: 40px; color: var(--text-muted); }

/* ── Profile cards grid ─────────────────────────────────── */
.profiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.profile-card {
  padding: 16px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.profile-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

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

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  min-width: 240px;
  max-width: 400px;
  font-size: 0.85rem;
  animation: toastIn 0.25s ease;
  pointer-events: all;
  box-shadow: var(--shadow-lg);
}

.toast-success { border-left: 3px solid var(--green); }
.toast-error { border-left: 3px solid var(--red); }
.toast-info { border-left: 3px solid var(--accent); }
.toast-warn { border-left: 3px solid var(--orange); }

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

/* ── Pagination ─────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}
.pagination .pages { display: flex; gap: 4px; }
.pagination .pages button { min-width: 32px; text-align: center; }

/* ── Nav separator ──────────────────────────────────────── */
.nav-separator {
  margin: 8px 16px;
  border-top: 1px solid var(--border-subtle);
}

/* ── Help sections ──────────────────────────────────────── */
.help-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 12px;
}
.help-section h2 {
  font-size: 0.88rem;
  color: var(--text);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 600;
}

kbd {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

/* ── Sidebar user ───────────────────────────────────────── */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  border: 1px solid transparent;
}
.sidebar-user:hover { background: var(--bg-hover); }

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

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 0.82rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 0.68rem; color: var(--text-faint); text-transform: capitalize; }
.sidebar-user-gear { color: var(--text-faint); font-size: 0.82rem; flex-shrink: 0; }

/* ── Settings ───────────────────────────────────────────── */
.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 12px;
}
.settings-section h2 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-faint);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 600;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-label { font-size: 0.88rem; color: var(--text); }
.settings-row-desc { font-size: 0.75rem; color: var(--text-faint); margin-top: 2px; }
.settings-toggle { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.settings-toggle input { opacity: 0; width: 0; height: 0; }
.settings-toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: var(--border);
  cursor: pointer;
  transition: background 0.2s;
}
.settings-toggle input:checked + .settings-toggle-track { background: var(--accent); }
.settings-toggle-track::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.settings-toggle input:checked + .settings-toggle-track::after { transform: translateX(20px); }

/* ── Tooltips ───────────────────────────────────────────── */
.global-tip {
  position: fixed;
  z-index: 99999;
  background: var(--text);
  color: var(--bg);
  font-size: 0.72rem;
  line-height: 1.5;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  max-width: 260px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  box-shadow: var(--shadow-md);
  white-space: normal;
}
.global-tip.visible { opacity: 1; }

[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.5;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  white-space: normal;
  width: max-content;
  max-width: 240px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 9999;
  box-shadow: var(--shadow-md);
  text-align: left;
}
[data-tip]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--text);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 9999;
}
[data-tip]:hover::after, [data-tip]:hover::before { opacity: 1; }
[data-tip-left]::after { left: auto; right: 0; transform: none; }
[data-tip-left]::before { left: auto; right: 12px; transform: none; }

/* ── Accessibility ──────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
  z-index: 10000;
  font-size: 0.9rem;
  text-decoration: none;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus {
  top: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:focus-visible, a:focus-visible, .nav-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── Empty states ───────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.4; }
.empty-state-text { font-size: 0.88rem; margin-bottom: 16px; line-height: 1.6; }
.empty-state p { font-size: 1.05rem; margin-bottom: 0.5rem; }
.empty-state small { font-size: 0.82rem; opacity: 0.7; }

/* ── Pulse animation for generating ────────────────────── */
@keyframes pulse-glow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.pulse-generating { animation: pulse-glow 1.5s ease-in-out infinite; }

/* ── Status dot ────────────────────────────────────────── */
.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 5px;
  flex-shrink: 0;
}
.status-dot.active { background: var(--green); box-shadow: 0 0 4px var(--green); }
.status-dot.inactive { background: var(--red); }

/* ── Count badges ──────────────────────────────────────── */
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  font-size: 0.68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.count-badge.alert { background: var(--red-soft); color: var(--red); }
.count-badge.info { background: var(--accent-soft); color: var(--accent); }
.count-badge.muted { background: var(--bg-hover); color: var(--text-faint); }

/* ── Loading placeholder (vues principales) ─────────────── */
.loading-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
  gap: 1rem;
}
.loading-placeholder .spinner {
  width: 36px;
  height: 36px;
  border-width: 3px;
}

/* ── Icônes SVG Lucide inline ───────────────────────────── */
.btn svg, button svg, .nav-item svg { vertical-align: middle; flex-shrink: 0; }
.sidebar-user-gear svg { width: 14px; height: 14px; opacity: 0.6; }

/* ── Onboarding wizard ──────────────────────────────────── */
.onboarding-wizard-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1100; padding: 16px;
}
.onboarding-wizard {
  background: var(--bg-card); border-radius: 16px;
  padding: 36px 32px; max-width: 520px; width: 100%;
  box-shadow: 0 24px 80px rgba(0,0,0,0.18);
}
.onboarding-wizard h2 { font-size: 1.25rem; margin: 0 0 12px; }
.onboarding-wizard .wizard-steps {
  display: flex; gap: 6px; margin-bottom: 28px;
}
.onboarding-wizard .wizard-step-dot {
  flex: 1; height: 4px; border-radius: 2px;
  background: var(--border); transition: background 0.25s;
}
.onboarding-wizard .wizard-step-dot.active { background: var(--accent); }
.onboarding-wizard textarea {
  width: 100%; min-height: 110px; resize: vertical;
  padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 0.93rem;
  background: var(--bg-input, var(--bg)); color: var(--text);
  box-sizing: border-box;
}
.onboarding-wizard .wizard-actions {
  display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end;
}
.onboarding-empty-cta {
  display: flex; flex-direction: column; align-items: center;
  gap: 16px; padding: 48px 24px; text-align: center;
}
.onboarding-empty-cta .cta-title {
  font-size: 1.1rem; font-weight: 700; color: var(--text);
}
.onboarding-empty-cta .cta-desc {
  font-size: 0.93rem; color: var(--text-muted); max-width: 360px;
}

/* ── Suppression rapide depuis la liste des profils ───── */
.profile-list-card:hover .profile-quick-delete,
.profile-list-card:focus-within .profile-quick-delete {
  opacity: 1 !important;
}
.profile-quick-delete:hover {
  color: var(--red, #dc2626) !important;
}

/* ── Footer légal ──────────────────────────────────────── */
.app-footer {
  position: fixed; bottom: 0.5rem; right: 1rem;
  font-size: 0.75rem; color: var(--text-faint); opacity: 0.7;
  z-index: 100;
}
.app-footer a { color: inherit; text-decoration: none; margin: 0 0.25rem; }
.app-footer a:hover { text-decoration: underline; color: var(--text-muted); }
@media (max-width: 768px) { .app-footer { display: none; } }

/* ═══════════════════════════════════════════════════════
   UX Revamp v5 — Nouveaux composants
   ═══════════════════════════════════════════════════════ */

/* ── Skeleton screens ───────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg-hover) 25%, var(--border-subtle) 50%, var(--bg-hover) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
  display: block;
}
.skeleton-line   { height: 14px; margin-bottom: 8px; }
.skeleton-title  { height: 18px; width: 60%; margin-bottom: 10px; }
.skeleton-meta   { height: 12px; width: 40%; margin-bottom: 6px; }
.skeleton-card   { height: 72px; margin-bottom: 10px; border-radius: var(--radius); }
.skeleton-stat   { height: 70px; border-radius: var(--radius); }
.skeleton-profile{ height: 64px; margin-bottom: 8px; border-radius: var(--radius); }

/* ── Unread indicator ───────────────────────────────────── */
.unread-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-right: 2px;
}
.analysis-item.is-unread .title { font-weight: 700; }

/* ── Mark read button ───────────────────────────────────── */
.mark-read-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-faint);
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  opacity: 0;
  transition: opacity var(--transition), color var(--transition);
  flex-shrink: 0;
}
.analysis-item:hover .mark-read-btn { opacity: 1; }
.mark-read-btn:hover { color: var(--accent); }

/* ── Nav section labels ─────────────────────────────────── */
.nav-section-label {
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-faint);
  padding: 14px 24px 4px;
  pointer-events: none;
  user-select: none;
}

/* ── Theme toggle in sidebar ────────────────────────────── */
.sidebar-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
  margin: 0 8px 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--text-xs);
  color: var(--text-faint);
  background: none;
  border: none;
  width: calc(100% - 16px);
  text-align: left;
  transition: background var(--transition);
}
.sidebar-theme-toggle:hover { background: var(--bg-hover); color: var(--text-muted); }
.sidebar-theme-toggle-icon { font-size: 14px; }

/* ── Sidebar status bar ─────────────────────────────────── */
.sidebar-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 20px;
  font-size: 0.68rem;
  color: var(--text-faint);
  margin-bottom: 4px;
}
.sidebar-status-alert {
  background: var(--red-soft);
  color: var(--red);
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 0.68rem;
}

/* ── Refresh banner ─────────────────────────────────────── */
#refresh-banner {
  display: none;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--accent);
  color: #fff;
  font-size: var(--text-sm);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  cursor: pointer;
  text-align: center;
  animation: toastIn 0.3s ease;
}
#refresh-banner:hover { background: var(--accent-hover); }

/* ── Split-view panel (analyses) ────────────────────────── */
.analyses-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  transition: grid-template-columns 0.25s ease;
}
.analyses-split.has-panel {
  grid-template-columns: minmax(320px, 44%) 1fr;
  gap: 16px;
}
.analyses-list-col {
  min-width: 0;
  overflow-y: auto;
  max-height: calc(100vh - 180px);
}
.analyses-detail-col {
  display: none;
  position: sticky;
  top: 0;
  max-height: calc(100vh - 180px);
  overflow-y: auto;
}
.analyses-split.has-panel .analyses-detail-col { display: block; }

.analysis-item.is-selected {
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
}

/* ── PDF download loading state ─────────────────────────── */
.btn-pdf-loading {
  pointer-events: none;
  opacity: 0.7;
}
.btn-pdf-loading::before {
  content: '';
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 6px;
  vertical-align: middle;
}

/* ── Digest in-progress badge ───────────────────────────── */
.badge-generating {
  background: var(--accent-soft);
  color: var(--accent);
  animation: pulse-glow 1.5s ease-in-out infinite;
}

/* ── Profile frequency badge ────────────────────────────── */
.freq-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.67rem;
  font-weight: 500;
  color: var(--text-faint);
  background: var(--bg-hover);
  border-radius: 4px;
  padding: 1px 6px;
}

/* ── Source health detail ───────────────────────────────── */
.source-health {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
}
.source-health-ok   { color: var(--green); }
.source-health-warn { color: var(--orange); }
.source-health-err  { color: var(--red); }

/* ── Settings tabs ──────────────────────────────────────── */
.settings-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.settings-tab {
  padding: 8px 16px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition), border-color var(--transition);
}
.settings-tab:hover { color: var(--text); }
.settings-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.settings-panel { display: none; }
.settings-panel.active { display: block; }

/* ── Bulk action bar ────────────────────────────────────── */
.bulk-bar {
  display: none;
  position: sticky;
  bottom: 16px;
  z-index: 40;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-top: 12px;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.2s ease;
}
.bulk-bar.visible { display: flex; }
.bulk-bar-count { font-size: var(--text-sm); font-weight: 600; flex: 1; }
.bulk-bar .btn { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.2); color: #fff; }
.bulk-bar .btn:hover { background: rgba(255,255,255,0.25); }

/* ── One-shot quota bar ─────────────────────────────────── */
.quota-bar-wrap {
  background: var(--bg-hover);
  border-radius: 4px;
  height: 5px;
  overflow: hidden;
  margin-top: 4px;
}
.quota-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.4s ease;
}
.quota-bar-fill.warn { background: var(--orange); }
.quota-bar-fill.crit { background: var(--red); }

/* ── One-shot history ───────────────────────────────────── */
.oneshot-history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--text-muted);
  transition: background var(--transition);
}
.oneshot-history-item:hover { background: var(--bg-hover); color: var(--text); }

/* ── Profile duplicate / color dot ─────────────────────── */
.profile-color-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Table wrapper scroll ───────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── Contextual empty states ────────────────────────────── */
.empty-state-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }

/* ── Scroll-load button ─────────────────────────────────── */
.load-more-btn {
  width: 100%;
  padding: 10px;
  background: var(--bg-hover);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  margin-top: 8px;
}
.load-more-btn:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

/* ── Sort header ─────────────────────────────────────────── */
.sort-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0;
}
.sort-btn.active { color: var(--accent); }
.sort-btn .sort-arrow { font-size: 10px; }

/* ── Chips (filtres Flux) ───────────────────────────────── */
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 500;
  background: var(--bg-hover);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.chip:hover { background: var(--accent-soft); color: var(--accent); }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip .chip-count {
  font-size: 0.68rem;
  opacity: 0.7;
  font-weight: 400;
}
.chip.active .chip-count { opacity: 0.9; }

/* ── Flux : liste d'articles bruts ──────────────────────── */
.flux-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: start;
}
.flux-row:last-child { border-bottom: none; }
.flux-row .flux-title {
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.flux-row .flux-title:hover { color: var(--accent); }
.flux-row .flux-meta {
  font-size: 0.76rem;
  color: var(--text-faint);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.flux-row .flux-excerpt {
  font-size: 0.83rem;
  color: var(--text-muted);
  grid-column: 1 / -1;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.flux-row .flux-date {
  font-size: 0.76rem;
  color: var(--text-faint);
  white-space: nowrap;
}

/* ── Flux : mode compact (1 ligne) ──────────────────────── */
.flux-row-compact {
  display: grid;
  grid-template-columns: 70px 1fr 180px 80px;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
  align-items: baseline;
  font-size: 0.86rem;
}
.flux-row-compact:last-child { border-bottom: none; }
.flux-row-compact .flux-type-pill {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-hover);
  padding: 2px 6px;
  border-radius: 3px;
  text-align: center;
}
.flux-row-compact .flux-title-compact {
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.flux-row-compact .flux-title-compact:hover { color: var(--accent); }
.flux-row-compact .flux-source-compact {
  color: var(--text-muted);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.flux-row-compact .flux-date {
  color: var(--text-faint);
  font-size: 0.76rem;
  text-align: right;
}
@media (max-width: 768px) {
  .flux-row-compact { grid-template-columns: 60px 1fr 70px; }
  .flux-row-compact .flux-source-compact { display: none; }
}

/* ── Flux : toggle densité ─────────────────────────────── */
.flux-density-btn {
  background: transparent;
  border: none;
  padding: 5px 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.flux-density-btn:hover { background: var(--bg-hover); color: var(--text); }
.flux-density-btn.active { background: var(--accent); color: #fff; }

/* ── Flux : lien source cliquable ─────────────────────── */
.flux-source-link { cursor: pointer; text-decoration: none; border-bottom: 1px dotted var(--text-faint); transition: color var(--transition), border-color var(--transition); }
.flux-source-link:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Toggle densité Analyses ─────────────────────────── */
.analyses-density-btn {
  background: transparent;
  border: none;
  padding: 5px 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.analyses-density-btn:hover { background: var(--bg-hover); color: var(--text); }
.analyses-density-btn.active { background: var(--accent); color: #fff; }

/* ── Lignes preview Analyses (style Flux compact) ────── */
.analysis-preview-row { transition: background var(--transition); }
.analysis-preview-row:hover { background: var(--bg-hover); }

/* ── Tableau de données générique ────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
.data-table thead th {
  text-align: left;
  padding: 8px 12px;
  background: var(--bg-soft);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
}
.data-table tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody tr.is-unread td { font-weight: 500; }
.data-table tbody tr.is-unread td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.data-table .table-link {
  color: var(--text);
  text-decoration: none;
}
.data-table .table-link:hover { color: var(--accent); }

/* ── Analyses : mode Aperçu (1 ligne, signal large) ────── */
.analysis-preview-row {
  display: grid;
  grid-template-columns: 110px 1fr 200px 90px;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-subtle);
  align-items: center;
  font-size: 0.86rem;
  cursor: pointer;
  transition: background var(--transition);
}
.analysis-preview-row:last-child { border-bottom: none; }
.analysis-preview-row:hover { background: var(--bg-hover); }
.analysis-preview-row .apr-signal { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.analysis-preview-row .apr-title {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.analysis-preview-row .apr-source {
  color: var(--text-muted);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.analysis-preview-row .apr-date {
  color: var(--text-faint);
  font-size: 0.76rem;
  text-align: right;
  white-space: nowrap;
}
@media (max-width: 768px) {
  .analysis-preview-row { grid-template-columns: 100px 1fr 75px; }
  .analysis-preview-row .apr-source { display: none; }
}

/* ── Analyses : mode Détaillé enrichi (5 lignes par actu) ── */
.analysis-row-detailed {
  padding: 12px 4px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--transition);
}
.analysis-row-detailed:last-child { border-bottom: none; }
.analysis-row-detailed:hover { background: var(--bg-hover); }
.analysis-row-detailed .ardr-line1 {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.analysis-row-detailed .ardr-line2 {
  font-size: 0.98rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.analysis-row-detailed.is-unread .ardr-line2 { font-weight: 700; }
.analysis-row-detailed .ardr-line3 {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 4px;
}
.analysis-row-detailed .ardr-actors {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 4px;
}
.analysis-row-detailed .actor-pill {
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--bg-hover);
  color: var(--text-muted);
  white-space: nowrap;
}
.analysis-row-detailed .ardr-summary {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Toggle densité Synthèses ────────────────────────── */
.digests-density-btn {
  background: transparent;
  border: none;
  padding: 5px 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.digests-density-btn:hover { background: var(--bg-hover); color: var(--text); }
.digests-density-btn.active { background: var(--accent); color: #fff; }

/* ── Dashboard : tuiles configurables ──────────────────── */
.dash-tile { transition: opacity var(--transition); }
.dash-tile-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border-subtle);
}
.dash-tile-row:last-child { border-bottom: none; }
.dash-tile-row .btn[disabled] { opacity: 0.3; cursor: not-allowed; }

/* ── Dashboard : wrapper de tuile (header + collapse + drag) ── */
.dash-tile {
  margin-bottom: 28px;
  border-radius: var(--radius);
  transition: box-shadow var(--transition), opacity var(--transition);
}
.dash-tile.dragging { opacity: 0.4; }
.dash-tile.drag-over { box-shadow: 0 0 0 2px var(--accent); }
.dash-tile-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px 10px;
  cursor: pointer;
  user-select: none;
}
.dash-tile-header:hover .dash-drag-handle { opacity: 1; }
.dash-tile-title {
  flex: 1;
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-faint);
}
.dash-drag-handle {
  display: inline-block;
  font-size: 0.95rem;
  color: var(--text-faint);
  cursor: grab;
  padding: 0 4px;
  opacity: 0.3;
  transition: opacity var(--transition);
  letter-spacing: -2px;
  font-weight: 700;
}
.dash-drag-handle:active { cursor: grabbing; }
.dash-tile-collapse-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-faint);
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  transition: background var(--transition), color var(--transition);
}
.dash-tile-collapse-btn:hover { background: var(--bg-hover); color: var(--text); }
.dash-tile[data-collapsed="1"] { margin-bottom: 14px; }
.dash-tile[data-collapsed="1"] .dash-tile-header { padding-bottom: 6px; }

/* ── Drag-drop dans la modal de personnalisation ──────── */
.dash-tile-row.dragging { opacity: 0.4; }
.dash-tile-row.drag-over { background: var(--accent-soft); border-radius: var(--radius-sm); }
.dash-tile-row[draggable="true"] { cursor: move; }

/* ── Vue compacte du dashboard ───────────────────────────── */
body.compact-view .dash-tile {
  margin-bottom: 14px;
}
body.compact-view .dash-tile-header {
  padding: 4px 4px 6px;
}
body.compact-view .dash-tile-body .card {
  padding: 6px 12px;
}
body.compact-view .stats-grid {
  gap: 6px;
  margin-bottom: 14px;
}
body.compact-view .stat-card {
  padding: 8px 12px;
}
body.compact-view .stat-card .value {
  font-size: 1.25rem;
  margin-top: 1px;
}
body.compact-view .stat-card .label {
  font-size: 0.63rem;
}
body.compact-view .profile-list-card {
  padding: 7px 12px !important;
}
body.compact-view .dash-tile-body [style*='padding:7px'] {
  padding: 4px 0 !important;
}
body.compact-view .dash-tile-body [style*='font-size:0.84rem'],
body.compact-view .dash-tile-body [style*='font-size:0.85rem'] {
  font-size: 0.78rem !important;
}
