/* ============================================================
   Veille Dashboard — Dark Glass Theme
   Design inspiration: octogent.com
   Accent: #6c5ce7 (purple) • Secondary: #24e08a (green)
   ============================================================ */

/* ─── Import Font ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ─── Custom Properties ───────────────────────────────────── */
:root {
  --bg: #07070a;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --text: #e8e8ec;
  --text-dim: #6b6b73;
  --text-muted: #8b8b93;
  --accent: #6c5ce7;
  --accent-glow: rgba(108, 92, 231, 0.3);
  --accent-dim: #4a3f9e;
  --green: #24e08a;
  --amber: #f0b429;
  --red: #ff5c5c;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 30px var(--accent-glow);
  --nav-height: 64px;
  --header-height: 72px;
  --grid-gap: 20px;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: #07070a;
  background: linear-gradient(135deg, #07070a 0%, #0d0d18 40%, #0a0a12 100%);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ─── Animated Mesh Gradient Background ──────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 80% 60% at 10% 20%, rgba(108, 92, 231, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 80%, rgba(36, 224, 138, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(108, 92, 231, 0.03) 0%, transparent 60%);
  animation: meshShift 20s ease-in-out infinite alternate;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle 600px at 20% 30%, rgba(108, 92, 231, 0.04) 0%, transparent 60%),
    radial-gradient(circle 400px at 80% 70%, rgba(36, 224, 138, 0.03) 0%, transparent 60%);
  animation: meshPulse 12s ease-in-out infinite alternate;
}

@keyframes meshShift {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 0.6;
  }
  33% {
    transform: translate(-2%, 1%) scale(1.02);
    opacity: 0.8;
  }
  66% {
    transform: translate(1%, -1%) scale(0.98);
    opacity: 0.7;
  }
  100% {
    transform: translate(-1%, 2%) scale(1.04);
    opacity: 0.9;
  }
}

@keyframes meshPulse {
  0% {
    opacity: 0.4;
  }
  50% {
    opacity: 0.7;
  }
  100% {
    opacity: 0.5;
  }
}

/* ─── Custom Selection ────────────────────────────────────── */
::selection {
  background: var(--accent);
  color: #fff;
}

::-moz-selection {
  background: var(--accent);
  color: #fff;
}

/* ─── Custom Scrollbar ────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--accent-dim);
  border-radius: 3px;
  transition: background var(--transition);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--accent-dim) transparent;
}

/* ─── App Layout ──────────────────────────────────────────── */
.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--grid-gap);
  padding-bottom: 40px;
  background: #07070a;
  animation: appFadeIn 0.8s ease-out;
}

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

/* ─── Glassmorphism Header ────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  margin-top: 16px;
  margin-bottom: 24px;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(32px) saturate(1.2);
  -webkit-backdrop-filter: blur(32px) saturate(1.2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}

.header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle 300px at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(108, 92, 231, 0.06),
    transparent 60%
  );
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.header:hover::before {
  opacity: 1;
}

.header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(108, 92, 231, 0.3),
    rgba(36, 224, 138, 0.3),
    transparent
  );
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 0 20px rgba(108, 92, 231, 0.25);
  animation: glowPulse 3s ease-in-out infinite;
}

.logo span {
  background: linear-gradient(135deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.time-block {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-dim);
  font-weight: 500;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(12px);
}

.time-block::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(36, 224, 138, 0.5);
  animation: liveDot 2s ease-in-out infinite;
}

@keyframes liveDot {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

/* ─── Neon Text Effect ────────────────────────────────────── */
.neon {
  color: var(--accent);
  text-shadow:
    0 0 7px var(--accent-glow),
    0 0 10px var(--accent-glow),
    0 0 21px var(--accent-glow),
    0 0 42px var(--accent-glow);
  font-family: var(--font-display);
}

.tab-content {
  display: block;
  animation: tabFadeIn 0.3s ease;
}

.tab-content:not(.active) {
  display: none;
}

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

.neon-green {
  color: var(--green);
  text-shadow:
    0 0 7px rgba(36, 224, 138, 0.3),
    0 0 10px rgba(36, 224, 138, 0.2),
    0 0 21px rgba(36, 224, 138, 0.15);
}

/* ─── Glow Pulse Animation ────────────────────────────────── */
@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(108, 92, 231, 0.25);
  }
  50% {
    box-shadow: 0 0 35px rgba(108, 92, 231, 0.45);
  }
}

@keyframes glowPulseGreen {
  0%, 100% {
    box-shadow: 0 0 20px rgba(36, 224, 138, 0.2);
  }
  50% {
    box-shadow: 0 0 35px rgba(36, 224, 138, 0.35);
  }
}

/* ─── Tab Navigation ──────────────────────────────────────── */
.nav-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 28px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex: 1;
  min-width: fit-content;
  padding: 10px 20px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  white-space: nowrap;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.tab-btn:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.tab-btn.active {
  color: var(--accent);
  background: rgba(108, 92, 231, 0.1);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 40%;
  height: 2px;
  border-radius: 1px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(108, 92, 231, 0.5);
  animation: tabUnderline 0.3s ease-out;
}

@keyframes tabUnderline {
  from {
    width: 0;
    opacity: 0;
  }
  to {
    width: 40%;
    opacity: 1;
  }
}

/* ─── Tab Content ─────────────────────────────────────────── */
.tab-content {
  position: relative;
}

.tab-pane {
  display: none;
  animation: paneIn 0.4s ease-out;
}

.tab-pane.active {
  display: block;
}

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

/* ─── Section Dividers ────────────────────────────────────── */
.section-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 32px 0 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
}

.section-divider::before {
  background: linear-gradient(90deg, transparent, var(--border));
}

.section-divider::after {
  background: linear-gradient(90deg, var(--border), transparent);
}

.section-divider .divider-accent {
  width: 12px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  box-shadow: 0 0 6px rgba(108, 92, 231, 0.4);
}

/* ─── Grid System ─────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--grid-gap, 16px); }
.grid {
  display: grid;
  gap: var(--grid-gap);
}

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cols-6 { grid-template-columns: repeat(6, 1fr); }
.grid-cols-12 { grid-template-columns: repeat(12, 1fr); }

.col-span-1 { grid-column: span 1; }
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }
.col-span-4 { grid-column: span 4; }
.col-span-6 { grid-column: span 6; }
.col-span-8 { grid-column: span 8; }
.col-span-12 { grid-column: span 12; }

/* ─── Glassmorphism Card ──────────────────────────────────── */
.card {
  background: var(--surface);
  backdrop-filter: blur(24px) saturate(1.1);
  -webkit-backdrop-filter: blur(24px) saturate(1.1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  animation: cardFadeIn 0.6s ease-out both;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.weather-glass {
  border-radius: 16px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all 0.5s ease;
  background: linear-gradient(135deg, rgba(108,92,231,0.15), rgba(36,224,138,0.05));
}
.weather-glass.weather-sunny { background: linear-gradient(135deg, rgba(255,200,50,0.2), rgba(255,150,50,0.1)); }
.weather-glass.weather-cloudy { background: linear-gradient(135deg, rgba(150,150,170,0.2), rgba(100,100,130,0.1)); }
.weather-glass.weather-rainy { background: linear-gradient(135deg, rgba(50,100,200,0.2), rgba(30,60,150,0.1)); }
.weather-glass.weather-storm { background: linear-gradient(135deg, rgba(80,30,120,0.3), rgba(40,20,80,0.2)); }
.weather-glass.weather-snow { background: linear-gradient(135deg, rgba(200,220,255,0.2), rgba(150,180,220,0.1)); }

.weather-current { text-align: center; padding: 10px 0 16px; }
.weather-icon-big { font-size: 56px; line-height: 1; margin-bottom: 4px; filter: drop-shadow(0 4px 12px rgba(255,200,50,0.3)); }
.weather-temp-big { font-size: 52px; font-weight: 300; letter-spacing: -3px; line-height: 1; font-family: var(--font-display); }
.weather-status { font-size: 15px; color: var(--text-muted); margin: 6px 0 4px; }
.weather-feels { font-size: 12px; color: var(--text-dim); }

.weather-forecast { display: flex; gap: 6px; margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--border); }
.weather-day-select {
  flex: 1; text-align: center; padding: 8px 4px;
  border-radius: 10px; cursor: pointer;
  transition: all 0.3s ease; background: rgba(255,255,255,0.03);
}
.weather-day-select:hover { background: rgba(255,255,255,0.08); }
.weather-day-select.active { background: rgba(108,92,231,0.15); border: 1px solid rgba(108,92,231,0.2); }
.wd-name { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--text-dim); letter-spacing: 0.5px; margin-bottom: 2px; font-family: var(--font-display); }
.wd-icon { font-size: 22px; margin: 2px 0; filter: drop-shadow(0 2px 6px rgba(255,200,50,0.2)); }
.wd-high { font-size: 15px; font-weight: 600; font-family: var(--font-display); }
.wd-low { font-size: 12px; color: var(--text-dim); }
.wd-rain { font-size: 10px; color: var(--accent); font-weight: 600; margin-top: 1px; }

.card-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-dim);
  font-family: var(--font-display);
  margin-bottom: 14px;
}

.card:hover::before {
  opacity: 1;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(108, 92, 231, 0.05);
  border-color: var(--border-hover);
  background: var(--surface-hover);
}

.card:active {
  transform: translateY(0);
  transition-duration: 0.1s;
}

.card:nth-child(1) { animation-delay: 0s; }
.card:nth-child(2) { animation-delay: 0.08s; }
.card:nth-child(3) { animation-delay: 0.16s; }
.card:nth-child(4) { animation-delay: 0.24s; }
.card:nth-child(5) { animation-delay: 0.32s; }
.card:nth-child(6) { animation-delay: 0.40s; }

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

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-header h3 .accent-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(108, 92, 231, 0.4);
}

.card-body {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.card-body p {
  margin-bottom: 12px;
}

.card-body p:last-child {
  margin-bottom: 0;
}

.card-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.card-badge.purple {
  background: rgba(108, 92, 231, 0.15);
  color: var(--accent);
}

.card-badge.green {
  background: rgba(36, 224, 138, 0.15);
  color: var(--green);
}

.card-badge.amber {
  background: rgba(240, 180, 41, 0.15);
  color: var(--amber);
}

.card-badge.red {
  background: rgba(255, 92, 92, 0.15);
  color: var(--red);
}

/* ─── AI Knowledge Cards ──────────────────────────────────── */
.ai-card {
  background: var(--surface);
  backdrop-filter: blur(24px) saturate(1.1);
  -webkit-backdrop-filter: blur(24px) saturate(1.1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
  margin-bottom: 12px;
  animation: cardFadeIn 0.5s ease-out both;
}

.ai-card:hover {
  border-color: var(--border-hover);
  background: var(--surface-hover);
}

.ai-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}

.ai-card-header:hover {
  background: rgba(255, 255, 255, 0.02);
}

.ai-card-header .title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.ai-card-header .title .icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  background: rgba(108, 92, 231, 0.12);
  color: var(--accent);
  flex-shrink: 0;
}

.ai-card-header .chevron {
  width: 20px;
  height: 20px;
  color: var(--text-dim);
  transition: transform var(--transition);
}

.ai-card.expanded .chevron {
  transform: rotate(180deg);
}

.ai-card-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              padding 0.3s ease;
  padding: 0 20px;
}

.ai-card.expanded {
  overflow: visible;
}

.ai-card.expanded .ai-card-body {
  max-height: 8000px;
  overflow: visible;
  padding: 0 20px 16px;
}

.ai-card-body .content {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.7;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.ai-card-body .content p {
  margin-bottom: 8px;
}

.ai-card-body .content p:last-child {
  margin-bottom: 0;
}

.ai-card-body .content code {
  background: rgba(108, 92, 231, 0.1);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8em;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.ai-card:nth-child(1) { animation-delay: 0s; }
.ai-card:nth-child(2) { animation-delay: 0.06s; }
.ai-card:nth-child(3) { animation-delay: 0.12s; }
.ai-card:nth-child(4) { animation-delay: 0.18s; }
.ai-card:nth-child(5) { animation-delay: 0.24s; }
.ai-card:nth-child(6) { animation-delay: 0.30s; }

/* ─── Animated Card Borders ───────────────────────────────── */
@keyframes borderShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.card::after,
.stat-item::after,
.ai-card::after,
.link-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    105deg,
    transparent 10%,
    var(--accent) 35%,
    var(--green) 55%,
    var(--accent) 70%,
    transparent 90%
  );
  background-size: 200% 100%;
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: borderShift 4s ease-in-out infinite;
  opacity: 0.15;
  transition: opacity 0.5s ease;
  pointer-events: none;
  z-index: 0;
}

.card:hover::after,
.stat-item:hover::after,
.ai-card:hover::after,
.link-card:hover::after {
  opacity: 0.6;
}

/* ─── Scroll triggered border pulse ───────────────────────── */
.card.border-pulse::after,
.stat-item.border-pulse::after,
.ai-card.border-pulse::after,
.link-card.border-pulse::after {
  opacity: 0.5 !important;
  animation: borderShift 1s ease-in-out !important;
}

/* ─── Stats Grid ──────────────────────────────────────────── */
.stat-grid {
  display: grid;
  gap: var(--grid-gap);
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.stat-item {
  background: var(--surface);
  backdrop-filter: blur(24px) saturate(1.1);
  -webkit-backdrop-filter: blur(24px) saturate(1.1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  animation: cardFadeIn 0.5s ease-out both;
}

.stat-item:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  background: var(--surface-hover);
}

.stat-item .stat-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
  display: block;
}

.stat-item .stat-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  background: linear-gradient(135deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-item .stat-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
  margin-top: 4px;
}

.stat-item .stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 999px;
}

.stat-trend.up {
  background: rgba(36, 224, 138, 0.1);
  color: var(--green);
}

.stat-trend.down {
  background: rgba(255, 92, 92, 0.1);
  color: var(--red);
}

.stat-item .stat-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  border-radius: 0 1px 0 0;
  transition: width 1s ease;
}

.stat-bar.purple {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(108, 92, 231, 0.4);
}

.stat-bar.green {
  background: var(--green);
  box-shadow: 0 0 8px rgba(36, 224, 138, 0.3);
}

.stat-bar.amber {
  background: var(--amber);
  box-shadow: 0 0 8px rgba(240, 180, 41, 0.3);
}

.stat-item:nth-child(1) { animation-delay: 0s; }
.stat-item:nth-child(2) { animation-delay: 0.08s; }
.stat-item:nth-child(3) { animation-delay: 0.16s; }
.stat-item:nth-child(4) { animation-delay: 0.24s; }
.stat-item:nth-child(5) { animation-delay: 0.32s; }
.stat-item:nth-child(6) { animation-delay: 0.40s; }

/* ─── Animated Counter (CSS only demo) ────────────────────── */
@keyframes countUp {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.stat-value.animated {
  animation: countUp 0.6s ease-out both;
  animation-delay: 0.3s;
}

/* ─── Search Bar ──────────────────────────────────────────── */
.search-bar {
  position: relative;
  margin-bottom: 20px;
}

.search-bar input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  background: var(--surface);
  backdrop-filter: blur(24px) saturate(1.1);
  -webkit-backdrop-filter: blur(24px) saturate(1.1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.875rem;
  outline: none;
  transition: all var(--transition);
}

.search-bar input::placeholder {
  color: var(--text-dim);
}

.search-bar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.12), 0 0 20px rgba(108, 92, 231, 0.08);
  background: rgba(255, 255, 255, 0.05);
}

.search-bar .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-dim);
  pointer-events: none;
  transition: color var(--transition);
}

.search-bar input:focus ~ .search-icon {
  color: var(--accent);
}

/* ─── Links Section ───────────────────────────────────────── */
.links-grid {
  display: grid;
  gap: var(--grid-gap);
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.link-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--surface);
  backdrop-filter: blur(24px) saturate(1.1);
  -webkit-backdrop-filter: blur(24px) saturate(1.1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  transition: all var(--transition);
  animation: cardFadeIn 0.5s ease-out both;
}

.link-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: rgba(108, 92, 231, 0.06);
  box-shadow: var(--shadow-md), 0 0 24px rgba(108, 92, 231, 0.05);
}

.link-card .link-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  background: rgba(108, 92, 231, 0.1);
  color: var(--accent);
  flex-shrink: 0;
  transition: all var(--transition);
}

.link-card:hover .link-icon {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 16px rgba(108, 92, 231, 0.3);
}

.link-card .link-info {
  flex: 1;
  min-width: 0;
}

.link-card .link-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.link-card .link-url {
  font-size: 0.75rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-card .link-arrow {
  color: var(--text-dim);
  transition: all var(--transition);
  flex-shrink: 0;
}

.link-card:hover .link-arrow {
  color: var(--accent);
  transform: translateX(4px);
}

/* ─── Accent Glow Elements ────────────────────────────────── */
.glow-accent {
  position: relative;
}

.glow-accent::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: var(--accent);
  opacity: 0;
  filter: blur(12px);
  z-index: -1;
  transition: opacity var(--transition);
}

.glow-accent:hover::after {
  opacity: 0.15;
}

/* ─── Empty State ─────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state h4 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 300px;
}

/* ─── Loading Skeleton ────────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface) 25%,
    var(--surface-hover) 50%,
    var(--surface) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-xs);
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  width: 80%;
}

.skeleton-text.short {
  width: 40%;
}

.skeleton-card {
  height: 120px;
  border-radius: var(--radius);
}

/* ─── Transitions on everything ───────────────────────────── */
a, button, input, textarea, select,
.card, .ai-card, .stat-item, .link-card,
.tab-btn, .header, .search-bar input {
  transition: all var(--transition);
}

/* ─── Responsive — Mobile First ───────────────────────────── */
/* Base (mobile): 1 column, smaller everything */
@media (max-width: 480px) {
  body {
    background: linear-gradient(135deg, #07070a 0%, #0d0d18 40%, #0a0a12 100%);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .app {
    padding: 0 10px;
    padding-bottom: 80px;
  }

  /* ── Header ultra compact ── */
  .header {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin: 6px 0 10px;
    border-radius: 14px;
  }
  .logo { font-size: 0.9rem; }
  .logo-text { font-weight: 700; }
  .logo-sub { display: none; }
  .header-right { display: none; }

  /* ── Nav tabs en bas (comme une app) ── */
  .nav-tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    gap: 0;
    margin: 0;
    padding: 6px 0 env(safe-area-inset-bottom, 6px);
    background: rgba(7,7,10,0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: none;
    border-top: 1px solid var(--border);
    border-radius: 0;
    overflow-x: visible;
    justify-content: space-around;
  }

  .tab-btn {
    flex: 1;
    min-width: 0;
    min-height: 48px;
    padding: 4px 6px;
    font-size: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border-radius: 10px;
  }
  .tab-btn svg { width: 22px; height: 22px; margin-bottom: 1px; }
  .tab-btn span { display: block; font-size: 10px; line-height: 1.1; }
  .tab-btn.active { background: rgba(108,92,231,0.12); color: var(--accent); }

  /* ── Greeting ── */
  .greeting { font-size: 1.1rem; margin-bottom: 10px; }

  /* ── Grid ── */
  .grid-2 { grid-template-columns: 1fr; gap: 10px; }
  .card { padding: 12px; }

  /* ── Météo interactive ── */
  .weather-glass { padding: 12px; }
  .weather-icon-big { font-size: 40px; }
  .weather-temp-big { font-size: 36px; letter-spacing: -2px; }
  .weather-status { font-size: 13px; }
  .weather-feels { font-size: 11px; }
  .weather-forecast {
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .weather-forecast::-webkit-scrollbar { display: none; }
  .weather-day-select { min-width: 56px; padding: 8px 4px; min-height: 44px; }
  .wd-icon { font-size: 18px; }
  .wd-high { font-size: 13px; }
  .wd-low { font-size: 11px; }

  /* ── Stats ── */
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-item { padding: 10px 8px; }
  .stat-item .stat-value { font-size: 1.2rem; }

  /* ── IA Knowledge compact ── */
  .section-header h2 { font-size: 1.1rem; }
  .section-desc { display: none; }
  .search-bar { margin-bottom: 6px; }
  .search-bar input { font-size: 12px; padding: 7px 10px 7px 28px; }
  .search-icon { left: 8px; font-size: 12px; }

  .ai-filters { gap: 4px; padding-bottom: 4px; margin-bottom: 6px; }
  .ai-filters .filter-btn { padding: 4px 8px; font-size: 10px; min-height: 30px; }

  .ai-grid { grid-template-columns: 1fr; gap: 8px; }
  .ai-card { margin-bottom: 6px; }
  .ai-card-header { padding: 14px 14px; gap: 10px; min-height: 48px; }
  .ai-card-header .ai-icon { font-size: 20px; min-width: 28px; }
  .ai-card-header .ai-info strong { font-size: 14px; }
  .ai-card-header .ai-info small { font-size: 12px; }
  .ai-card-body .content { padding: 0 14px 12px; }
  .ai-card-body .content p { font-size: 13px; line-height: 1.5; }

  /* ── Transport Page ── */
  .tp-day-selector { grid-template-columns:1fr; }
  .tp-horloge .tp-horloge-time { font-size:1.3rem; }
  .tp-slot-header { font-size:0.78rem; padding:8px 10px; }
  .tp-dep-time { font-size:0.9rem; min-width:42px; }

  /* ── Transit ── */
  .transit-item { gap: 6px; padding: 6px 0; }
  .transit-line { font-size: 10px; padding: 2px 6px; min-width: 26px; }
  .transit-time { font-size: 15px; min-width: 42px; }
  .transit-dest { font-size: 11px; }
  .transit-footer { font-size: 10px; }

  /* ── Sections ── */
  .section-header { margin-bottom: 14px; }
  .section-header h2 { font-size: 1.2rem; }
  .section-desc { font-size: 11px; }
  .search-bar { margin-bottom: 12px; }
  .search-bar input { font-size: 13px; padding: 10px 12px 10px 34px; }

  /* ── Footer ── */
  .status-bar { font-size: 10px; padding: 12px 0 0; }

  /* ── Context ── */
  .context-badge { padding: 10px; }
  .context-badge span { font-size: 20px; }
  .context-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .context-grid small { font-size: 10px; }
  .context-grid strong { font-size: 12px; }
}

/* Tablet */
@media (min-width: 481px) and (max-width: 768px) {
  .app {
    padding: 0 16px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .links-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .col-span-3,
  .col-span-4 {
    grid-column: span 2;
  }

  .grid-cols-6 {
    grid-template-columns: repeat(3, 1fr);
  }

  .col-span-6 {
    grid-column: span 3;
  }
}

/* Small desktop */
@media (min-width: 769px) and (max-width: 1024px) {
  .grid-cols-4 {
    grid-template-columns: repeat(3, 1fr);
  }

  .col-span-4 {
    grid-column: span 3;
  }

  .stat-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Large desktop */
@media (min-width: 1025px) {
  .stat-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ─── Reduced Motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  body::before,
  body::after {
    animation: none !important;
  }

  .card,
  .stat-item,
  .ai-card,
  .tab-pane {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .skeleton {
    animation: none !important;
  }
}

/* ─── Print Styles ────────────────────────────────────────── */
@media print {
  body {
    background: #fff;
    color: #000;
  }

  .card,
  .ai-card,
  .stat-item {
    background: #f5f5f5;
    border: 1px solid #ddd;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .header {
    border: 1px solid #ddd;
    backdrop-filter: none;
  }

  body::before,
  body::after {
    display: none !important;
  }
}

/* ─── Utility Classes ─────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.7rem; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-accent { color: var(--accent); }
.text-green { color: var(--green); }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }

/* Fade-in stagger utility */
.fade-in {
  animation: cardFadeIn 0.6s ease-out both;
}

.fade-in-d1 { animation-delay: 0.1s; }
.fade-in-d2 { animation-delay: 0.2s; }
.fade-in-d3 { animation-delay: 0.3s; }
.fade-in-d4 { animation-delay: 0.4s; }
.fade-in-d5 { animation-delay: 0.5s; }

/* ─── End of Veille Dashboard Styles ──────────────────────── */

/* ─── Status & Footer ────────────────────────────────────── */
.status-dot { display:inline-block; width:8px; height:8px; border-radius:50%; background:var(--green); vertical-align:middle; }
.status-bar { font-size:12px; color:var(--text-dim); text-align:center; padding:20px 0 0; }
.status-sep { margin:0 8px; color:var(--border); }

/* ─── Transport Page — Appels API réels ────────────────── */
.transport-page { animation: fadeIn 0.4s ease; }

.tp-topbar { margin-bottom:16px; }
.tp-horloge { text-align:center; padding:12px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); display:flex; align-items:center; justify-content:center; gap:10px; }
.tp-horloge .tp-horloge-time { font-size:1.6rem; font-weight:700; font-family:var(--font-mono); letter-spacing:0.05em; }
.tp-horloge small { color:var(--text-dim); font-size:11px; }

.tp-day-selector { display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:12px; }

.tp-day-col { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:14px; transition:all var(--transition); }
.tp-day-col:hover { border-color:var(--accent); }
.tp-day-col.tp-day-col-today { border-color:var(--accent); box-shadow:0 0 15px var(--accent-glow); }

.tp-col-header { display:flex; align-items:center; gap:8px; margin-bottom:4px; font-size:0.95rem; }
.tp-col-header strong { font-family:var(--font-display); }
.tp-today-dot { display:inline-block; background:var(--accent); color:#000; font-size:9px; font-weight:700; padding:1px 6px; border-radius:8px; }

.tp-col-route { font-size:0.85rem; font-weight:600; color:var(--accent); }
.tp-col-desc { font-size:0.75rem; color:var(--text-muted); margin-bottom:10px; }

.tp-slot-box { margin:8px 0; border:1px solid var(--border); border-radius:var(--radius-sm); overflow:hidden; }
.tp-slot-header { display:flex; align-items:center; justify-content:space-between; padding:10px 12px; font-size:0.82rem; font-weight:500; cursor:pointer; background:rgba(255,255,255,0.02); transition:background var(--transition); user-select:none; }
.tp-slot-header:hover { background:rgba(255,255,255,0.05); }
.tp-load-btn { font-size:0.72rem; font-weight:600; color:var(--accent); opacity:0.7; transition:opacity var(--transition); }
.tp-slot-header:hover .tp-load-btn { opacity:1; }

.tp-slot-result { padding:0 12px; }
.tp-loading-inline { text-align:center; padding:12px; font-size:1.2rem; }

.tp-real-list { padding:8px 0; }
.tp-route-label { font-size:0.82rem; font-weight:600; color:var(--text); margin-bottom:6px; }
.tp-live-dir { font-size:0.78rem; color:var(--text-muted); margin-bottom:6px; padding-bottom:6px; border-bottom:1px solid var(--border); }
.tp-live-empty { text-align:center; padding:12px; color:var(--text-dim); font-size:0.82rem; }

.tp-bus-split { display:flex; flex-direction:column; gap:10px; }
.tp-bus-leg { }
.tp-bus-leg + .tp-bus-leg { border-top:1px solid var(--border); padding-top:8px; margin-top:4px; }

/* Next departures list */
.tp-departures { display:flex; flex-direction:column; gap:2px; }
.tp-departure { display:flex; align-items:center; gap:8px; padding:6px 0; border-bottom:1px solid rgba(255,255,255,0.03); }
.tp-departure:last-child { border-bottom:none; }
.tp-departure-first .tp-dep-time { color:var(--accent); font-weight:800; }
.tp-dep-time { font-size:1rem; font-weight:700; font-family:var(--font-mono); font-variant-numeric:tabular-nums; min-width:50px; color:var(--text); }
.tp-dep-dest { font-size:0.78rem; color:var(--text-muted); }

@keyframes pulse {
  0%, 100% { opacity:1; }
  50% { opacity:0.6; }
}

/* ─── Transit ────────────────────────────────────────────── */
.transit-list { display:flex; flex-direction:column; gap:4px; }
.transit-item { display:flex; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid rgba(255,255,255,0.04); }
.transit-item:last-child { border-bottom:none; }
.transit-line { font-size:11px; font-weight:700; padding:2px 8px; border-radius:6px; background:rgba(108,92,231,0.15); color:var(--accent); min-width:30px; text-align:center; font-family:var(--font-mono); }
.transit-line.tram { background:rgba(36,224,138,0.15); color:var(--green); }
.transit-line.train { background:rgba(108,92,231,0.15); color:var(--accent); }
.transit-line.bus { background:rgba(240,180,41,0.15); color:var(--amber); }
.transit-time { font-size:16px; font-weight:600; font-family:var(--font-display); font-variant-numeric:tabular-nums; min-width:48px; }
.transit-dest { font-size:12px; color:var(--text-muted); flex:1; }
.transit-footer { font-size:11px; color:var(--text-dim); text-align:center; border-top:1px solid var(--border); padding-top:8px; margin-top:8px; }

/* ─── AI Knowledge extras ────────────────────────────────── */
.ai-section { margin-top:14px; }
.ai-section h4 { font-size:13px; font-weight:600; color:var(--accent); margin-bottom:6px; font-family:var(--font-display); }
.model-item { margin:4px 0; padding:6px 10px; border-radius:8px; background:rgba(255,255,255,0.03); display:flex; flex-direction:column; gap:2px; }
.model-item strong { font-size:13px; }
.model-item span { font-size:12px; color:var(--text-muted); }
.paper-link { display:block; margin:4px 0; padding:6px 10px; border-radius:8px; background:rgba(255,255,255,0.03); font-size:12px; color:var(--accent); text-decoration:none; }
.paper-link:hover { background:rgba(108,92,231,0.1); }
.paper-link small { color:var(--text-dim); }

/* ─── Stats ──────────────────────────────────────────────── */
.stat-bar { height:4px; background:rgba(255,255,255,0.06); border-radius:4px; margin-top:6px; overflow:hidden; }
.stat-bar-fill { height:100%; background:linear-gradient(90deg,var(--green),var(--accent)); border-radius:4px; transition:width 0.5s ease; }

/* ─── Context ─────────────────────────────────────────────── */
.context-badge { display:flex; align-items:center; gap:10px; padding:12px; border-radius:10px; background:rgba(255,255,255,0.03); margin-bottom:10px; }
.context-badge.active { border-left:3px solid var(--amber); background:rgba(240,180,41,0.06); }
.context-badge span { font-size:24px; }
.context-badge strong { font-size:14px; font-weight:600; display:block; }
.context-badge small { font-size:12px; color:var(--text-muted); display:block; margin-top:2px; }
.context-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.context-grid div { background:rgba(255,255,255,0.03); padding:12px; border-radius:8px; }
.context-grid small { font-size:11px; color:var(--text-dim); text-transform:uppercase; letter-spacing:0.5px; display:block; margin-bottom:2px; }
.context-grid strong { font-size:15px; font-weight:500; display:block; }

/* ─── Search Bar ──────────────────────────────────────────── */
.search-bar { position:relative; margin-bottom:16px; }
.search-icon { position:absolute; left:12px; top:50%; transform:translateY(-50%); font-size:14px; opacity:0.5; pointer-events:none; }
.search-bar input { width:100%; padding:10px 12px 10px 36px; background:rgba(255,255,255,0.04); border:1px solid var(--border); border-radius:10px; color:var(--text); font-size:14px; font-family:var(--font); outline:none; transition:all var(--transition); }
.search-bar input:focus { border-color:var(--accent); box-shadow:0 0 0 3px rgba(108,92,231,0.1); }

/* ─── Section Header ─────────────────────────────────────── */
.section-header { margin-bottom:20px; }
.section-header h2 { font-size:1.6rem; font-family:var(--font-display); font-weight:700; margin:0; }
.section-desc { font-size:13px; color:var(--text-muted); margin-top:4px; }

/* ─── AI Filters ──────────────────────────────────────────── */
.ai-filters { display:flex; gap:6px; margin-bottom:14px; flex-wrap:wrap; }
.filter-btn { padding:6px 14px; border:1px solid var(--border); border-radius:20px; background:transparent; color:var(--text-dim); font-size:12px; font-weight:500; cursor:pointer; transition:all var(--transition); font-family:var(--font-display); }
.filter-btn:hover { border-color:var(--accent); color:var(--text); }
.filter-btn.active { background:rgba(108,92,231,0.15); border-color:var(--accent); color:var(--accent); }

/* ─── AI Grid ─────────────────────────────────────────────── */
.ai-grid { display:grid; grid-template-columns:1fr; gap:10px; }

/* ─── Modal / Détail IA ───────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(7,7,10,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.35s ease;
  padding: 16px;
}
.modal-overlay.active {
  opacity: 1; pointer-events: all;
}

.modal-content {
  background: linear-gradient(180deg, #12121a 0%, #0d0d15 100%);
  border: 1px solid var(--border);
  border-radius: 20px;
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 0;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
}
.modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: inherit;
  border-radius: 20px 20px 0 0;
  z-index: 1;
}
.modal-emoji { font-size: 36px; line-height: 1; flex-shrink: 0; }
.modal-title { font-size: 18px; font-weight: 700; font-family: var(--font-display); }
.modal-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.modal-close {
  margin-left: auto; flex-shrink: 0;
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-dim); font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--surface-hover); color: var(--text); }

.modal-body { padding: 20px 24px 28px; }
.modal-section { margin-bottom: 20px; }
.modal-section h4 { font-size: 13px; font-weight: 600; color: var(--accent); margin-bottom: 8px; font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.5px; }
.modal-section p, .modal-section div { font-size: 14px; line-height: 1.65; color: var(--text-muted); }
.modal-section ul { padding-left: 18px; }
.modal-section li { font-size: 14px; line-height: 1.6; color: var(--text-muted); margin-bottom: 4px; }

@media (max-width: 480px) {
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-content { max-height: 92vh; border-radius: 20px 20px 0 0; }
  .modal-header { padding: 16px 16px 14px; }
  .modal-body { padding: 14px 16px 24px; }
  .modal-title { font-size: 16px; }
  .modal-emoji { font-size: 28px; }
}

/* ─── Calendar ────────────────────────────────────────────── */
.cal-block { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.cal-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--accent); margin-bottom: 8px; font-family: var(--font-display); }
.cal-info { flex:1; min-width:0; }
.cal-info strong { display:block; font-size:13px; font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cal-info small { font-size:11px; color:var(--text-dim); display:block; }
.cal-dur { font-size:11px; color:var(--text-dim); font-family:var(--font-mono); }
.cal-empty { font-size:12px; color:var(--text-dim); padding:6px 0; }


/* ─── Calendar Week View ──────────────────────────────────── */
.cal-nav { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; gap:8px; }
.cal-nav-btn { padding:6px 14px; border:1px solid var(--border); border-radius:8px; background:transparent; color:var(--text-dim); font-size:13px; cursor:pointer; transition:all var(--transition); font-family:var(--font-display); }
.cal-nav-btn:hover { border-color:var(--accent); color:var(--text); }
.cal-nav-title { font-size:13px; font-weight:600; color:var(--text-muted); font-family:var(--font-display); }
.cal-week-summary { font-size:12px; color:var(--text-dim); margin-bottom:12px; text-align:center; }

.cal-week-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:6px; }
.cal-day-card { background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:10px; min-height:140px; transition:all var(--transition); }
.cal-day-card.is-today { border-color:var(--accent); background:rgba(108,92,231,0.06); }
.cal-day-card.has-courses { border-color:rgba(108,92,231,0.15); }
.cal-day-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; padding-bottom:6px; border-bottom:1px solid var(--border); }
.cal-day-header span { font-size:11px; font-weight:600; font-family:var(--font-display); text-transform:uppercase; letter-spacing:0.5px; }
.cal-day-header small { font-size:10px; color:var(--text-dim); }
.cal-today-badge { font-size:9px; font-weight:700; background:var(--accent); color:#fff; padding:1px 6px; border-radius:4px; }

.cal-day-course { padding:4px 0; border-bottom:1px solid rgba(255,255,255,0.04); display:grid; grid-template-columns:1fr auto; gap:2px 6px; }
.cal-day-course:last-child { border-bottom:none; }
.cal-course-time { font-weight:600; font-family:var(--font-mono); font-size:10px; color:var(--accent); grid-column:1; }
.cal-course-name { font-size:11px; grid-column:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cal-course-end { font-size:9px; color:var(--text-dim); font-family:var(--font-mono); grid-column:2; grid-row:1; text-align:right; }
.cal-course-room { display:inline-block; font-size:9px; background:rgba(108,92,231,0.12); color:var(--accent); padding:1px 5px; border-radius:4px; grid-column:1; width:fit-content; }

/* Course type colors */
.cal-day-course.course-tp { border-left:2px solid #24e08a; padding-left:4px; }
.cal-day-course.course-td { border-left:2px solid #f0b429; padding-left:4px; }
.cal-day-course.course-cm { border-left:2px solid #6c5ce7; padding-left:4px; }
.cal-day-course.course-app { border-left:2px solid #54a0ff; padding-left:4px; }

.cal-day-empty { text-align:center; color:var(--text-dim); font-size:12px; padding:20px 0; }

@media (max-width: 900px) {
  .cal-week-grid { grid-template-columns:repeat(3,1fr); gap:4px; }
  .cal-day-card:nth-child(n+7) { display:none; }
}
@media (max-width: 480px) {
  .cal-week-grid { grid-template-columns:1fr; gap:4px; }
  .cal-day-card:nth-child(n+7) { display:block; }
}

/* ─── Lab Tab ────────────────────────────────────────────── */
.lab-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.lab-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:16px; }
.lab-card-title { font-size:12px; font-weight:600; text-transform:uppercase; letter-spacing:0.5px; color:var(--text-dim); margin-bottom:12px; font-family:var(--font-display); }

/* Terminal */
.lab-terminal { background:rgba(0,0,0,0.4); border-radius:8px; padding:12px; font-family:var(--font-mono); font-size:13px; }
.term-output { min-height:120px; max-height:200px; overflow-y:auto; line-height:1.5; margin-bottom:8px; }
.term-line { display:flex; align-items:center; gap:4px; }
.term-prompt { color:var(--green); white-space:nowrap; }
.term-input { flex:1; background:transparent; border:none; color:var(--text); font-family:var(--font-mono); font-size:13px; outline:none; }

/* Themes */
.theme-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:6px; }
.theme-btn { padding:8px; border:1px solid var(--border); border-radius:8px; background:transparent; color:var(--text-dim); font-size:12px; cursor:pointer; transition:all var(--transition); font-family:var(--font-display); }
.theme-btn:hover { border-color:var(--accent); color:var(--text); }
.theme-btn.active { background:rgba(108,92,231,0.12); border-color:var(--accent); color:var(--accent); }

/* Easter egg */
.lab-easter { font-size:13px; color:var(--text-muted); padding:8px; text-align:center; border:1px dashed var(--border); border-radius:8px; cursor:default; }

@media (max-width:480px) {
  .lab-grid { grid-template-columns:1fr; }
}

/* ─── Mobile fallback: mask-composite poorly supported → glow ─ */
@media (hover: none) and (pointer: coarse) {
  @keyframes cardMobileGlow {
    0%, 100% { box-shadow: inset 0 0 0 1px var(--border), 0 0 6px rgba(108,92,231,0); }
    50% { box-shadow: inset 0 0 0 1px var(--accent), 0 0 14px rgba(108,92,231,0.12); }
  }
  .card, .stat-item, .ai-card, .link-card {
    animation: cardMobileGlow 3s ease-in-out infinite;
  }
  .card::after, .stat-item::after, .ai-card::after, .link-card::after {
    display: none !important;
  }
  .card:hover, .stat-item:hover, .ai-card:hover, .link-card:hover {
    animation: cardMobileGlow 1s ease-in-out infinite;
    border-color: var(--accent);
  }
}
