:root {
  color-scheme: light;
  --bg: #f5f6fb;
  --surface: #ffffff;
  --text: #171a2c;
  --muted: #5d6380;
  --border: #e4e6f0;
  --accent: #5b4cf5;
  --accent-2: #ec4899;
  --accent-soft: #efedff;
  --result: #1d1a6b;
  --good: #059669;
  --grad: linear-gradient(120deg, #5b4cf5 0%, #8b5cf6 45%, #ec4899 100%);
  --shadow: 0 1px 2px rgba(23, 26, 44, .04), 0 8px 24px rgba(23, 26, 44, .06);
  --radius: 16px;
  --max: 1040px;

  /* Couleurs des outils */
  --c-blue: #3b82f6;   --c-blue-bg: #e7f0ff;
  --c-violet: #8b5cf6; --c-violet-bg: #f1ebff;
  --c-pink: #ec4899;   --c-pink-bg: #fde8f3;
  --c-orange: #f97316; --c-orange-bg: #ffeedf;
  --c-green: #10b981;  --c-green-bg: #dcfaef;
  --c-teal: #14b8a6;   --c-teal-bg: #d9f8f4;
  --c-amber: #f59e0b;  --c-amber-bg: #fff4d6;
  --c-red: #ef4444;    --c-red-bg: #ffe6e6;
  --c-indigo: #6366f1; --c-indigo-bg: #e8e9ff;
}


* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }

/* ---------- En-tête ---------- */
header.site {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
header.site .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px;
}
.logo {
  display: inline-flex; align-items: center;
  font-weight: 800; font-size: 1.2rem; text-decoration: none; color: var(--text); letter-spacing: -.02em;
}
.logo::before {
  content: "⚡"; display: grid; place-items: center; width: 32px; height: 32px;
  border-radius: 10px; background: var(--grad); font-size: 1rem; margin-right: 8px;
}
.logo span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
nav.main { display: flex; flex-wrap: wrap; gap: 4px; }
nav.main a {
  padding: 6px 12px; border-radius: 999px; text-decoration: none;
  color: var(--muted); font-size: .92rem; font-weight: 600;
}
nav.main a:hover { background: var(--accent-soft); color: var(--accent); }
nav.main a[aria-current="page"] { background: var(--accent); color: #fff; }

/* ---------- Bandeau de page ---------- */
.hero {
  background: var(--grad); color: #fff;
  padding: 44px 0 64px; position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -80px; top: -80px; width: 320px; height: 320px;
  border-radius: 50%; background: rgba(255, 255, 255, .12);
}
.hero h1 { font-size: 2.3rem; line-height: 1.15; margin: 0 0 10px; letter-spacing: -.03em; position: relative; z-index: 1; }
.hero p { margin: 0; max-width: 620px; opacity: .92; font-size: 1.08rem; position: relative; z-index: 1; }
.hero .badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; position: relative; z-index: 1; }
.hero .badges span {
  background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .3);
  padding: 4px 12px; border-radius: 999px; font-size: .85rem; font-weight: 600;
}
.hero + main { margin-top: -44px; padding-top: 0; position: relative; }
.hero + main > .wrap > :first-child { margin-top: 0; }

main { padding: 28px 0 48px; }
h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 8px; letter-spacing: -.02em; }
h2 { font-size: 1.35rem; margin-top: 36px; letter-spacing: -.01em; }
.lead { color: var(--muted); margin-top: 0; font-size: 1.05rem; }

/* Titre coloré des pages outils */
.page-head { display: flex; gap: 16px; align-items: center; margin-bottom: 6px; }
.page-head .ico { flex: none; }
.page-head h1 { margin: 0; }

/* ---------- Grille d'outils ---------- */
.section-title { display: flex; align-items: center; gap: 10px; margin: 36px 0 4px; font-size: 1.1rem; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.cat:first-of-type .section-title { margin-top: 0; }
/* Accueil : la grille ne chevauche plus le bandeau, les titres de catégorie restent lisibles */
.hero + main:has(> #outils), .hero + main:has(> #tools) { margin-top: 0; padding-top: 32px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin-top: 16px; }
.card {
  --c: var(--c-violet); --cbg: var(--c-violet-bg);
  display: block; position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; text-decoration: none; color: var(--text);
  box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s, border-color .18s;
  overflow: hidden;
}
.card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--c); }
.card:hover { transform: translateY(-4px); border-color: var(--c); box-shadow: 0 14px 30px color-mix(in srgb, var(--c) 22%, transparent); }
.card h3 { margin: 12px 0 4px; font-size: 1.05rem; }
.card p { margin: 0; color: var(--muted); font-size: .92rem; }
.card .tag {
  position: absolute; top: 16px; right: 14px; font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--c); background: var(--cbg); padding: 2px 8px; border-radius: 999px;
}
.ico {
  --c: var(--c-violet); --cbg: var(--c-violet-bg);
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px;
  background: var(--cbg); color: var(--c); font-size: 1.5rem;
}
.no-result { text-align: center; color: var(--muted); padding: 20px 0 6px; margin: 0; }
/* Recherche */
.search { margin-top: 22px; max-width: 560px; position: relative; z-index: 1; }
.search input {
  width: 100%; padding: 14px 18px 14px 46px; border-radius: 14px; border: 0; font: inherit; font-size: 1rem;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%235d6380' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='9' cy='9' r='6'/%3E%3Cpath d='m14 14 4 4'/%3E%3C/svg%3E") no-repeat 16px center;
  color: var(--text); box-shadow: 0 8px 24px rgba(23, 26, 44, .18);
}
.search input:focus { outline: 3px solid rgba(255, 255, 255, .55); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hero .badges { margin-top: 16px; }
.no-result { padding-top: 28px; }

/* Palette par outil */
.blue   { --c: var(--c-blue);   --cbg: var(--c-blue-bg); }
.violet { --c: var(--c-violet); --cbg: var(--c-violet-bg); }
.pink   { --c: var(--c-pink);   --cbg: var(--c-pink-bg); }
.orange { --c: var(--c-orange); --cbg: var(--c-orange-bg); }
.green  { --c: var(--c-green);  --cbg: var(--c-green-bg); }
.teal   { --c: var(--c-teal);   --cbg: var(--c-teal-bg); }
.amber  { --c: var(--c-amber);  --cbg: var(--c-amber-bg); }
.red    { --c: var(--c-red);    --cbg: var(--c-red-bg); }
.indigo { --c: var(--c-indigo); --cbg: var(--c-indigo-bg); }

/* ---------- Calculatrice ---------- */
.tool {
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  border-radius: var(--radius); padding: 24px; margin-top: 22px;
}
.tool h2:first-child { margin-top: 0; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; color: var(--muted); }
input, select {
  width: 100%; padding: 11px 14px; font: inherit; font-size: 1rem; font-weight: 600; color: var(--text);
  background: var(--bg); border: 1.5px solid var(--border); border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input[type="range"] { padding: 0; border: 0; background: none; accent-color: var(--accent); box-shadow: none; }

.results {
  margin-top: 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px;
}
.res {
  background: var(--accent-soft); border-radius: 12px; padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 15%, transparent);
}
.res small { display: block; color: var(--muted); font-size: .8rem; font-weight: 600; }
.res strong { font-size: 1.4rem; color: var(--result); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.res.main { background: var(--grad); border: 0; }
.res.main small { color: rgba(255, 255, 255, .85); }
.res.main strong { color: #fff; }
.res.good strong { color: var(--good); }
.note { font-size: .84rem; color: var(--muted); margin-top: 14px; }

/* Graphique */
.chart-box { position: relative; margin-top: 20px; }
.chart-box canvas { width: 100%; height: 300px; display: block; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* Scénarios */
.scenarios { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 16px; }
.scenario {
  border-radius: 14px; padding: 16px; background: var(--cbg); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent);
}
.scenario b { color: var(--c); display: block; font-size: .95rem; }
.scenario .big { font-size: 1.45rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.scenario small { color: var(--muted); }

/* Emplacements publicitaires */
.ad-slot {
  margin: 28px 0; min-height: 100px; display: flex; align-items: center; justify-content: center;
  border: 1.5px dashed var(--border); border-radius: 12px; color: var(--muted); font-size: .8rem;
}
.ad-slot.filled { border: 0; }

/* Contenu rédactionnel */
.content { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 24px 20px; margin-top: 28px; }
.content ul { padding-left: 20px; }
.content li { margin-bottom: 6px; }
.callout {
  border-left: 4px solid var(--c-amber); background: var(--c-amber-bg);
  padding: 12px 16px; border-radius: 0 10px 10px 0; margin: 16px 0;
}

table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: .94rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:hover { background: var(--accent-soft); }
.table-scroll { overflow-x: auto; max-height: 420px; overflow-y: auto; border-radius: 12px; border: 1px solid var(--border); margin-top: 12px; }
.table-scroll table { margin: 0; }
.table-scroll th { position: sticky; top: 0; background: var(--surface); }

/* ---------- Pied de page ---------- */
footer.site { background: #12132a; color: #b9bcd8; padding: 32px 0; font-size: .9rem; margin-top: 20px; }
footer.site a { color: #fff; margin-right: 18px; text-decoration: none; font-weight: 600; }
footer.site a:hover { text-decoration: underline; }
footer.site p { margin: 14px 0 0; }

@media (max-width: 600px) {
  .hero { padding: 32px 0 56px; }
  .hero h1 { font-size: 1.75rem; }
  h1 { font-size: 1.5rem; }
  .tool { padding: 18px; }
  .content { padding: 4px 16px 16px; }
  nav.main a { padding: 5px 10px; font-size: .86rem; }
  .search input { font-size: .95rem; }
}

/* ---------- Partage de simulation ---------- */
.share {
  margin-top: 20px; padding: 18px; border-radius: 14px;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
}
.share b { display: block; margin-bottom: 4px; }
.share > span { color: var(--muted); font-size: .9rem; }
.share-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 999px;
  font: inherit; font-weight: 700; font-size: .95rem; cursor: pointer; border: 0; text-decoration: none;
  background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--border);
}
.btn:hover { box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--accent); }
.btn.primary { background: var(--grad); color: #fff; box-shadow: none; }
.btn.primary:hover { color: #fff; filter: brightness(1.06); }
.shot { margin-top: 16px; display: none; }
.shot.show { display: block; }
.shot img { width: 100%; max-width: 540px; display: block; border-radius: 12px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.shared-banner {
  display: flex; gap: 10px; align-items: center; padding: 12px 16px; margin-bottom: 16px; border-radius: 12px;
  background: var(--c-green-bg); border: 1px solid color-mix(in srgb, var(--c-green) 30%, transparent); font-size: .92rem;
}
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #12132a; color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 600; font-size: .92rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25); transition: opacity .2s, transform .2s; z-index: 50; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- SEO : fil d'Ariane, FAQ, outils liés ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: .85rem; margin-bottom: 10px; position: relative; z-index: 1; opacity: .9; }
.crumbs a { color: #fff; text-decoration: none; font-weight: 600; }
.crumbs a:hover { text-decoration: underline; }
.crumbs span { color: rgba(255, 255, 255, .85); }
.faq details { border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; margin-top: 10px; background: var(--bg); }
.faq summary { font-weight: 700; cursor: pointer; }
.faq details p { margin: 10px 0 0; color: var(--muted); }
.updated { font-size: .8rem; color: var(--muted); margin-top: 16px; }
.related h2 { margin-top: 36px; }

/* ---------- Blocs partenaires (affiliation) ---------- */
.affiliate {
  margin-top: 28px; padding: 20px 24px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  border-top: 4px solid var(--c-green);
}
.aff-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.aff-head h2 { margin: 0; font-size: 1.15rem; }
.aff-badge {
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); border: 1px solid var(--border); padding: 3px 10px; border-radius: 999px;
}
.aff-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 14px; }
.aff-card {
  display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: 12px;
  background: var(--c-green-bg); border: 1px solid color-mix(in srgb, var(--c-green) 25%, transparent);
}
.aff-card p { margin: 0; font-size: .9rem; color: var(--muted); flex: 1; }
.aff-btn {
  align-self: flex-start; margin-top: 6px; padding: 8px 16px; border-radius: 999px;
  background: var(--c-green); color: #fff; font-weight: 700; font-size: .9rem; text-decoration: none;
}
.aff-btn:hover { filter: brightness(1.08); }
.aff-note { font-size: .78rem; color: var(--muted); margin: 12px 0 0; }

/* Emplacements pub masqués tant qu'AdSense n'est pas activé (évite un cadre vide au chargement) */
html:not(.ads-on) .ad-slot { display: none; }

/* ---------- Logo image ---------- */
.logo::before { content: none; display: none; }
.logo img { display: block; height: 34px; width: auto; }
@media (max-width: 600px) { .logo img { height: 28px; } }

/* Bouton « Gérer les cookies » */
.cookie-btn { background: none; border: 0; padding: 0; color: #fff; font: inherit; font-weight: 600; cursor: pointer; margin-right: 18px; }
.cookie-btn:hover { text-decoration: underline; }
.cookie-btn[hidden] { display: none; }
footer.site a, .cookie-btn { display: inline-block; margin-bottom: 6px; }

/* ---------- Vitesse mobile ---------- */
/* Les blocs sous la ligne de flottaison ne sont dessinés qu'à l'approche de l'écran */
.content, .related, .faq { content-visibility: auto; contain-intrinsic-size: auto 600px; }
/* Pas d'animations coûteuses pour qui les a désactivées */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* Feuille d'heures : toute la semaine visible, compacte sur mobile */
.table-scroll.feuille { max-height: none; }
#feuille th, #feuille td { padding: 6px 8px; }
#feuille input { padding: 8px 10px; min-width: 0; }
@media (max-width: 600px) {
  #feuille th, #feuille td { padding: 4px 2px; font-size: .8rem; }
  #feuille input { padding: 6px 4px; font-size: .85rem; }
  #feuille input[type="time"] { width: 66px; text-align: center; }
  #feuille input[type="time"]::-webkit-calendar-picker-indicator { display: none; }
  #feuille input[type="number"] { width: 42px; max-width: 42px !important; }
  #feuille td:first-child { max-width: 54px; overflow: hidden; text-overflow: ellipsis; }
}

/* ---------- Alignement et adaptation à toutes les tailles d'écran ---------- */
/* Champs : le libellé prend la place libre, donc tous les champs d'une ligne sont alignés
   même si un libellé fait deux lignes */
.row > div { display: flex; flex-direction: column; min-width: 0; }
.row > div[hidden] { display: none; }
.row > div > label { flex: 1 0 auto; display: flex; align-items: flex-end; flex-wrap: wrap; column-gap: .25em; line-height: 1.35; }
.row > div > label > * { display: inline; }
input[type="range"] { height: 47px; }
select { text-overflow: ellipsis; }
/* Résultats : taille de texte qui s'adapte, jamais de débordement */
.res { min-width: 0; display: flex; flex-direction: column; justify-content: space-between; }
.res strong { font-size: clamp(1.1rem, .95rem + .9vw, 1.4rem); line-height: 1.25; overflow-wrap: anywhere; }
.res small { line-height: 1.35; margin-bottom: 4px; }
/* Tableaux : défilement horizontal propre s'ils sont trop larges */
@media (max-width: 600px) {
  .wrap { padding: 0 14px; }
  .row { gap: 12px; }
  .results { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
  .res { padding: 12px; }
  .res.main { grid-column: 1 / -1; }
  th, td { padding: 8px 6px; font-size: .85rem; }
  th { font-size: .72rem; letter-spacing: .02em; }
  .content { padding: 4px 14px 16px; }
  .content h2 { font-size: 1.2rem; }
  .hero h1, h1 { font-size: clamp(1.4rem, 1.1rem + 2vw, 1.75rem); overflow-wrap: break-word; }
  .hero p { font-size: 1rem; }
  .card { padding: 16px; }
  .card h3 { font-size: 1rem; }
  /* tableaux de texte trop larges : défilement horizontal dans leur bloc */
  .content > table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .content > table > tbody { display: table; width: 100%; }
}
/* Même hauteur pour tous les champs (texte, nombre, date, liste) : alignement parfait */
input:not([type="range"]):not([type="checkbox"]):not([type="radio"]), select { height: 48px; line-height: 1.2; }
#feuille input { height: 40px; }

/* Choix de la langue (drapeaux dans l'en-tête) */
nav.main .lang { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; }
nav.main .lang a { padding: 5px; line-height: 0; border-radius: 6px; opacity: .5; }
nav.main .lang a:hover { opacity: 1; background: var(--accent-soft); }
nav.main .lang a[aria-current="true"] { opacity: 1; background: var(--accent-soft); }
nav.main .lang img { width: 24px; height: 16px; object-fit: cover; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0,0,0,.12); display: block; }
@media (max-width: 600px) {
  header.site .wrap { position: relative; }
  nav.main .lang { position: absolute; right: 16px; top: 12px; margin: 0; }
}
