/* ============================================================
   app.css — feuille unique (tokens + reset + base + composants)
   Style hedge fund : bleu institutionnel, aere, minimal.
   ============================================================ */

/* ── Tokens ──────────────────────────────────────────────── */
:root {
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;

  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --accent-blue: #3b82f6;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-amber: #f59e0b;
  --hover-bg: #f1f5f9;
  --shadow: rgba(0, 0, 0, 0.04);
  --radius: 12px;

  --accent-blue-2: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.14);
  --border-hover: rgba(59, 130, 246, 0.35);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 1px 3px rgba(15, 23, 42, 0.05), 0 8px 20px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 12px 34px rgba(15, 23, 42, 0.12);
  --nav-bg: rgba(255, 255, 255, 0.72);
  --skel-1: #eef2f7;
  --skel-2: #e2e8f0;
}

[data-theme="dark"] {
  --bg-primary: #09090b;
  --bg-secondary: #18181b;
  --bg-card: #18181b;
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --border-color: #27272a;
  --accent-blue: #60a5fa;
  --hover-bg: #27272a;
  --shadow: rgba(0, 0, 0, 0.5);

  --accent-blue-2: #3b82f6;
  --accent-glow: rgba(96, 165, 250, 0.12);
  --border-hover: rgba(96, 165, 250, 0.4);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.4), 0 10px 26px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 16px 44px rgba(0, 0, 0, 0.5);
  --nav-bg: rgba(20, 20, 23, 0.7);
  --skel-1: #1f1f23;
  --skel-2: #27272a;
}

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

body {
  font-family: var(--font-ui);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
/* Profondeur : halo bleu tres discret en haut de page */
body::before {
  content: ''; position: fixed; inset: 0 0 auto 0; height: 480px; z-index: -1;
  pointer-events: none;
  background: radial-gradient(1100px 460px at 50% -160px, var(--accent-glow), transparent 70%);
}

/* Carte generique */
.card {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: 16px; padding: 24px; box-shadow: var(--shadow-md);
}
.card.flush { padding: 0; overflow: hidden; }

/* Skeleton de chargement (KPI solde) */
.skel {
  display: inline-block; width: 2.6em; height: 0.78em; border-radius: 6px;
  background: linear-gradient(90deg, var(--skel-1) 25%, var(--skel-2) 37%, var(--skel-1) 63%);
  background-size: 400% 100%; animation: skel 1.3s ease infinite; vertical-align: middle;
}
@keyframes skel { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* Skeletons de blocs (chargement progressif : graphes, tables, cartes) */
.sk { position: relative; overflow: hidden; background: var(--skel-1); border-radius: 8px; }
.sk::after {
  content: ''; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, var(--skel-2), transparent);
  animation: sk-sweep 1.3s ease infinite;
}
@keyframes sk-sweep { 100% { transform: translateX(100%); } }
.sk-num { display: inline-block; width: 2.6em; height: 0.78em; border-radius: 6px; vertical-align: middle; }
.sk-line { height: 12px; border-radius: 6px; }
.sk-chart { width: 100%; height: 100%; min-height: 320px; border-radius: 12px; }
.sk-rows { display: flex; flex-direction: column; gap: 16px; padding: 18px 4px; }
.sk-card { height: 156px; border-radius: 14px; }

/* Chiffres financiers : mono + tabulaires */
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Icones : sprite SVG, stroke currentColor (style Lucide/Feather) */
.icon {
  width: 1em; height: 1em;
  display: inline-block; vertical-align: -0.125em;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

.container { max-width: 1400px; margin: 0 auto; padding: 40px; }

/* Couleurs P&L (jamais ailleurs que sur les valeurs) */
.positive { color: var(--accent-green); }
.negative { color: var(--accent-red); }
.neutral  { color: var(--text-secondary); }

/* ============================================================
   Nav (partagee — logged-in)
   ============================================================ */
nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 32px;
  position: sticky; top: 0; z-index: 100;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--nav-bg);
  backdrop-filter: saturate(1.6) blur(12px);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
}

.nav-left { display: flex; align-items: center; gap: 28px; }
.nav-left a {
  color: var(--text-secondary); text-decoration: none;
  font-weight: 500; font-size: 14px; position: relative;
  transition: color 0.15s ease;
}
.nav-left a:hover, .nav-left a.active { color: var(--text-primary); }
.nav-left a.active::after {
  content: ''; position: absolute; bottom: -16px; left: 0; right: 0;
  height: 2px; background: var(--accent-blue); border-radius: 1px;
}

.nav-right { display: flex; align-items: center; gap: 16px; }

.symbol-display {
  font-size: 10px; font-weight: 500; color: var(--text-muted);
  letter-spacing: 0.5px; opacity: 0.5; text-transform: uppercase;
}

.bot-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
}
.bot-status .status-dot {
  width: 8px; height: 8px; background-color: var(--accent-green);
  border-radius: 50%; animation: pulse 2s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.account-selector select,
.mobile-account-selector select {
  background-color: transparent; color: var(--text-primary);
  border: none; font-size: 13px; font-weight: 500; cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0 center;
}
.account-selector select { padding: 8px 24px 8px 0; }
.account-selector select:focus, .mobile-account-selector select:focus { outline: none; }

.theme-toggle, .logout-btn {
  background: none; border: none; color: var(--text-secondary);
  font-size: 18px; cursor: pointer; padding: 8px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; transition: all 0.15s ease;
}
.theme-toggle:hover { color: var(--text-primary); background-color: var(--hover-bg); }
.logout-btn:hover { color: var(--accent-red); background-color: var(--hover-bg); }

/* Toggle theme : lune en clair (→ sombre), soleil en sombre (→ clair) */
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: inline-block; }

.burger-menu {
  display: none; flex-direction: column; justify-content: center; align-items: center;
  gap: 4px; background: none; border: none; cursor: pointer; padding: 8px; border-radius: 6px;
}
.burger-menu span {
  display: block; width: 18px; height: 2px; background-color: var(--text-primary);
  border-radius: 1px; transition: all 0.2s ease;
}
.burger-menu.active span:nth-child(1) { transform: rotate(45deg) translate(4px, 4px); }
.burger-menu.active span:nth-child(2) { opacity: 0; }
.burger-menu.active span:nth-child(3) { transform: rotate(-45deg) translate(4px, -4px); }

.mobile-menu {
  display: none; position: fixed; top: 57px; left: 0; right: 0; z-index: 99;
  flex-direction: column; gap: 8px; padding: 16px 24px;
  background-color: var(--bg-secondary); border-bottom: 1px solid var(--border-color);
}
.mobile-menu.active { display: flex; }
.mobile-menu a {
  color: var(--text-secondary); text-decoration: none; font-weight: 500;
  font-size: 15px; padding: 12px 0; border-bottom: 1px solid var(--border-color);
}
.mobile-menu a:last-child { border-bottom: none; }
.mobile-menu a:hover, .mobile-menu a.active { color: var(--text-primary); }
.mobile-menu .logout-link { color: var(--accent-red); margin-top: 8px; display: flex; align-items: center; gap: 8px; }
.mobile-account-selector { padding: 12px 0; border-bottom: 1px solid var(--border-color); }
.mobile-account-selector select { padding: 0; font-size: 15px; width: 100%; }

/* Barre d'onglets basse (mobile uniquement) */
#bottom-tab-bar {
  position: fixed; bottom: 0; left: 0; right: 0; height: 80px; z-index: 9999;
  display: flex; justify-content: space-around; align-items: center;
  background: var(--bg-card); border-top: 1px solid var(--border-color);
  padding-bottom: env(safe-area-inset-bottom, 0px); box-sizing: content-box;
}
#bottom-tab-bar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; flex: 1; height: 100%; text-decoration: none;
  color: var(--text-muted); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.3px;
  -webkit-tap-highlight-color: transparent;
}
#bottom-tab-bar a .icon { width: 20px; height: 20px; }
#bottom-tab-bar a.active { color: var(--accent-blue); }
@media (min-width: 768px) { #bottom-tab-bar { display: none; } }

/* ============================================================
   KPIs / stat tiles
   ============================================================ */
.kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px; margin: 8px 0 28px;
}
.kpi {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: 14px; padding: 20px 22px; box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.kpi:hover {
  transform: translateY(-2px); box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}
.stat-label {
  font-size: 11px; color: var(--text-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.8px;
}
.stat-value {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 30px; font-weight: 600; color: var(--text-primary);
  line-height: 1.1; letter-spacing: -0.03em;
}
.stat-value.small { font-size: 18px; color: var(--text-muted); }
.stat-unit { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; }

/* Grille KPI (marche) */
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px; margin: 8px 0 28px;
}
.kpi-grid .stat-value { font-size: 23px; }

/* ============================================================
   Cartes / graphes
   ============================================================ */
.section-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; flex-wrap: wrap; margin-bottom: 16px;
}
.section-title {
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px;
}
.section-title .badge {
  font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 20px;
  background: var(--accent-blue); color: #fff;
}
.section-title .badge.amber { background: var(--accent-amber); }
.section-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.chart-box {
  position: relative; height: 400px; width: 100%;
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: 16px; padding: 20px 20px 8px; box-shadow: var(--shadow-md);
}
.chart-box canvas { width: 100% !important; }

/* ============================================================
   Tables
   ============================================================ */
table { width: 100%; border-collapse: collapse; }
thead th {
  font-size: 11px; font-weight: 500; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.6px; text-align: left;
  padding: 12px 16px 16px; border-bottom: 1px solid var(--border-color); white-space: nowrap;
}
tbody td {
  padding: 18px 16px; border-bottom: 1px solid var(--border-color);
  vertical-align: middle; color: var(--text-primary); font-size: 15px;
}
tbody tr { transition: background 0.15s ease; }
tbody tr:hover { background-color: var(--hover-bg); }
tbody tr:last-child td { border-bottom: none; }

td.num, .change-cell { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.change-cell { font-weight: 600; font-size: 15px; }
.change-cell.positive { color: var(--accent-green); }
.change-cell.negative { color: var(--accent-red); }

/* Cellule dates achat/vente */
.combined-dates { display: flex; flex-direction: row; gap: 24px; }
.trade-block { padding: 4px 0; }
.trade-title {
  font-weight: 600; font-size: 10px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px;
}
.trade-date { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.trade-time {
  font-size: 12px; color: var(--text-secondary); margin-top: 4px;
  display: flex; align-items: center; gap: 5px;
}
.trade-time .icon { width: 12px; height: 12px; opacity: 0.7; }

/* ============================================================
   Boutons / inputs
   ============================================================ */
.btn {
  padding: 8px 18px; font-size: 13px; font-weight: 600; cursor: pointer;
  border-radius: 8px; border: 1px solid transparent; transition: all 0.15s ease;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary {
  background: linear-gradient(180deg, var(--accent-blue), var(--accent-blue-2));
  color: #fff;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.3), 0 4px 12px rgba(37, 99, 235, 0.22);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.35), 0 8px 20px rgba(37, 99, 235, 0.28);
}
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: transparent; color: var(--text-secondary); border-color: var(--border-color);
}
.btn-secondary:hover { background: var(--hover-bg); color: var(--text-primary); }

.date-filter { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.date-filter label {
  color: var(--text-muted); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.8px;
}
input[type="date"] {
  padding: 8px 14px; font-size: 13px; font-weight: 500; font-family: var(--font-mono);
  border: 1px solid var(--border-color); border-radius: 8px;
  background-color: var(--bg-primary); color: var(--text-primary);
  color-scheme: light dark;
}
input[type="date"]:focus {
  outline: none; border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

/* ============================================================
   Etats : loading / empty / error / spinner
   ============================================================ */
.state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 72px 20px; color: var(--text-muted); text-align: center;
}
.state .icon { width: 28px; height: 28px; }
.state p { font-size: 13px; }
.state.error .icon { color: var(--accent-red); }
.spinner .icon { width: 30px; height: 30px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Form 4
   ============================================================ */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 0 0; margin-bottom: 28px; flex-wrap: wrap; gap: 12px;
}
.page-title {
  font-size: 24px; font-weight: 700; letter-spacing: -0.03em; color: var(--text-primary);
  display: flex; align-items: center; gap: 10px;
}
.page-title .icon { color: var(--accent-blue); width: 20px; height: 20px; }
.page-subtitle { font-size: 13px; color: var(--text-muted); }

.refresh-btn {
  display: flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px;
  border: 1px solid var(--border-color); background: transparent; color: var(--text-secondary);
  font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s;
}
.refresh-btn:hover { background: var(--hover-bg); color: var(--text-primary); }
.refresh-btn.spinning .icon { animation: spin 1s linear infinite; }

.stats-bar {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  margin-bottom: 28px;
}
.stats-bar .stat-item {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: 14px; padding: 18px 20px; box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.stats-bar .stat-item:hover {
  transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-hover);
}
.stats-bar .label {
  font-size: 10px; font-weight: 500; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 8px;
}
.stats-bar .value {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 26px; font-weight: 700; color: var(--text-primary);
  letter-spacing: -0.04em; line-height: 1.1;
}
.stats-bar .value.green { color: var(--accent-green); }
.stats-bar .value.amber { color: var(--accent-amber); }
.stats-bar .sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.filter-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-label {
  font-size: 11px; font-weight: 500; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.6px; margin-right: 4px;
}
.filter-btn {
  padding: 5px 12px; border-radius: 6px; border: 1px solid var(--border-color);
  background: transparent; color: var(--text-secondary);
  font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.15s;
  display: inline-flex; align-items: center; gap: 4px;
}
.filter-btn:hover { background: var(--hover-bg); color: var(--text-primary); }
.filter-btn.active { background: var(--accent-blue); color: #fff; border-color: var(--accent-blue); }
.filter-sep { width: 1px; height: 20px; background: var(--border-color); margin: 0 4px; }
.filter-btn .icon { width: 12px; height: 12px; }

.ticker-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 52px; padding: 3px 8px; border-radius: 5px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
  background: rgba(59, 130, 246, 0.1); color: var(--accent-blue);
  font-variant-numeric: tabular-nums;
}
.company-cell { display: flex; align-items: center; gap: 10px; }
.company-name { font-weight: 500; font-size: 13px; }
.insider-cell { display: flex; flex-direction: column; gap: 2px; }
.insider-name { font-weight: 500; font-size: 13px; }
.insider-role { font-size: 11px; color: var(--text-muted); }
.value-cell {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-weight: 700; font-size: 15px; color: var(--accent-green); white-space: nowrap;
}
.value-cell.mega { color: var(--accent-amber); }
.date-cell { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }

.size-bar-wrap { display: flex; align-items: center; }
.size-bar-bg {
  flex: 1; height: 4px; border-radius: 2px; background: var(--border-color);
  min-width: 40px; max-width: 80px;
}
.size-bar-fill { height: 100%; border-radius: 2px; background: var(--accent-green); transition: width 0.5s ease; }
.size-bar-fill.mega { background: var(--accent-amber); }

.sec-link {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px;
  color: var(--accent-blue); text-decoration: none; padding: 4px 8px;
  border-radius: 5px; border: 1px solid rgba(59, 130, 246, 0.25); transition: all 0.15s;
}
.sec-link:hover { background: rgba(59, 130, 246, 0.08); }
.sec-link .icon { width: 12px; height: 12px; }

.cluster-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px; margin-bottom: 40px;
}
.cluster-card {
  border: 1px solid var(--border-color); border-radius: 14px;
  padding: 16px 18px; background: var(--bg-card); box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.cluster-card:hover {
  transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-hover);
}
.cluster-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.cluster-insider { font-size: 14px; font-weight: 600; }
.cluster-company { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.cluster-total {
  font-family: var(--font-mono); font-size: 18px; font-weight: 700;
  color: var(--accent-green); letter-spacing: -0.03em; white-space: nowrap;
}
.cluster-purchases { display: flex; flex-direction: column; gap: 6px; }
.cluster-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 8px; border-radius: 6px; background: var(--hover-bg); font-size: 12px;
}
.cluster-row-date { color: var(--text-muted); }
.cluster-row-val { font-weight: 600; color: var(--text-primary); font-family: var(--font-mono); }
.cluster-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.cluster-badge {
  font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 4px;
  background: rgba(59, 130, 246, 0.1); color: var(--accent-blue);
}

/* ============================================================
   Historique — resume stats (JS) + tri
   ============================================================ */
.stats-summary {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: 14px; padding: 20px; box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.stat-card:hover {
  transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-hover);
}
.stat-card-label {
  font-size: 11px; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.8px; margin-bottom: 8px; font-weight: 500;
}
.stat-card-value {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 28px; font-weight: 600; color: var(--text-primary);
  line-height: 1.2; letter-spacing: -0.03em;
}
.sort-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================================
   Login / Landing / 404 (pages publiques)
   ============================================================ */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.auth-card {
  width: 100%; max-width: 380px; background: var(--bg-card);
  border: 1px solid var(--border-color); border-radius: 16px; padding: 40px;
}
.auth-brand {
  display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700;
  color: var(--accent-blue); margin-bottom: 28px;
}
.auth-card h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 8px; }
.auth-card .muted { color: var(--text-secondary); font-size: 14px; margin-bottom: 28px; }
.input-group { position: relative; margin-bottom: 16px; }
.input-group .icon {
  position: absolute; top: 50%; left: 14px; transform: translateY(-50%);
  color: var(--text-muted); width: 16px; height: 16px;
}
.input-group input {
  width: 100%; padding: 12px 14px 12px 42px; font-size: 14px;
  border: 1px solid var(--border-color); border-radius: 8px;
  background-color: var(--bg-primary); color: var(--text-primary);
}
.input-group input:focus {
  outline: none; border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}
.auth-card .btn-primary { width: 100%; justify-content: center; padding: 12px; margin-top: 8px; }

.landing-wrap { max-width: 900px; margin: 0 auto; padding: 40px 24px; }
.landing-hero {
  text-align: center; padding: 56px 24px; border-bottom: 1px solid var(--border-color);
  margin-bottom: 40px;
}
.landing-hero .auth-brand { justify-content: center; }
.landing-hero h1 { font-size: 32px; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 12px; }
.landing-hero blockquote { color: var(--text-secondary); font-style: italic; margin-bottom: 28px; }

.notfound-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px; text-align: center; padding: 24px;
}
.notfound-wrap .code {
  font-family: var(--font-mono); font-size: 72px; font-weight: 700; color: var(--accent-blue);
  letter-spacing: -0.04em; line-height: 1;
}
.notfound-wrap p { color: var(--text-secondary); font-size: 16px; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
  .container { padding: 20px; }
  nav { padding: 12px 20px; }
  .stat-value { font-size: 28px; }
  .stats-summary { grid-template-columns: repeat(5, 1fr); gap: 16px; }
  .stat-card-value { font-size: 22px; }
}

@media (max-width: 767px) {
  body { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  .container { padding: 16px; }
  nav { padding: max(12px, env(safe-area-inset-top)) 16px 12px; }
  .nav-left, .symbol-display, .bot-status, .burger-menu { display: none; }
  .mobile-menu { display: none !important; }

  .kpis { gap: 20px 40px; }
  .stat-value { font-size: 24px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .chart-box { height: 260px; }

  .hide-mobile { display: none !important; }
  tbody td, thead th { padding: 14px 10px; font-size: 14px; }
  .combined-dates { flex-direction: column; gap: 8px; }

  .stats-bar { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stats-bar .stat-item { padding: 14px 16px; }
  .stats-bar .value { font-size: 20px; }
  .cluster-grid { grid-template-columns: 1fr; }
  .stats-summary { grid-template-columns: repeat(3, 1fr); gap: 16px 12px; margin-bottom: 24px; }
  .stat-card-value { font-size: 20px; }
  .sort-buttons { width: 100%; }
  .sort-buttons .btn { flex: 1; justify-content: center; }

  /* Form 4 : table en cartes empilees sur mobile */
  .form4-table table, .form4-table thead, .form4-table tbody,
  .form4-table tr, .form4-table th, .form4-table td { display: block; }
  .form4-table thead tr { display: none; }
  .form4-table tbody tr {
    border: 1px solid var(--border-color); border-radius: 10px;
    margin-bottom: 10px; padding: 14px; background: var(--bg-card);
  }
  .form4-table tbody tr:hover { background: var(--bg-card); }
  .form4-table tbody td {
    border: none; padding: 4px 0; font-size: 13px;
    display: flex; justify-content: space-between; align-items: center;
  }
  .form4-table tbody td::before {
    content: attr(data-label); font-size: 10px; font-weight: 500; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px; min-width: 70px;
  }
  .size-bar-wrap { justify-content: flex-end; }
}
