:root {
  --paper: #F3F4F1;
  --ink: #1E2A28;
  --ink-muted: #566361;
  --accent: #2F5D50;
  --accent-soft: #E4EBE8;
  --gold: #B08D57;
  --line: #D8D6CE;
  --notice-border: #8B4A3D;
  --notice-bg: #F7EFEC;
  --error: #9A3B2E;
  --error-bg: #F7EFEC;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Public Sans', system-ui, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }
footer.site { flex-shrink: 0; }
a { color: inherit; }
.wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 24px;
}
.wrap-header {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 32px;
}
.wrap-narrow {
  max-width: 440px;
  margin: 0 auto;
  padding: 0 24px;
}

header.top { padding: 14px 0 0; }
header.top .wrap-header {
  display: flex; justify-content: space-between; align-items: center; gap: 6px;
  flex-wrap: nowrap;
}
.wordmark { font-family: 'Source Serif 4', serif; font-weight: 600; font-size: 1.05rem; letter-spacing: 0.01em; text-decoration: none; }
.header-right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.nav-auth { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.nav-auth .login-link { font-size: 0.82rem; font-weight: 500; text-decoration: none; color: var(--ink); white-space: nowrap; padding: 6px 3px; }
.nav-auth .login-link:hover { color: var(--accent); }
.btn-sm {
  display: inline-block; padding: 6px 11px; border-radius: 3px; font-size: 0.78rem; font-weight: 500;
  text-decoration: none; background: var(--accent); color: #fff; white-space: nowrap; font-family: inherit;
}
.btn-sm:hover { background: #264c41; }

.icon-btn {
  display: inline-flex; align-items: center; gap: 5px; text-decoration: none; color: var(--ink);
  padding: 5px; border-radius: 4px; position: relative; flex-shrink: 0;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }
.icon-btn svg { flex-shrink: 0; display: block; width: 18px; height: 18px; }
/* Libelle toujours visible (ex. "Mes dossiers", "Archives") - icone + texte, jamais cache */
.icon-btn .icon-label { font-size: 0.78rem; font-weight: 500; white-space: nowrap; text-decoration: none; }
/* Icone seule, sans texte (ex. Accueil) - universellement comprise, pas besoin de libelle */
.icon-btn.icon-only .icon-label { display: none; }
.status-dot {
  position: absolute; bottom: 3px; right: 2px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); border: 1.5px solid var(--paper);
}

.lang-select {
  border: 1px solid var(--line); background: #fff; color: var(--ink-muted); border-radius: 3px;
  padding: 4px 5px; font-family: inherit; font-size: 0.78rem; cursor: pointer; flex-shrink: 0;
}

.nav-dropdown { position: relative; flex-shrink: 0; }
.nav-dropdown summary { list-style: none; cursor: pointer; }
.nav-dropdown summary::-webkit-details-marker { display: none; }
.nav-dropdown[open] > summary { background: var(--accent-soft); color: var(--accent); border-radius: 4px; }
.nav-dropdown-menu {
  position: absolute; top: 100%; left: 0; margin-top: 6px; background: #fff; border: 1px solid var(--line);
  border-radius: 4px; padding: 4px; min-width: 170px; box-shadow: 0 6px 16px rgba(30,42,40,0.1); z-index: 30;
}
.nav-dropdown-menu a {
  display: block; padding: 9px 11px; font-size: 0.85rem; color: var(--ink); text-decoration: none;
  border-radius: 3px; white-space: nowrap;
}
.nav-dropdown-menu a:hover { background: var(--accent-soft); color: var(--accent); }

.hero-logo { display: block; max-width: 220px; width: auto; height: auto; margin: 0 auto 20px; }
[data-i18n].hero-logo { display: none; }
html[data-lang="fr"] .hero-logo[data-i18n="fr"] { display: block; margin: 0 auto 20px; }
html[data-lang="en"] .hero-logo[data-i18n="en"] { display: block; margin: 0 auto 20px; }

.cta-row-compact { display: flex; flex-wrap: nowrap; gap: 8px; align-items: center; }
.cta-row-compact .btn {
  padding: 10px 16px; font-size: 0.88rem; white-space: nowrap; width: auto; flex-shrink: 0;
}

.fab-stack {
  position: fixed; right: 18px; bottom: 22px; display: flex; flex-direction: column; gap: 12px; z-index: 40;
}
.fab {
  width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; font-size: 1.3rem; text-decoration: none; border: none; cursor: pointer;
  box-shadow: 0 4px 14px rgba(30,42,40,0.28); font-family: inherit;
}
.fab:hover { background: #264c41; }
.fab-quick { background: var(--gold); color: #3a2b1a; }
.fab-quick:hover { background: #9c7c48; }

.hero { padding: 96px 0 72px; border-bottom: 1px solid var(--line); }
.hero h1 { font-family: 'Source Serif 4', serif; font-weight: 600; font-size: 2.6rem; line-height: 1.2; margin: 0 0 22px; max-width: 15ch; }
.hero p.lede { font-size: 1.1rem; color: var(--ink-muted); max-width: 46ch; margin: 0 0 36px; }

.form-page { padding: 72px 0 96px; }
.form-page h1 { font-family: 'Source Serif 4', serif; font-weight: 600; font-size: 1.9rem; margin: 0 0 10px; }
.form-page p.lede { color: var(--ink-muted); margin: 0 0 36px; max-width: 40ch; }

.cta-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.btn { display: inline-block; padding: 12px 22px; border-radius: 3px; font-size: 0.98rem; font-weight: 500; text-decoration: none; cursor: pointer; border: 1px solid transparent; font-family: inherit; }
.btn-primary { background: var(--accent); color: #fff; width: 100%; text-align: center; }
.btn-primary:hover { background: #264c41; }
.btn-primary:disabled { background: #9fb3ae; cursor: default; }
.btn-ghost { background: none; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); }
.reassure { font-size: 0.88rem; color: var(--ink-muted); max-width: 44ch; }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 0.9rem; font-weight: 500; margin-bottom: 6px; }
.field .hint { font-size: 0.8rem; color: var(--ink-muted); margin-top: 4px; }
.field input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 3px;
  font-family: inherit; font-size: 1rem; background: #fff; color: var(--ink);
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

.form-msg { font-size: 0.9rem; padding: 12px 14px; border-radius: 3px; margin-bottom: 20px; display: none; }
.form-msg.error { background: var(--error-bg); border-left: 3px solid var(--error); color: #4a3630; display: block; }
.form-msg.success { background: var(--accent-soft); border-left: 3px solid var(--accent); color: var(--ink); display: block; }

.form-footer-link { margin-top: 22px; font-size: 0.92rem; color: var(--ink-muted); }
.form-footer-link a { color: var(--accent); font-weight: 500; text-decoration: none; }
.form-footer-link a:hover { text-decoration: underline; }

.how { padding: 64px 0; border-bottom: 1px solid var(--line); }
.how h2 { font-family: 'Source Serif 4', serif; font-weight: 600; font-size: 1.4rem; margin: 0 0 32px; }
.step { display: flex; gap: 20px; padding: 18px 0; border-top: 1px solid var(--line); }
.step:last-child { padding-bottom: 0; }
.step-num { font-family: 'Source Serif 4', serif; color: var(--gold); font-size: 1.1rem; flex: 0 0 28px; }
.step p { margin: 0; max-width: 52ch; }
.step strong { font-weight: 600; }

.notice { margin: 56px 0; padding: 20px 22px; background: var(--notice-bg); border-left: 3px solid var(--notice-border); border-radius: 2px; font-size: 0.92rem; color: #4a3630; }
.notice strong { display: block; margin-bottom: 6px; color: #3a2b26; }

.case-card { border-top: 1px solid var(--line); padding: 18px 0; }
.case-card:first-child { border-top: none; }
.case-card-grouped { padding-left: 20px; border-left: 2px solid var(--accent-soft); border-top: none; margin-left: 4px; }
.topic-header {
  font-family: 'Source Serif 4', serif; font-weight: 600; color: var(--accent);
  font-size: 0.98rem; margin: 28px 0 4px; padding-top: 18px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
}
.topic-header:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.topic-pdf-link {
  font-family: 'Public Sans', sans-serif; font-weight: 500; font-size: 0.78rem; color: var(--ink-muted);
  text-decoration: none; white-space: nowrap;
}
.topic-pdf-link:hover { color: var(--accent); text-decoration: underline; }
.topic-header-title { display: flex; align-items: baseline; gap: 8px; }
.topic-collapse-btn {
  background: none; border: none; color: var(--accent); cursor: pointer; font-size: 0.8rem;
  padding: 0; font-family: inherit; line-height: 1;
}
.topic-count { font-family: 'Public Sans', sans-serif; font-weight: 400; font-size: 0.78rem; color: var(--ink-muted); }
.notes-collapse-toggle {
  background: none; border: none; color: var(--ink-muted); cursor: pointer; font-size: 0.82rem;
  font-family: inherit; padding: 0; margin-bottom: 8px; display: block;
}
.notes-collapse-toggle:hover { color: var(--accent); }
.case-title { font-weight: 600; font-size: 1.02rem; }
.case-title-row { display: flex; align-items: center; gap: 8px; }
.edit-title-btn {
  background: none; border: none; color: var(--ink-muted); cursor: pointer; font-size: 0.9rem;
  padding: 2px 4px; border-radius: 3px; line-height: 1;
}
.edit-title-btn:hover { color: var(--accent); background: var(--accent-soft); }
.case-title-input {
  font-weight: 600; font-size: 1.02rem; font-family: inherit; border: 1px solid var(--accent);
  border-radius: 3px; padding: 3px 6px; flex: 1; min-width: 0;
}
.case-meta { font-size: 0.85rem; color: var(--ink-muted); margin: 2px 0 8px; }
.case-excerpt { font-size: 0.92rem; color: var(--ink-muted); margin-bottom: 10px; max-width: 60ch; }
.quick-note-toggle { background: none; border: none; color: var(--accent); font-size: 0.85rem; cursor: pointer; padding: 0; font-family: inherit; font-weight: 500; }
.quick-note-toggle:hover { text-decoration: underline; }
.case-actions { display: flex; gap: 18px; margin-bottom: 4px; }
.case-actions .archive-btn { color: var(--ink-muted); }
.case-actions .archive-btn:hover { color: var(--notice-border); }
.quick-badge {
  display: inline-block; font-size: 0.75rem; font-weight: 600; color: var(--gold);
  background: #FBF4E8; border: 1px solid #E8D5AE; border-radius: 3px; padding: 2px 8px; margin-bottom: 8px;
}
.quick-note-box { display: none; margin-top: 10px; max-width: 60ch; }
.quick-note-box textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 3px; font-family: inherit; font-size: 0.92rem; min-height: 70px; }
.case-notes-list { max-width: 60ch; margin-bottom: 10px; }
.case-note { display: flex; gap: 10px; padding: 8px 0 8px 12px; border-left: 2px solid var(--line); font-size: 0.9rem; margin-bottom: 2px; }
.case-note-date { flex-shrink: 0; color: var(--ink-muted); font-size: 0.8rem; white-space: nowrap; padding-top: 1px; }
.case-note-content { color: var(--ink); }

footer.site { padding: 32px 0 64px; font-size: 0.85rem; color: var(--ink-muted); display: flex; justify-content: space-between; }

[data-i18n] { display: none; }
html[data-lang="fr"] [data-i18n="fr"] { display: initial; }
html[data-lang="en"] [data-i18n="en"] { display: initial; }
html[data-lang="fr"] [data-i18n-block="fr"] { display: block; }
html[data-lang="en"] [data-i18n-block="en"] { display: block; }

@media (max-width: 560px) {
  .hero { padding: 64px 0 48px; }
  .hero h1 { font-size: 2.05rem; }
  .form-page { padding: 48px 0 72px; }
  .form-page h1 { font-size: 1.5rem; }
  header.top .wrap-header { padding: 0 20px; }
  .wrap, .wrap-narrow { padding: 0 28px; }
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
