/* moncalculargent.fr - design system "financial-trust"
   Palette: Papier #F7F8FA, Marine #0F2A44, Emeraude #1F9D6E, Ciel #E7ECF2
   Fonts: Inter (titres + corps), chiffres en tabular-nums */

:root {
  --papier: #F7F8FA;
  --marine: #0F2A44;
  --marine-soft: #284867;
  --emeraude: #1F9D6E;
  --emeraude-soft: #E4F5EC;
  --rouge: #C0392B;
  --ambre: #B45309;
  --ciel: #E7ECF2;
  --white: #FFFFFF;
  --grey: #65758A;
  --radius: 14px;
  --max-w: 760px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--papier);
  color: var(--marine);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background-image:
    linear-gradient(var(--ciel) 1px, transparent 1px);
  background-size: 100% 44px;
  background-attachment: local;
}

h1, h2, h3 { font-family: 'Inter', sans-serif; font-weight: 800; color: var(--marine); margin: 0; letter-spacing: -0.01em; }
.tabular, .result-number, .result-card .num, td.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

a { color: var(--emeraude); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; display: block; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header { border-bottom: 1px solid var(--ciel); padding: 18px 0; background: var(--white); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; color: var(--marine); }
.logo:hover { text-decoration: none; }
.logo .mark { width: 32px; height: 32px; flex-shrink: 0; }

.nav-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.nav-pills a { color: var(--grey); font-size: 14px; font-weight: 500; padding: 8px 14px; border-radius: 999px; min-height: 40px; display: flex; align-items: center; }
.nav-pills a:hover { background: var(--ciel); text-decoration: none; color: var(--marine); }

@media (max-width: 760px) {
  .site-header .container { flex-direction: column; align-items: flex-start; gap: 10px; }
  .nav-pills { flex-wrap: nowrap; overflow-x: auto; width: 100%; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
  .nav-pills a { flex: 0 0 auto; white-space: nowrap; }
}

/* Breadcrumb */
.breadcrumb { font-size: 13px; color: var(--grey); padding: 16px 0 0; }
.breadcrumb a { color: var(--grey); }
.breadcrumb a:hover { color: var(--emeraude); }

main { padding-bottom: 60px; }

.hero { padding: 28px 0 8px; text-align: center; }
.hero h1 { font-size: clamp(22px, 4.5vw, 34px); max-width: 760px; margin: 0 auto 10px; line-height: 1.25; }
.hero .hero-sub { color: var(--grey); max-width: 620px; margin: 0 auto 24px; font-size: 15px; }

.category-tag {
  display: inline-block;
  background: var(--emeraude-soft);
  color: var(--emeraude);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}

/* Formulaire calculateur */
.calc-card {
  background: var(--white);
  border: 1px solid var(--ciel);
  border-radius: var(--radius);
  padding: 28px 22px;
  max-width: var(--max-w);
  margin: 0 auto;
  text-align: left;
  box-shadow: 0 1px 2px rgba(15,42,68,.04);
}
.calc-card.wide { max-width: 880px; }

.calc-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid var(--ciel); padding-bottom: 0; }
.calc-tab {
  border: none; background: transparent; cursor: pointer; font-family: inherit;
  font-size: 13.5px; font-weight: 700; color: var(--grey); padding: 10px 14px;
  border-bottom: 2px solid transparent; min-height: 40px;
}
.calc-tab.active { color: var(--marine); border-bottom-color: var(--emeraude); }
.calc-panel { display: none; }
.calc-panel.active { display: block; }

.calc-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.calc-field { flex: 1 1 200px; }
.calc-field label { display: block; font-size: 13px; font-weight: 600; color: var(--marine); margin-bottom: 6px; }
.calc-field input[type="date"],
.calc-field input[type="number"],
.calc-field input[type="text"],
.calc-field select {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--ciel);
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
  color: var(--marine);
  background: var(--papier);
}
.calc-field input:focus, .calc-field select:focus { outline: 2px solid var(--emeraude); outline-offset: 1px; }
.calc-field .hint { font-size: 12px; color: var(--grey); margin-top: 4px; }

.calc-check { display: flex; align-items: center; gap: 8px; margin: 10px 0 18px; font-size: 14px; color: var(--grey); }
.calc-check input { width: 20px; height: 20px; }

.radio-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 18px; }
.radio-row label {
  display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600;
  background: var(--papier); border: 1px solid var(--ciel); border-radius: 999px;
  padding: 8px 14px; cursor: pointer; min-height: 40px;
}
.radio-row input { accent-color: var(--emeraude); }
.radio-row input:checked + span { color: var(--marine); }

.calc-btn {
  width: 100%;
  min-height: 48px;
  background: var(--marine);
  color: var(--white);
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
.calc-btn:hover { background: #163A5C; }
.calc-btn:focus-visible { outline: 2px solid var(--emeraude); outline-offset: 2px; }

/* Receipt-style result card */
.result-card {
  margin-top: 20px;
  background: var(--marine);
  color: var(--white);
  border-radius: 12px;
  padding: 24px 22px;
  text-align: center;
}
.result-number { font-size: clamp(40px, 10vw, 64px); line-height: 1; color: var(--white); font-weight: 800; }
.result-number.positive { color: #6FE3B4; }
.result-label { font-size: 14px; color: #B9C7D6; margin-top: 4px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.result-sub { font-size: 13px; color: #B9C7D6; margin-top: 8px; }

.receipt {
  margin-top: 16px;
  background: var(--white);
  color: var(--marine);
  border-radius: 10px;
  padding: 16px 18px;
  text-align: left;
}
.receipt-row { display: flex; justify-content: space-between; align-items: baseline; padding: 7px 0; border-bottom: 1px dashed var(--ciel); font-size: 14px; gap: 12px; }
.receipt-row:last-child { border-bottom: none; }
.receipt-row .label { color: var(--grey); }
.receipt-row .value { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.receipt-row.total { border-top: 2px solid var(--marine); margin-top: 6px; padding-top: 10px; font-size: 16px; }
.receipt-row.total .value { color: var(--emeraude); }

/* Layout content+aside */
.layout { display: flex; flex-wrap: wrap; gap: 32px; margin-top: 40px; }
.content { flex: 999 1 560px; min-width: 0; }
.aside { flex: 1 1 300px; min-width: 0; }

/* Ad slot */
.ad-slot { background: var(--ciel); border: 1px dashed #C7D3E3; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: var(--grey); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.ad-slot[data-size="300x250"] { width: 300px; height: 250px; max-width: 100%; }
.ad-slot[data-size="320x100"] { width: 320px; height: 100px; max-width: 100%; }

/* Table générique */
.data-table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 14px; }
.data-table th, .data-table td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--ciel); }
.data-table th { color: var(--grey); font-weight: 700; font-size: 12px; text-transform: uppercase; background: var(--ciel); position: sticky; top: 0; }
.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

.section-title { font-size: 19px; margin-bottom: 14px; }

details { border-bottom: 1px solid var(--ciel); padding: 14px 0; }
details summary { cursor: pointer; font-weight: 600; list-style: none; min-height: 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: '+'; color: var(--emeraude); font-size: 20px; flex-shrink: 0; }
details[open] summary::after { content: '−'; }
details p { color: var(--grey); margin: 10px 0 0; }

.site-footer { border-top: 1px solid var(--ciel); padding: 28px 0; color: var(--grey); font-size: 13px; text-align: center; background: var(--white); }
.site-footer .source { margin-top: 4px; }
.site-footer .disclaimer { margin-top: 10px; max-width: 700px; margin-left: auto; margin-right: auto; font-size: 12px; }

.legal-content h2 { font-size: 18px; margin-top: 28px; margin-bottom: 10px; }
.legal-content p, .legal-content li { color: var(--grey); font-size: 15px; line-height: 1.7; }
.legal-content ul { padding-left: 20px; }

.callout {
  background: var(--emeraude-soft);
  border-left: 3px solid var(--emeraude);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 20px 0;
  font-size: 14px;
  color: var(--marine);
}
.callout.warn { background: #FBEFE4; border-left-color: var(--ambre); }
.callout strong { color: var(--emeraude); }
.callout.warn strong { color: var(--ambre); }

.error-list { margin: 14px 0 0; padding-left: 20px; color: var(--marine); font-size: 14.5px; line-height: 1.6; }
.error-list li { margin-bottom: 10px; }
.error-list strong { color: var(--emeraude); }

.example-box {
  background: var(--papier);
  border: 1px solid var(--ciel);
  border-radius: 10px;
  padding: 16px 18px;
  margin: 18px 0;
  font-size: 14.5px;
}
.example-box h3 { font-size: 14px; margin-bottom: 8px; }

/* Home: search + grid */
.search-box { max-width: var(--max-w); margin: 28px auto 0; }
.search-box input {
  width: 100%;
  box-sizing: border-box;
  padding: 13px 18px;
  border: 1px solid var(--ciel);
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  background: var(--white);
  color: var(--marine);
}
.search-box input:focus { outline: 2px solid var(--emeraude); outline-offset: 1px; }
.no-results { color: var(--grey); margin-top: 16px; text-align: center; }

.filter-pills { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 18px 0 0; }
.filter-pill {
  border: 1px solid var(--ciel);
  background: var(--white);
  color: var(--marine);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  min-height: 38px;
}
.filter-pill.active, .filter-pill:hover { background: var(--marine); color: var(--white); border-color: var(--marine); }

.hub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 16px; }
.tool-card {
  background: var(--white);
  border: 1px solid var(--ciel);
  border-radius: 14px;
  padding: 20px;
  min-height: 48px;
  display: block;
}
.tool-card:hover { border-color: var(--emeraude); text-decoration: none; }
.tool-card .name { font-size: 15px; font-weight: 700; color: var(--marine); }
.tool-card .desc { font-size: 13px; color: var(--grey); margin-top: 6px; }
.category-heading { font-size: 20px; margin-top: 44px; color: var(--marine); display: flex; align-items: center; gap: 10px; }
.category-heading .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--emeraude); flex-shrink: 0; }

.home-feature {
  background: var(--white);
  border: 1px solid var(--ciel);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  margin: 0 auto 10px;
  max-width: var(--max-w);
}
.home-feature-label { font-size: 13px; color: var(--grey); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; margin-top: 6px; }

.related-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.related-links a {
  background: var(--papier); border: 1px solid var(--ciel); border-radius: 999px;
  padding: 8px 14px; font-size: 13px; font-weight: 600; color: var(--marine);
}
.related-links a:hover { background: var(--emeraude-soft); border-color: var(--emeraude); text-decoration: none; }

/* ---------- Cookie consent banner ---------- */
#cookie-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 999;
  background: #0F2A44; color: #F7F8FA; padding: 16px 20px;
  box-shadow: 0 -2px 16px rgba(0,0,0,.25);
}
.cookie-banner-inner { max-width: 1080px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.cookie-banner-inner p { margin: 0; font-size: 14px; line-height: 1.5; max-width: 640px; }
.cookie-banner-inner a { color: #F7F8FA; text-decoration: underline; }
.cookie-banner-actions { display: flex; gap: 10px; flex-shrink: 0; }
.cookie-btn { min-height: 44px; padding: 0 20px; border-radius: 999px; font-size: 14px; font-weight: 700; font-family: inherit; cursor: pointer; border: 1px solid #F7F8FA; }
.cookie-btn-reject { background: transparent; color: #F7F8FA; }
.cookie-btn-accept { background: var(--emeraude); color: #fff; border-color: var(--emeraude); }
.cookie-btn:hover { opacity: .88; }

@media (max-width: 640px) {
  .cookie-banner-inner { flex-direction: column; align-items: stretch; }
  .cookie-banner-actions { width: 100%; }
  .cookie-btn { flex: 1; }
}

a:focus-visible, summary:focus-visible, button:focus-visible { outline: 2px solid var(--emeraude); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Dark mode ---------- */
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.theme-toggle {
  width: 40px; height: 40px; min-height: 40px; border-radius: 999px;
  border: 1px solid var(--ciel); background: var(--white); color: var(--marine);
  display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; padding: 0;
}
.theme-toggle:hover { background: var(--ciel); }
.theme-toggle svg { width: 19px; height: 19px; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

:root[data-theme="dark"] {
  --papier: #0D1016;
  --marine: #EAF0F7;
  --marine-soft: #B9C7D6;
  --emeraude: #37C98C;
  --emeraude-soft: #16281F;
  --ambre: #F0A85B;
  --ciel: #1C222C;
  --white: #151A22;
  --grey: #93A2B6;
}
:root[data-theme="dark"] body { background-image: linear-gradient(var(--ciel) 1px, transparent 1px); }
:root[data-theme="dark"] .result-card { background: #0A1A2A; }
:root[data-theme="dark"] .receipt { background: #151A22; }
:root[data-theme="dark"] .ad-slot { border-color: #2C313D; }
:root[data-theme="dark"] .calc-card,
:root[data-theme="dark"] .data-table td,
:root[data-theme="dark"] .data-table th,
:root[data-theme="dark"] details,
:root[data-theme="dark"] .site-header,
:root[data-theme="dark"] .site-footer { border-color: #2C313D; }
:root[data-theme="dark"] .tool-card { background: #151A22; }
