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

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy: #0f172a;
  --navy-light: #1e293b;
  --indigo: #6366f1;
  --indigo-dark: #4f46e5;
  --sky: #0ea5e9;
  --emerald: #10b981;
  --amber: #f59e0b;
  --rose: #f43f5e;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-400: #94a3b8;
  --slate-600: #475569;
  --slate-800: #1e293b;
  --white: #ffffff;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.05);
  --shadow-lg: 0 20px 40px rgba(0,0,0,.12);
  --radius: 12px;
  --sidebar-w: 240px;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--slate-100);
  color: var(--slate-800);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* ── SIDEBAR ─────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  min-height: 100vh;
  position: fixed;
  top: 0; left: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  padding: 0 0 24px;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  margin-bottom: 8px;
}
.sidebar-logo .brand {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -.3px;
}
.sidebar-logo .sub {
  font-size: 11px;
  color: var(--slate-400);
  margin-top: 2px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  color: rgba(148,163,184,.5);
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 12px 20px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: rgba(148,163,184,.8);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 450;
  cursor: pointer;
  border-radius: 0;
  transition: all .15s;
  position: relative;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover { color: var(--white); background: rgba(255,255,255,.05); }
.nav-item.active {
  color: var(--white);
  background: rgba(99,102,241,.2);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 3px;
  background: var(--indigo);
  border-radius: 0 3px 3px 0;
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--indigo);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px 0;
  border-top: 1px solid rgba(255,255,255,.06);
}
.sync-btn {
  width: 100%;
  padding: 9px;
  background: rgba(99,102,241,.15);
  border: 1px solid rgba(99,102,241,.3);
  color: #a5b4fc;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all .2s;
}
.sync-btn:hover { background: rgba(99,102,241,.25); color: white; }
.sync-btn.syncing svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.source-dots {
  display: flex;
  gap: 5px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.source-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--slate-400);
  title: attr(data-name);
}
.source-dot.ok { background: var(--emerald); }
.source-dot.pending { background: var(--amber); }

/* ── MAIN ────────────────────────────────── */
#main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── TOPBAR ──────────────────────────────── */
#topbar {
  background: var(--white);
  border-bottom: 1px solid var(--slate-200);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--slate-800);
}
.topbar-sub {
  font-size: 12.5px;
  color: var(--slate-400);
  margin-left: 4px;
}
.topbar-search {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--slate-100);
  border: 1.5px solid var(--slate-200);
  border-radius: 8px;
  padding: 7px 14px;
  width: 280px;
  transition: all .2s;
}
.topbar-search:focus-within {
  border-color: var(--indigo);
  background: white;
  box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}
.topbar-search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13.5px;
  color: var(--slate-800);
  width: 100%;
}
.topbar-search svg { color: var(--slate-400); width: 15px; flex-shrink: 0; }

/* ── PAGE CONTENT ────────────────────────── */
.page { padding: 28px; display: none; }
.page.active { display: block; }

/* ── SECTION HEADER ──────────────────────── */
.section-header { margin-bottom: 24px; }
.section-title { font-size: 22px; font-weight: 800; color: var(--slate-800); }
.section-sub { font-size: 13.5px; color: var(--slate-400); margin-top: 3px; }

/* ── KPI CARDS ───────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--slate-200);
  position: relative;
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi-label { font-size: 12px; font-weight: 600; color: var(--slate-400); text-transform: uppercase; letter-spacing: .5px; }
.kpi-value { font-size: 32px; font-weight: 800; color: var(--slate-800); margin: 6px 0 4px; line-height: 1; }
.kpi-sub { font-size: 12px; color: var(--slate-400); }
.kpi-icon {
  position: absolute;
  right: 16px; top: 50%;
  transform: translateY(-50%);
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.kpi-icon svg { width: 20px; height: 20px; }
.kpi-icon.indigo { background: rgba(99,102,241,.1); color: var(--indigo); }
.kpi-icon.emerald { background: rgba(16,185,129,.1); color: var(--emerald); }
.kpi-icon.amber { background: rgba(245,158,11,.1); color: var(--amber); }
.kpi-icon.rose { background: rgba(244,63,94,.1); color: var(--rose); }

/* ── AI HERO CARD ────────────────────────── */
.ai-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  position: relative;
  overflow: hidden;
}
.ai-hero::before {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(99,102,241,.3) 0%, transparent 70%);
  right: -50px; top: -100px;
  pointer-events: none;
}
.ai-hero-text { flex: 1; }
.ai-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(99,102,241,.3);
  color: #a5b4fc;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.ai-hero h2 { font-size: 20px; font-weight: 800; color: white; margin-bottom: 6px; }
.ai-hero p { color: rgba(255,255,255,.65); font-size: 13.5px; max-width: 480px; }
.ai-hero-btn {
  background: linear-gradient(135deg, var(--indigo), var(--indigo-dark));
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: all .2s;
  box-shadow: 0 4px 15px rgba(99,102,241,.4);
}
.ai-hero-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(99,102,241,.5); }

/* ── GRANT CARDS ─────────────────────────── */
.grants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.grant-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all .2s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}
.grant-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #c7d2fe; }
.grant-card-accent {
  height: 4px;
  background: var(--slate-200);
}
.grant-card-accent.emerald { background: linear-gradient(90deg, var(--emerald), #34d399); }
.grant-card-accent.amber { background: linear-gradient(90deg, var(--amber), #fcd34d); }
.grant-card-accent.rose { background: linear-gradient(90deg, var(--rose), #fb7185); }
.grant-card-accent.indigo { background: linear-gradient(90deg, var(--indigo), #818cf8); }
.grant-card-accent.sky { background: linear-gradient(90deg, var(--sky), #38bdf8); }

.grant-card-body { padding: 16px; flex: 1; }
.grant-source-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .3px;
  padding: 3px 9px;
  border-radius: 6px;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.badge-idf { background: #dbeafe; color: #1d4ed8; }
.badge-paris { background: #fce7f3; color: #be185d; }
.badge-aides_territoires { background: #d1fae5; color: #065f46; }
.badge-appelaprojets { background: #fef3c7; color: #92400e; }
.badge-fimeco_handicap { background: #ede9fe; color: #5b21b6; }
.badge-fondations_prioritaires { background: #fef9c3; color: #713f12; }
.badge-data_subvention { background: #e0f2fe; color: #075985; }
.badge-fondations_entreprises_fr { background: #f0fdf4; color: #166534; }
.badge-fondations_internationales { background: #faf5ff; color: #6b21a8; }
.badge-eu_programmes { background: #eff6ff; color: #1e40af; }
.badge-eu_appels { background: #dbeafe; color: #1d4ed8; }

.grant-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--slate-800);
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.grant-financeur { font-size: 12.5px; color: var(--slate-400); margin-bottom: 10px; }
.grant-desc {
  font-size: 12.5px;
  color: var(--slate-600);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

.grant-card-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--slate-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.deadline-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 6px;
}
.deadline-badge svg { width: 12px; height: 12px; }
.deadline-open { background: #d1fae5; color: #065f46; }
.deadline-soon { background: #fef3c7; color: #92400e; }
.deadline-urgent { background: #fee2e2; color: #991b1b; }
.deadline-none { background: var(--slate-100); color: var(--slate-600); }
.amount-badge {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--indigo);
  background: rgba(99,102,241,.08);
  padding: 4px 9px;
  border-radius: 6px;
}
.view-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--indigo);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background .15s;
}
.view-btn:hover { background: rgba(99,102,241,.08); }

/* ── FILTERS ─────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.filter-pill {
  padding: 7px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--slate-200);
  background: white;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--slate-600);
  cursor: pointer;
  transition: all .15s;
}
.filter-pill:hover { border-color: var(--indigo); color: var(--indigo); }
.filter-pill.active { background: var(--indigo); border-color: var(--indigo); color: white; }
.search-bar-big {
  width: 100%;
  background: white;
  border: 2px solid var(--slate-200);
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 15px;
  outline: none;
  margin-bottom: 16px;
  transition: all .2s;
  color: var(--slate-800);
}
.search-bar-big:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 4px rgba(99,102,241,.1);
}

/* ── AI RESULTS ──────────────────────────── */
.ai-result-card {
  background: white;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  transition: all .2s;
}
.ai-result-card:hover { border-color: #c7d2fe; box-shadow: var(--shadow-sm); }
.score-circle {
  width: 52px; height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 900;
  flex-shrink: 0;
}
.score-10 { background: linear-gradient(135deg, #d1fae5, #a7f3d0); color: #065f46; }
.score-9 { background: linear-gradient(135deg, #d1fae5, #a7f3d0); color: #065f46; }
.score-8 { background: linear-gradient(135deg, #dbeafe, #bfdbfe); color: #1e40af; }
.score-7 { background: linear-gradient(135deg, #dbeafe, #bfdbfe); color: #1e40af; }
.score-6 { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e; }
.score-low { background: linear-gradient(135deg, var(--slate-100), var(--slate-200)); color: var(--slate-600); }
.ai-result-body { flex: 1; }
.ai-result-title { font-size: 15px; font-weight: 700; color: var(--slate-800); }
.ai-result-financeur { font-size: 12.5px; color: var(--slate-400); margin: 2px 0 8px; }
.ai-result-raison { font-size: 13px; color: var(--slate-600); line-height: 1.5; }
.ai-result-action {
  margin-top: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--indigo);
  background: rgba(99,102,241,.08);
  padding: 6px 12px;
  border-radius: 6px;
  display: inline-block;
}
.ai-rank {
  font-size: 11px;
  font-weight: 700;
  color: var(--slate-400);
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

/* ── AI LOADING ──────────────────────────── */
.ai-loading {
  text-align: center;
  padding: 60px 20px;
}
.ai-loading-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}
.ai-dot {
  width: 12px; height: 12px;
  background: var(--indigo);
  border-radius: 50%;
  animation: bounce .8s ease-in-out infinite;
}
.ai-dot:nth-child(2) { animation-delay: .15s; }
.ai-dot:nth-child(3) { animation-delay: .3s; }
@keyframes bounce {
  0%, 100% { transform: translateY(0); opacity: .4; }
  50% { transform: translateY(-10px); opacity: 1; }
}
.ai-loading p { color: var(--slate-400); font-size: 14px; }
.ai-loading strong { color: var(--slate-600); display: block; font-size: 16px; margin-bottom: 8px; }

/* ── FORMS ───────────────────────────────── */
.form-card {
  background: white;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.form-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 12px; font-weight: 600; color: var(--slate-600); }
input[type=text], input[type=email], textarea, select {
  padding: 9px 12px;
  border: 1.5px solid var(--slate-200);
  border-radius: 8px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--slate-800);
  outline: none;
  transition: border .2s;
  background: white;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}
textarea { resize: vertical; min-height: 80px; }

.btn-primary {
  background: linear-gradient(135deg, var(--indigo), var(--indigo-dark));
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all .2s;
  box-shadow: 0 2px 8px rgba(99,102,241,.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,.4); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-secondary {
  background: white;
  color: var(--slate-700);
  border: 1.5px solid var(--slate-200);
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.btn-secondary:hover { border-color: var(--indigo); color: var(--indigo); }

/* ── MODAL ───────────────────────────────── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#modal-overlay.open { display: flex; }
#modal-box {
  background: white;
  border-radius: 16px;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.modal-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--slate-400);
  padding: 4px;
  border-radius: 6px;
  transition: all .15s;
}
.modal-close:hover { background: var(--slate-100); color: var(--slate-800); }
.modal-body { padding: 20px 24px 24px; }
.modal-field { margin-bottom: 16px; }
.modal-field-label { font-size: 11px; font-weight: 700; color: var(--slate-400); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.modal-field-value { font-size: 14px; color: var(--slate-800); }
.modal-cta {
  display: flex;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--slate-200);
  background: var(--slate-50);
  border-radius: 0 0 16px 16px;
}

/* ── HISTORY TABLE ───────────────────────── */
.table-wrap {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--slate-200);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--slate-400);
  text-transform: uppercase;
  letter-spacing: .5px;
  background: var(--slate-50);
  border-bottom: 1px solid var(--slate-200);
}
td {
  padding: 13px 16px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--slate-100);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--slate-50); }

/* ── SOURCES GRID ────────────────────────── */
.sources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.source-card {
  background: white;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
}
.source-card-clickable {
  cursor: pointer;
  transition: all .2s;
}
.source-card-clickable:hover {
  border-color: #c7d2fe;
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.source-card-clickable:hover span[style*="Voir les"] {
  text-decoration: underline;
}
.source-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
}
.status-active { background: #d1fae5; color: #065f46; }
.status-pending { background: #fef3c7; color: #92400e; }

/* ── EMPTY STATE ─────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--slate-400);
}
.empty-state svg { width: 48px; height: 48px; margin: 0 auto 16px; opacity: .4; }
.empty-state h3 { font-size: 16px; font-weight: 700; color: var(--slate-600); margin-bottom: 6px; }

/* ── TOAST ───────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--slate-800);
  color: white;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  display: none;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  max-width: 320px;
}
#toast.show { display: flex; animation: slideUp .3s ease; }
#toast.success { background: var(--emerald); }
#toast.error { background: var(--rose); }
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ── UTILS ───────────────────────────────── */
.hidden { display: none !important; }
.skeleton {
  background: linear-gradient(90deg, var(--slate-100) 25%, var(--slate-200) 50%, var(--slate-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton-card { height: 180px; border-radius: var(--radius); }

/* ── SETTINGS TABS ───────────────────────────────────── */
.settings-tab {
  padding: 8px 16px;
  border: none;
  background: transparent;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--slate-600);
  cursor: pointer;
  transition: all .15s;
}
.settings-tab:hover { background: white; color: var(--slate-800); }
.settings-tab.active { background: white; color: var(--indigo); box-shadow: var(--shadow-sm); }

/* ── GRANT DETAIL PAGE ──────────────────────────────────── */
#page-grant-detail {
  display: none;
  margin-left: var(--sidebar-w);
  padding: 28px;
  min-height: 100vh;
  background: var(--slate-100);
}

/* ── REDACTION BUTTONS ──────────────────────────────────── */
.redac-btn {
  padding: 10px 14px;
  border: 1.5px solid var(--slate-200);
  border-radius: 8px;
  background: white;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-600);
  cursor: pointer;
  text-align: left;
  transition: all .15s;
}
.redac-btn:hover { border-color: var(--indigo); color: var(--indigo); }
.redac-btn.active { background: var(--indigo); border-color: var(--indigo); color: white; }

@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── KPIs REPORTING (dashboard /api/reporting/dashboard) ─────────── */
.rpt-kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; padding: 0 0 1.5rem; }
.rpt-kpi-card { background: white; border-radius: 12px; padding: 1.2rem 1.5rem; box-shadow: 0 2px 8px rgba(0,0,0,0.08); border-left: 4px solid; }
.rpt-kpi-blue  { border-color: #0d6efd; }
.rpt-kpi-green { border-color: #198754; }
.rpt-kpi-orange { border-color: #fd7e14; }
.rpt-kpi-red   { border-color: #dc3545; }
.rpt-kpi-navy  { border-color: #0A1628; }
.rpt-kpi-value { font-size: 2rem; font-weight: 700; color: #1a1a2e; }
.rpt-kpi-label { font-size: 0.8rem; color: #6c757d; margin-top: 0.2rem; }
.rpt-upcoming-list { margin: 0 0 1.5rem; background: white; border-radius: 10px; padding: 1rem; box-shadow: 0 2px 6px rgba(0,0,0,0.06); }
.rpt-upcoming-list h4 { margin: 0 0 0.8rem; font-size: 0.9rem; color: #444; }
.rpt-upcoming-item { display: flex; align-items: center; gap: 0.8rem; padding: 0.5rem 0; border-bottom: 1px solid #f0f0f0; font-size: 0.85rem; }
.rpt-upcoming-item:last-child { border-bottom: none; }
.rpt-upcoming-item.urgent .rpt-upcoming-badge { background: #dc3545; }
.rpt-upcoming-badge { background: #fd7e14; color: white; border-radius: 99px; padding: 2px 8px; font-size: 0.75rem; font-weight: 600; min-width: 35px; text-align: center; flex-shrink: 0; }
.rpt-upcoming-title { flex: 1; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rpt-upcoming-source { color: #888; font-size: 0.8rem; flex-shrink: 0; }

/* ── KANBAN PIPELINE ─────────────────────────────────────────────── */
.kanban-board { display: flex; gap: 1rem; padding: 0 0 1.5rem; overflow-x: auto; min-height: 60vh; }
.kanban-column { min-width: 210px; max-width: 240px; background: #f8f9fa; border-radius: 10px; flex-shrink: 0; display: flex; flex-direction: column; }
.kanban-column-header { padding: 0.8rem 1rem; border-radius: 10px 10px 0 0; background: white; border-top: 3px solid; }
.kanban-column-title { font-weight: 700; font-size: 0.85rem; color: #333; }
.kanban-count { background: rgba(0,0,0,0.1); border-radius: 99px; padding: 1px 7px; font-size: 0.75rem; margin-left: 0.4rem; }
.kanban-total { display: block; font-size: 0.78rem; color: #555; margin-top: 0.2rem; }
.kanban-cards { padding: 0.5rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; overflow-y: auto; max-height: calc(100vh - 240px); }
.kanban-card { background: white; border-radius: 8px; padding: 0.8rem; box-shadow: 0 1px 4px rgba(0,0,0,0.1); cursor: pointer; transition: transform 0.15s, box-shadow 0.15s; }
.kanban-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.kanban-card-title { font-size: 0.82rem; font-weight: 600; color: #333; margin-bottom: 0.4rem; line-height: 1.3; }
.kanban-card-meta { display: flex; justify-content: space-between; align-items: center; font-size: 0.75rem; color: #888; gap: 4px; }
.kanban-amount { color: #198754; font-weight: 600; flex-shrink: 0; }
.kanban-assigned { margin-top: 0.4rem; font-size: 0.72rem; background: #e8f0fe; color: #0d6efd; padding: 2px 6px; border-radius: 99px; display: inline-block; }
.kanban-empty { color: #aaa; font-size: 0.8rem; text-align: center; padding: 1.5rem 0.5rem; }

/* ── FILTRE EXPIRÉS ──────────────────────────────────────────────── */
.filter-toggle-wrap { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-shrink: 0; font-size: 12.5px; color: var(--slate-400); cursor: pointer; }
.filter-toggle-wrap input[type=checkbox] { accent-color: var(--indigo); width: 14px; height: 14px; cursor: pointer; }

@media (max-width: 1024px) {
  .rpt-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kanban-board { min-height: 50vh; }
}
@media (max-width: 768px) {
  .rpt-kpi-grid { grid-template-columns: 1fr 1fr; }
}

/* ── BOUTON QUICK PIPELINE ───────────────────────────────────────── */
.quick-pipeline-btn {
  background: transparent;
  border: 1px solid #0d6efd;
  color: #0d6efd;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 99px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.quick-pipeline-btn:hover {
  background: #0d6efd;
  color: white;
}
.quick-pipeline-btn.in-pipeline {
  border-color: #198754;
  color: #198754;
  cursor: default;
}

/* ── BADGE NOUVEAU ───────────────────────────────────────────────── */
.badge-new {
  background: #198754;
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 99px;
  letter-spacing: 0.05em;
  vertical-align: middle;
}

/* ── SÉLECTEUR DE TRI (filter-bar) ──────────────────────────────── */
.filter-select {
  font-size: 12.5px;
  padding: 4px 10px;
  border: 1.5px solid var(--slate-200);
  border-radius: 8px;
  background: white;
  color: var(--slate-600);
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}
.filter-select:focus {
  border-color: var(--indigo);
}

/* ===== Legs module ===== */
.legs-form { background:white; border-radius:12px; padding:1.5rem; box-shadow:0 2px 8px rgba(0,0,0,0.08); margin:1rem 1.5rem; }
.legs-form-grid { display:grid; grid-template-columns:1fr 1fr; gap:1rem; }
.legs-form .form-group label { display:block; font-size:0.8rem; font-weight:600; color:#0A1628; margin-bottom:0.3rem; }
.legs-form .form-group input, .legs-form .form-group select, .legs-form .form-group textarea { width:100%; border:1px solid #ddd; border-radius:6px; padding:0.5rem 0.7rem; font-size:0.9rem; box-sizing:border-box; }
.btn-primary { background:#0A1628; color:white; border:none; border-radius:8px; padding:0.6rem 1.5rem; cursor:pointer; font-weight:600; }
.btn-secondary { background:white; border:1px solid #ddd; border-radius:8px; padding:0.6rem 1.2rem; cursor:pointer; }
@media (max-width:768px) { .legs-form-grid { grid-template-columns:1fr; } }
