/* ===== Tooleon — feuille de style commune ===== */
:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --ink: #1b1d22;
  --muted: #5f6470;
  --line: #e2e0d8;
  --accent: #0f766e;
  --accent-soft: #e3f2ef;
  --danger: #b42318;
  --ok: #147a3d;
  --code-bg: #fbfaf7;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161a; --surface: #1c1f24; --ink: #e9e7e2; --muted: #9aa0ab;
    --line: #2c3038; --accent: #3fb8a6; --accent-soft: #1d3330; --code-bg: #171a1e;
    --danger: #f2716a; --ok: #4cc47e;
  }
}
:root[data-theme="dark"] {
  --bg: #14161a; --surface: #1c1f24; --ink: #e9e7e2; --muted: #9aa0ab;
  --line: #2c3038; --accent: #3fb8a6; --accent-soft: #1d3330; --code-bg: #171a1e;
  --danger: #f2716a; --ok: #4cc47e;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.6 var(--sans);
}
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }

/* ----- En-tête ----- */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header .wrap { display: flex; align-items: center; gap: 24px; height: 60px; }
.logo { font-weight: 700; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 8px; letter-spacing: -0.01em; }
.logo-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: #fff; display: grid; place-items: center; font: 700 14px var(--mono); }
.nav { display: flex; gap: 18px; margin-left: auto; font-size: 15px; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }
@media (max-width: 640px) { .nav { display: none; } }

/* ----- Mise en page ----- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; padding: 28px 0 48px; }
@media (max-width: 1000px) { .layout { grid-template-columns: minmax(0, 1fr); } .sidebar { display: none; } }

h1 { font-size: clamp(26px, 4vw, 34px); line-height: 1.2; margin: 0 0 8px; letter-spacing: -0.02em; }
h2 { font-size: 21px; margin: 36px 0 10px; letter-spacing: -0.01em; }
h3 { font-size: 17px; margin: 22px 0 6px; }
.lead { color: var(--muted); margin: 0 0 22px; font-size: 17px; }
.breadcrumb { font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.breadcrumb a { color: var(--muted); }

/* ----- Panneau d'outil ----- */
.tool { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar .spacer { flex: 1; }
.panes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .panes { grid-template-columns: 1fr; } }
.pane-label { font-size: 13px; color: var(--muted); margin-bottom: 4px; display: flex; justify-content: space-between; }
textarea.code {
  width: 100%; min-height: 360px; resize: vertical;
  font: 13.5px/1.55 var(--mono); color: var(--ink); background: var(--code-bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 12px; tab-size: 2;
}
textarea.code:focus, input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

button, .btn {
  font: 600 14px var(--sans); border-radius: 8px; padding: 8px 14px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { filter: brightness(1.08); }
select, input[type="number"], input[type="text"] {
  font: 14px var(--sans); padding: 7px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
label.inline { font-size: 14px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.status { font-size: 14px; min-height: 22px; margin-top: 10px; }
.status.err { color: var(--danger); }
.status.ok { color: var(--ok); }

/* ----- Formulaires des calculateurs ----- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.field .hint { font-size: 12.5px; color: var(--muted); }
.field input, .field select { width: 100%; }
.input-unit { position: relative; }
.input-unit input { padding-right: 38px; }
.input-unit span { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 14px; pointer-events: none; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 18px 0; }
.kpi { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: var(--code-bg); }
.kpi .k { font-size: 13px; color: var(--muted); }
.kpi .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.kpi.main { background: var(--accent-soft); border-color: transparent; }
.kpi.main .v { color: var(--accent); }

.chart-wrap { position: relative; height: 300px; margin-top: 8px; }
.chart-wrap canvas { width: 100%; height: 100%; display: block; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

.table-scroll { overflow-x: auto; margin-top: 14px; border: 1px solid var(--line); border-radius: 8px; max-height: 420px; }
table.data { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 7px 12px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th { position: sticky; top: 0; background: var(--surface); font-weight: 600; color: var(--muted); }
table.data th:first-child, table.data td:first-child { text-align: left; }

/* ----- Contenu éditorial (important pour le SEO et AdSense) ----- */
.prose { max-width: 720px; }
.prose p, .prose li { color: var(--ink); }
.prose code { font-family: var(--mono); font-size: 0.92em; background: var(--code-bg); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.faq details { border-bottom: 1px solid var(--line); padding: 10px 0; }
.faq summary { cursor: pointer; font-weight: 600; }

/* ----- Accueil ----- */
.hero { padding: 44px 0 18px; }
.grid-tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin: 18px 0 40px; }
.card { display: block; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card .tag { font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.card h3 { margin: 6px 0 4px; }
.card p { margin: 0; color: var(--muted); font-size: 14.5px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 26px 0 0; }

/* ----- Emplacements publicitaires (non intrusifs) ----- */
/* Hauteur réservée => pas de saut de mise en page (CLS) quand la pub se charge */
.ad-slot { margin: 26px 0; text-align: center; }
.ad-slot .ad-label { display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.ad-slot.inline { min-height: 120px; }
.ad-slot.side { min-height: 600px; position: sticky; top: 20px; margin-top: 0; }
.ad-placeholder { border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: 13px; display: grid; place-items: center; height: 100%; min-height: inherit; }
.ad-slot.empty { display: none; }

.sidebar .box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px; }
.sidebar .box h4 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.sidebar .box ul { list-style: none; margin: 0; padding: 0; }
.sidebar .box li { padding: 4px 0; font-size: 15px; }
.sidebar .box a { text-decoration: none; }

/* ----- Pied de page ----- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); font-size: 14px; color: var(--muted); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 10px 22px; padding-top: 22px; padding-bottom: 22px; }
.site-footer a { color: var(--muted); }
.site-footer .copy { margin-right: auto; }

.theme-toggle { margin-left: 8px; padding: 6px 10px; font-size: 13px; }

.chart-tip { position: absolute; display: none; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 12.5px; line-height: 1.45; padding: 8px 10px; border-radius: 6px; white-space: nowrap; z-index: 2; }
:root { --c-base: #b9b4a6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --c-base: #59606b; } }
:root[data-theme="dark"] { --c-base: #59606b; }

/* ----- Jauge IMC ----- */
.gauge { position: relative; margin: 22px 0 6px; }
.gauge-bar { height: 12px; border-radius: 6px; background: linear-gradient(90deg, #d97706 0%, #d97706 14%, #147a3d 14%, #147a3d 39.6%, #e3a008 39.6%, #e3a008 60%, #c2410c 60%, #c2410c 80%, #b42318 80%); }
.gauge-needle { position: absolute; top: -6px; width: 4px; height: 24px; margin-left: -2px; background: var(--ink); border-radius: 2px; transition: left .25s; }
.gauge-labels { position: relative; height: 18px; font-size: 12px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.gauge-labels span { position: absolute; transform: translateX(-50%); }
.gauge-labels span:first-child { transform: none; }
.gauge-labels span:last-child { transform: translateX(-100%); }
.macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.macros div { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; text-align: center; }
.macros strong { display: block; font-size: 19px; }
.macros span { font-size: 13px; color: var(--muted); }
.note { font-size: 13px; color: var(--muted); }
