:root {
  --bg: #f6f8fc;
  --bg-elevated: #eef2f9;
  --card: #ffffff;
  --border: #dfe5f0;
  --text: #101a33;
  --text-muted: #5a6786;
  --accent: #2f5fd6;
  --accent-2: #0e9a78;
  --accent-3: #a9791f;
  --danger: #c1272d;
  --radius: 14px;
  --max-width: 1120px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-heading: "Source Serif 4", Georgia, "Times New Roman", serif;
  --shadow: 0 1px 2px rgba(16, 26, 51, 0.04), 0 8px 24px rgba(16, 26, 51, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Header ---- */
header.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(246, 248, 252, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header .bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  gap: 12px;
}
.brand {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  color: var(--text);
}
.brand span { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 20px; }
.nav-links a { color: var(--text-muted); font-weight: 500; font-size: 0.95rem; }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.lang-switch a {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.lang-switch a.active { color: var(--text); border-color: var(--accent); }

/* ---- Hero ---- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 96px 0 80px;
  isolation: isolate;
}
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image: url('/img/hero-bg.svg');
  background-size: cover;
  background-position: center bottom;
  animation: drift 22s ease-in-out infinite alternate;
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(246, 248, 252, 0.55) 0%, rgba(246, 248, 252, 0.85) 60%, var(--bg) 100%);
}
@keyframes drift {
  0% { transform: translate3d(0,0,0) scale(1.02); }
  100% { transform: translate3d(-1.5%, -1%, 0) scale(1.06); }
}
.hero h1 {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  max-width: 780px;
  margin: 0 0 20px;
}
.hero p.subtitle {
  color: var(--text-muted);
  font-size: 1.15rem;
  max-width: 620px;
  margin: 0 0 32px;
}
.hero-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.badge-free {
  font-size: 0.85rem;
  color: var(--accent-2);
}

/* ---- Trust bar ---- */
.trust-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 44px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.trust-item {
  display: flex;
  align-items: center;
  gap: 14px;
}
.trust-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 3px 6px rgba(16, 26, 51, 0.18));
}
.trust-icon svg {
  width: 100%;
  height: 100%;
}
.trust-text {
  font-size: 0.95rem;
  color: var(--text);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.005em;
}
@media (max-width: 780px) {
  .trust-bar { grid-template-columns: 1fr; gap: 18px; }
}

.commission-banner {
  margin-top: 40px;
  border-left: 3px solid var(--accent-3);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: linear-gradient(90deg, rgba(169, 121, 31, 0.08), transparent 70%);
  padding: 28px 32px;
}
.commission-lead {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
}
.commission-text {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 680px;
  margin: 0;
  line-height: 1.55;
}
@media (max-width: 640px) {
  .commission-banner { padding: 22px 20px; }
  .commission-lead { font-size: 1.15rem; }
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 26px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #5b4fd6);
  color: white;
  box-shadow: 0 8px 24px rgba(47, 95, 214, 0.28);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 30px rgba(47, 95, 214, 0.38); }
.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent); }
.btn-block { width: 100%; }

/* ---- How it works ---- */
.section { padding: 64px 0; }
.section h2 {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 40px;
  letter-spacing: -0.01em;
}

/* ---- Problem banner ---- */
.problem-section { padding: 0 0 64px; }
.problem-banner {
  border-left: 3px solid var(--accent-2);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: linear-gradient(90deg, rgba(14, 154, 120, 0.08), transparent 70%);
  padding: 28px 32px;
}
.problem-lead {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
}
.problem-text {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 680px;
  margin: 0;
  line-height: 1.55;
}
@media (max-width: 640px) {
  .problem-banner { padding: 22px 20px; }
  .problem-lead { font-size: 1.15rem; }
}

.how-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}
.how-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}
.how-card h3 { margin: 0 0 10px; font-size: 1.1rem; }
.how-card p { color: var(--text-muted); margin: 0; font-size: 0.95rem; }

/* ---- Forms ---- */
.form-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  max-width: 640px;
  margin: 0 auto;
  box-shadow: var(--shadow);
}
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.form-group textarea { min-height: 100px; resize: vertical; }
.password-field { position: relative; }
.password-field input { padding-right: 44px; }
.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 6px 8px;
  line-height: 1;
  color: var(--text-muted);
}
.password-toggle:hover { color: var(--text); }
.field-hint { font-size: 0.8rem; color: var(--text-muted); margin: -4px 0 8px; }
.form-section-title {
  margin: 32px 0 4px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 1.1rem;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }
.privacy-notice {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 16px;
  text-align: center;
}

/* ---- Results ---- */
.results-grid { display: grid; gap: 18px; margin-top: 24px; }
.result-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.result-card h3 { margin: 0 0 12px; font-size: 1.15rem; }
.result-meta { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 0.92rem; margin-bottom: 14px; }
.result-meta dt { color: var(--text-muted); }
.result-meta dd { margin: 0; }
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

/* ---- Confirmation (results) ---- */
.confirmation-card {
  max-width: 620px;
  margin: 0 auto;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 48px 40px;
}
.confirmation-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 1.6rem;
}
.confirmation-card.is-success .confirmation-icon {
  background: rgba(14, 154, 120, 0.12);
  color: var(--accent-2);
}
.confirmation-card.is-empty .confirmation-icon {
  background: rgba(90, 103, 134, 0.12);
  color: var(--text-muted);
}
.confirmation-card h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  margin: 0 0 14px;
}
.confirmation-card p {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.55;
  margin: 0 0 8px;
}
.confirmation-meta {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}
.next-steps {
  margin-top: 32px;
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

/* ---- Footer ---- */
footer.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  margin-top: 64px;
}
footer.site-footer p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0;
}

/* ---- Admin ---- */
.admin-nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 0; border-bottom: 1px solid var(--border); margin-bottom: 32px;
}
.admin-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}
.admin-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.admin-tab:hover { color: var(--text); }
.admin-tab-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.admin-tab .badge-unread { margin-left: 0; }
table.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.admin-table th, table.admin-table td {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border);
}
table.admin-table th { color: var(--text-muted); font-weight: 600; }
.pending-list { display: grid; gap: 16px; margin-bottom: 36px; }
.pending-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.pending-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 12px; }
.pending-card p { margin: 4px 0; font-size: 0.9rem; }
.pending-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
}
.interpretation-box {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(47, 95, 214, 0.06);
  border: 1px solid rgba(47, 95, 214, 0.18);
}
.interpretation-box p { margin: 4px 0; font-size: 0.88rem; }
.interpretation-label {
  font-weight: 600;
  color: var(--accent);
  font-size: 0.78rem !important;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.note-body { font-size: 0.92rem; line-height: 1.55; }
.note-body p { margin: 6px 0 !important; font-size: 0.92rem !important; }
.note-body .note-title {
  margin: 18px 0 6px; padding: 6px 10px;
  font-size: 0.98rem; font-weight: 700; color: var(--accent);
  background: rgba(47, 95, 214, 0.10); border-left: 4px solid var(--accent); border-radius: 4px;
}
.note-body .note-title:first-child { margin-top: 4px; }
.note-body .note-subtitle { margin: 12px 0 4px; font-size: 0.92rem; font-weight: 700; }
.note-body ul, .note-body ol { margin: 6px 0 6px 20px; padding: 0; }
.note-body li { margin: 4px 0; font-size: 0.92rem; }
.note-body a { color: var(--accent); text-decoration: underline; word-break: break-word; }
.pending-actions { display: flex; gap: 10px; margin-top: 12px; }
.pending-actions .btn { padding: 6px 16px; font-size: 0.85rem; }
tr.row-highlight { background: rgba(14, 154, 120, 0.08); }
tr.row-unread { background: rgba(47, 95, 214, 0.05); }
.unread-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 6px;
}
.badge-unread {
  display: inline-block;
  margin-left: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  vertical-align: middle;
}
.badge-new {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(14, 154, 120, 0.15);
  color: #0e7a5f;
  font-size: 0.75rem;
  font-weight: 600;
}

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  background: rgba(193, 39, 45, 0.08);
  border: 1px solid rgba(193, 39, 45, 0.25);
  color: var(--danger);
  font-size: 0.9rem;
  margin-bottom: 20px;
}
.alert.alert-success {
  background: rgba(14, 154, 120, 0.1);
  border: 1px solid rgba(14, 154, 120, 0.3);
  color: #0e7a5f;
}

/* Pages légales, FAQ, pied de page */
.legal-page .narrow { max-width: 760px; margin: 0 auto; }
.legal-page h1 { margin-bottom: 0.25rem; }
.legal-page h2 { margin-top: 1.75rem; font-size: 1.15rem; }
.legal-page p, .legal-page li { line-height: 1.65; }
.legal-updated { color: #6b7280; font-size: 0.9rem; margin-bottom: 1rem; }
.footer-links, .footer-contact { margin-top: 0.5rem; font-size: 0.9rem; }
.footer-links a, .footer-contact a { color: inherit; text-decoration: underline; }
.checkbox-label { display: flex; gap: 0.6rem; align-items: flex-start; font-weight: 400; line-height: 1.5; }
.checkbox-label input { margin-top: 0.25rem; width: auto; flex: none; }
.results-disclaimer { margin-top: 1rem; font-size: 0.9rem; color: #6b7280; line-height: 1.55; }

/* Tableaux de subventions (admin) */
.table-scroll { overflow-x: auto; margin-bottom: 24px; }
.matches-filter { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 8px 0 12px; }
.matches-filter-select { padding: 6px 10px; border-radius: 8px; border: 1px solid #d1d5db; max-width: 100%; }
.matches-table td { vertical-align: top; }
.match-sub { color: #6b7280; font-size: 0.82rem; }
.match-reasons { margin: 0; padding-left: 18px; color: var(--danger, #b91c1c); font-size: 0.85rem; }
.match-detail td { background: #f9fafb; padding-top: 4px; padding-bottom: 10px; }
.match-detail summary { cursor: pointer; color: #374151; font-size: 0.85rem; }
.nature-tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; background: #e5e7eb; color: #111827; }
.nature-subvention { background: #dcfce7; color: #166534; }
.nature-mixte { background: #fef9c3; color: #854d0e; }
.nature-pret, .nature-garantie, .nature-participation { background: #ffedd5; color: #9a3412; }
.nature-avantage_fiscal, .nature-accompagnement { background: #e0e7ff; color: #3730a3; }

.match-note { margin-top: 4px; font-size: 0.8rem; color: #1e40af; background: #eff6ff; border-radius: 6px; padding: 4px 8px; }

.rel-tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; }
.rel-correspond { background: #dcfce7; color: #166534; }
.rel-peut_etre { background: #fef9c3; color: #854d0e; }
.rel-ne_correspond_pas { background: #fee2e2; color: #991b1b; }


.footer-contact-box { margin: 1.5rem 0 1rem; padding: 1.25rem 1rem; border-radius: var(--radius); background: var(--card); border: 1px solid var(--border); text-align: center; }
footer.site-footer .footer-contact-title { margin: 0 0 0.75rem; font-family: var(--font-heading); font-size: 1.6rem; font-weight: 700; color: var(--text); }
.footer-contact-items { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
.footer-contact-item { display: inline-flex; align-items: center; gap: 0.6rem; padding: 0.7rem 1.1rem; border-radius: 999px; background: var(--accent); color: #fff !important; text-decoration: none !important; font-weight: 600; font-size: 1rem; }
.footer-contact-item:hover { filter: brightness(1.1); }
.footer-contact-wa { background: #25d366; }

/* ---- Mobile ---- */
.lang-switch { display: inline-flex; gap: 4px; }
.lang-switch a { line-height: 1; }
.nav-short { display: none; }
@media (max-width: 640px) {
  .container { padding: 0 18px; }
  .site-header .bar { padding: 12px 18px; }
  .brand { font-size: 1.25rem; white-space: nowrap; }
  .nav-links { gap: 8px; }
  .nav-full { display: none; }
  .nav-short { display: inline; }
  .nav-links > a { white-space: nowrap; font-size: 0.85rem; padding: 7px 12px; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 600; }
  .nav-links > a:hover { color: #fff; filter: brightness(1.1); }
  .lang-switch a { padding: 6px 8px; font-size: 0.78rem; }
  .hero { padding: 48px 0 44px; }
  .checkbox-label { font-weight: 400; font-size: 0.92rem; }
  .checkbox-label input { width: 20px; height: 20px; }
  footer.site-footer { padding: 24px 0; margin-top: 40px; }
  .footer-contact-item { width: 100%; justify-content: center; }
  .footer-contact-items { flex-direction: column; }
}
@media (max-width: 640px) {
  .form-card { padding: 22px 18px; }
}
@media (max-width: 370px) {
  .site-header .bar { padding: 10px 12px; gap: 6px; }
  .brand { font-size: 1.1rem; }
  .nav-links { gap: 6px; }
  .nav-links > a { font-size: 0.75rem; padding: 6px 9px; }
  .lang-switch a { padding: 5px 6px; font-size: 0.72rem; }
}

/* ---- Bibliothèque / prise en charge (admin) ---- */
.mandate-box { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 14px 18px; margin: 0 0 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.mandate-box.mandate-on { border-color: rgba(14, 154, 120, 0.4); background: rgba(14, 154, 120, 0.06); }
.mandate-hint { display: block; margin-top: 4px; color: var(--text-muted); font-size: 0.85rem; }
.library-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0 0 18px; }
.library-stats > div { padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); display: flex; flex-direction: column; }
.library-stats strong { font-size: 1.5rem; }
.library-stats span { color: var(--text-muted); font-size: 0.85rem; }
.library-stats .stat-warn { border-color: rgba(193, 39, 45, 0.35); }
.library-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 16px; }
.library-filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 20px; }
.library-filters input[type=search] { flex: 1 1 260px; }
.library-filters input, .library-filters select { padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); font: inherit; }
.library-box { margin: 12px 0; }
.library-list { list-style: none; padding: 0; margin: 6px 0 0; }
.library-list li { margin: 6px 0; line-height: 1.6; }
.library-meta { max-width: 820px; color: var(--text-muted); font-size: 0.9rem; }
.library-meta form { margin-top: 10px; }
.muted { color: var(--text-muted); }
.tag.validity-en_vigueur { background: rgba(14, 154, 120, 0.12); color: #0e7a5f; }
.tag.validity-modifiee { background: rgba(169, 121, 31, 0.14); color: #7a5712; }
.tag.validity-abrogee, .tag.validity-depassee { background: rgba(193, 39, 45, 0.12); color: var(--danger); }
.tag.validity-a_reverifier, .tag.tag-warn { background: rgba(169, 121, 31, 0.14); color: #7a5712; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; background: var(--bg-elevated); color: var(--text-muted); margin-right: 4px; white-space: nowrap; }
.tag.tag-ok { background: rgba(14, 154, 120, 0.12); color: #0e7a5f; }
.job-box { padding: 14px 18px; margin: 0 0 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.job-box.job-running { border-color: rgba(47, 95, 214, 0.4); background: rgba(47, 95, 214, 0.05); }
.job-bar { height: 8px; border-radius: 999px; background: var(--bg-elevated); margin: 10px 0 6px; overflow: hidden; }
.job-bar span { display: block; height: 100%; background: var(--accent); }
