/* =========================================================================
   Prospection éditoriale · TS Infographie
   Fond ivoire, navigation anthracite, accent bordeaux.
   ========================================================================= */

@font-face { font-family: 'Source Serif 4'; src: url('fonts/source-serif-4-latin-opsz-normal.woff2') format('woff2'); font-weight: 200 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Source Serif 4'; src: url('fonts/source-serif-4-latin-opsz-italic.woff2') format('woff2'); font-weight: 200 900; font-style: italic; font-display: swap; }
@font-face { font-family: 'Source Sans 3'; src: url('fonts/source-sans-3-latin-wght-normal.woff2') format('woff2'); font-weight: 200 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Source Sans 3'; src: url('fonts/source-sans-3-latin-wght-italic.woff2') format('woff2'); font-weight: 200 900; font-style: italic; font-display: swap; }

:root {
  --paper: #F6F2EB;
  --paper-2: #EFE9DF;
  --card: #FFFDFA;
  --ink: #1F1D1B;
  --ink-2: #45403A;
  --muted: #7A7168;
  --rule: #E6DFD4;
  --rule-2: #D5CBBC;
  --nav: #1C1A19;
  --nav-2: #292624;
  --nav-3: #35312E;
  --nav-ink: #EEE8DF;
  --nav-muted: #9C9389;
  --bordeaux: #7A1F2B;
  --bordeaux-deep: #5C1620;
  --bordeaux-soft: #F5E8E7;
  --bordeaux-line: #E7C9C8;
  --green: #2E6A4E;
  --green-soft: #E5EFE8;
  --amber: #8A5B0E;
  --amber-soft: #F7EDDA;
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --sans: 'Source Sans 3', -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(40, 30, 20, .05), 0 8px 24px -12px rgba(40, 30, 20, .12);
  --nav-w: 260px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.55 var(--sans);
  font-feature-settings: 'kern', 'liga';
  -webkit-font-smoothing: antialiased;
}
a { color: var(--bordeaux); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--bordeaux-deep); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--bordeaux); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Structure ---------- */
.shell { display: grid; grid-template-columns: var(--nav-w) 1fr; min-height: 100vh; }
.main { min-width: 0; }
.view { max-width: 1320px; margin: 0 auto; padding: 44px 56px 96px; }

/* ---------- Navigation ---------- */
.nav {
  position: sticky; top: 0; height: 100vh;
  background: var(--nav); color: var(--nav-ink);
  display: flex; flex-direction: column;
  padding: 28px 18px 22px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 28px; border-bottom: 1px solid var(--nav-3); margin-bottom: 18px; }
.monogram {
  width: 42px; height: 42px; flex: none; border-radius: 8px;
  background: var(--bordeaux); color: #fff;
  display: grid; place-items: center;
  font: 600 17px/1 var(--serif); letter-spacing: .02em;
}
.brand-name { font: 600 17px/1.2 var(--serif); letter-spacing: .005em; }
.brand-sub { font-size: 12.5px; color: var(--nav-muted); letter-spacing: .08em; text-transform: uppercase; margin-top: 3px; }
.nav-links { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px;
  color: var(--nav-ink); text-decoration: none; font-size: 16px;
  transition: background .15s;
}
.nav-link svg { width: 19px; height: 19px; flex: none; opacity: .75; }
.nav-link:hover { background: var(--nav-2); color: #fff; }
.nav-link.active { background: var(--nav-3); color: #fff; }
.nav-link.active svg { opacity: 1; color: #E9B9BD; }
.nav-count { margin-left: auto; font-size: 13px; color: var(--nav-muted); font-variant-numeric: tabular-nums; }
.nav-dot { width: 7px; height: 7px; border-radius: 50%; background: #E0848C; margin-left: 6px; }
.nav-foot { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }
.btn-launch {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; padding: 12px 14px; border: 0; border-radius: 9px;
  background: var(--bordeaux); color: #fff; font-weight: 600; font-size: 15.5px; cursor: pointer;
  transition: background .15s;
}
.btn-launch:hover { background: #8E2735; }
.btn-launch:disabled { background: var(--nav-3); color: var(--nav-muted); cursor: default; }
.btn-launch svg { width: 17px; height: 17px; }
.hermes-state { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border-radius: 9px; background: var(--nav-2); font-size: 13.5px; line-height: 1.35; color: var(--nav-muted); }
.hermes-state strong { display: block; color: var(--nav-ink); font-weight: 600; font-size: 14px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; margin-top: 4px; background: #8C857C; }
.dot.ok { background: #6FBF93; box-shadow: 0 0 0 3px rgba(111, 191, 147, .18); }
.dot.warn { background: #E2B45A; }
.dot.err { background: #E07A7F; }
.dot.run { background: #E9B9BD; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.topbar { display: none; }

/* ---------- Typographie ---------- */
.kicker { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--bordeaux); font-weight: 600; }
.h-display { font: 500 46px/1.08 var(--serif); letter-spacing: -.012em; margin: 10px 0 10px; font-variation-settings: 'opsz' 60; }
.h-section { font: 600 23px/1.2 var(--serif); margin: 0; letter-spacing: -.005em; }
.lede { font-size: 18.5px; color: var(--ink-2); margin: 0; max-width: 72ch; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 48px 0 18px; padding-bottom: 12px; border-bottom: 1px solid var(--rule-2); }
.section-head .h-section + .muted { font-size: 15px; }

/* ---------- Boutons, champs ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--rule-2);
  background: var(--card); color: var(--ink); font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: border-color .15s, background .15s;
}
.btn:hover { border-color: var(--ink-2); color: var(--ink); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--bordeaux); border-color: var(--bordeaux); color: #fff; }
.btn-primary:hover { background: #8E2735; border-color: #8E2735; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--bordeaux); padding-left: 6px; padding-right: 6px; }
.btn-ghost:hover { border-color: transparent; color: var(--bordeaux-deep); text-decoration: underline; }
.btn-danger { color: var(--bordeaux); }
.btn:disabled { opacity: .5; cursor: default; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--rule-2);
  background: #fff; font-size: 16px; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--bordeaux); box-shadow: 0 0 0 3px rgba(122, 31, 43, .12); }
.textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%237A7168' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }

/* ---------- Pastilles ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-prospecter { background: var(--green-soft); color: var(--green); }
.pill-verifier { background: var(--amber-soft); color: var(--amber); }
.pill-exclure, .pill-excl { background: var(--bordeaux-soft); color: var(--bordeaux); }
.pill-inconnu { background: var(--paper-2); color: var(--muted); }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 6px; font-size: 12.5px; font-weight: 600; border: 1px solid var(--rule-2); color: var(--ink-2); background: var(--card); white-space: nowrap; }
.tag-prio { border-color: var(--bordeaux-line); color: var(--bordeaux); background: var(--bordeaux-soft); }
.tag-dup { border-style: dashed; }

/* ---------- En-tête du rapport ---------- */
.masthead { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end; }
.masthead-meta { font-size: 15px; color: var(--muted); margin-top: 14px; }
.sectors { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.sectors .tag { font-weight: 500; }

.notice { display: flex; gap: 14px; padding: 16px 20px; border-radius: var(--radius); margin: 28px 0 0; border: 1px solid; font-size: 16px; line-height: 1.5; }
.notice svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.notice strong { font-weight: 700; }
.notice-warn { background: var(--amber-soft); border-color: #EBD7B3; color: #5E3E09; }
.notice-ok { background: var(--green-soft); border-color: #CADFD1; color: #1F4B37; }
.notice-info { background: var(--card); border-color: var(--rule-2); color: var(--ink-2); }
.notice-run { background: var(--bordeaux-soft); border-color: var(--bordeaux-line); color: var(--bordeaux-deep); align-items: center; }
.notice-err { background: #FBEDEC; border-color: #EBC5C3; color: #6D1B22; }

/* ---------- Chiffres ---------- */
.stats { display: grid; grid-template-columns: repeat(6, 1fr); margin-top: 28px; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); }
.stat { padding: 18px 20px 16px; border-left: 1px solid var(--rule); min-width: 0; }
.stat:first-child { border-left: 0; }
.stat-label { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.stat-value { font: 500 36px/1.1 var(--serif); margin-top: 6px; font-variant-numeric: lining-nums tabular-nums; }
.stat-value small { font-size: 19px; color: var(--muted); }
.stat-value.text { font: 600 18px/1.25 var(--sans); margin-top: 10px; }
.stat-sub { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.stat-hermes { display: flex; align-items: center; gap: 8px; }
.stat-hermes .dot { margin-top: 0; }

/* ---------- Priorités ---------- */
.priorities { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.prio {
  display: grid; grid-template-columns: auto 1fr; gap: 14px; text-align: left;
  padding: 18px 20px; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.prio:hover { border-color: var(--bordeaux-line); transform: translateY(-1px); }
.prio-rank { width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--bordeaux); color: var(--bordeaux); display: grid; place-items: center; font: 600 17px/1 var(--serif); }
.prio-name { font: 600 19px/1.25 var(--serif); }
.prio-note { font-size: 14.5px; color: var(--ink-2); margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Barre d'outils ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 22px; }
.search { position: relative; flex: 1 1 260px; max-width: 360px; }
.search svg { position: absolute; left: 12px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-left: 38px; }
.segmented { display: inline-flex; flex-wrap: wrap; background: var(--paper-2); border-radius: 9px; padding: 3px; gap: 2px; }
.segmented button { border: 0; background: transparent; padding: 7px 13px; border-radius: 7px; font-size: 14.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.segmented button .n { color: var(--muted); font-weight: 500; margin-left: 4px; font-variant-numeric: tabular-nums; }
.segmented button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.toolbar .spacer { flex: 1; }
.toolbar .select { width: auto; min-width: 200px; max-width: 320px; }

/* ---------- Cartes ---------- */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 24px 18px; transition: border-color .15s;
}
.card:hover { border-color: var(--rule-2); }
.card.is-retained { border-color: var(--bordeaux-line); box-shadow: inset 3px 0 0 var(--bordeaux), var(--shadow); }
.card.is-excluded { opacity: .6; }
.card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-right: 110px; }
.retain { position: absolute; top: 18px; right: 18px; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; user-select: none; padding: 4px 8px; border-radius: 7px; }
.retain:hover { background: var(--paper); }
.retain input { position: absolute; opacity: 0; pointer-events: none; }
.check { width: 20px; height: 20px; border-radius: 5px; border: 1.5px solid var(--rule-2); background: #fff; display: grid; place-items: center; transition: all .15s; }
.check svg { width: 13px; height: 13px; color: #fff; opacity: 0; }
.retain input:checked + .check { background: var(--bordeaux); border-color: var(--bordeaux); }
.retain input:checked + .check svg { opacity: 1; }
.retain input:focus-visible + .check { outline: 2px solid var(--bordeaux); outline-offset: 2px; }
.card-name { font: 600 25px/1.18 var(--serif); margin: 14px 0 4px; letter-spacing: -.005em; }
.card-name button { all: unset; cursor: pointer; }
.card-name button:hover { color: var(--bordeaux); }
.card-cat { font-size: 16px; color: var(--ink-2); font-style: italic; }
.card-place { font-size: 14.5px; color: var(--muted); margin-top: 3px; }
.card-block { margin-top: 16px; }
.card-label { font-size: 12.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.card-text { font-size: 15.5px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.card-angle { font: italic 400 16.5px/1.5 var(--serif); color: var(--ink); border-left: 2px solid var(--bordeaux-line); padding-left: 12px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 18px; }
.card-foot-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
.card-foot-meta span { display: inline-flex; align-items: center; gap: 5px; }
.card-foot-meta svg { width: 14px; height: 14px; }
.card-spacer { flex: 1; min-height: 4px; }

.hidden-note { margin-top: 18px; font-size: 15px; color: var(--muted); }

.empty { padding: 56px 24px; text-align: center; border: 1px dashed var(--rule-2); border-radius: var(--radius); color: var(--muted); background: rgba(255, 253, 250, .5); }
.empty .h-section { color: var(--ink); margin-bottom: 8px; }

/* ---------- Rapport intégral ---------- */
details.full-report { margin-top: 40px; border-top: 1px solid var(--rule-2); padding-top: 18px; }
details.full-report > summary { cursor: pointer; font: 600 19px/1.3 var(--serif); list-style: none; display: flex; align-items: center; gap: 10px; }
details.full-report > summary::-webkit-details-marker { display: none; }
details.full-report > summary::before { content: '›'; font-size: 24px; color: var(--bordeaux); transition: transform .2s; display: inline-block; width: 14px; }
details.full-report[open] > summary::before { transform: rotate(90deg); }
.full-report .prose { margin-top: 18px; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 28px 34px; }

/* ---------- Texte Hermes ---------- */
.prose { font-size: 16.5px; line-height: 1.6; color: var(--ink); overflow-wrap: anywhere; }
.prose p { margin: 0 0 6px; }
.prose p:last-child { margin-bottom: 0; }
.prose .para { margin-bottom: 12px; }
.prose ul, .prose ol { margin: 4px 0 12px; padding-left: 22px; }
.prose li { margin: 3px 0; }
.prose li::marker { color: var(--bordeaux); }
.prose h1, .prose h2, .prose h3, .prose h4 { font-family: var(--serif); margin: 22px 0 8px; line-height: 1.25; }
.prose h1 { font-size: 26px; }
.prose h2 { font-size: 22px; }
.prose h3 { font-size: 18.5px; }
.prose h4 { font-size: 16.5px; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 18px 0; }
.prose blockquote { margin: 8px 0; padding-left: 14px; border-left: 2px solid var(--rule-2); color: var(--ink-2); font-style: italic; }
.prose code { font-size: .92em; background: var(--paper-2); padding: 1px 5px; border-radius: 4px; }
.prose table { width: 100%; border-collapse: collapse; margin: 10px 0 16px; font-size: 15px; }
.prose th, .prose td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.prose th { font-size: 13px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); border-bottom-color: var(--rule-2); }
.prose a { word-break: break-word; }
.table-wrap { overflow-x: auto; }

/* ---------- Fiche (panneau) ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(28, 26, 25, .38); z-index: 40; animation: fade .18s ease-out; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41;
  width: min(1120px, calc(100vw - 120px)); background: var(--paper);
  box-shadow: -20px 0 60px -20px rgba(0, 0, 0, .35);
  display: flex; flex-direction: column; animation: slide .22s ease-out;
}
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.drawer-head { padding: 26px 44px 20px; background: var(--card); border-bottom: 1px solid var(--rule); }
.drawer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.drawer-bar .left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.icon-btn { width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--rule-2); background: var(--card); display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { border-color: var(--ink-2); }
.icon-btn svg { width: 18px; height: 18px; }
.fiche-name { font: 500 38px/1.1 var(--serif); margin: 0; letter-spacing: -.01em; }
.fiche-sub { font-size: 17px; color: var(--ink-2); margin-top: 6px; }
.fiche-sub em { font-family: var(--serif); }
.fiche-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 18px; }
.fiche-actions .select { width: auto; min-width: 210px; }
.fiche-actions .input[type=date] { width: auto; }
.drawer-body { flex: 1; overflow-y: auto; padding: 30px 44px 80px; }
.fiche-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 36px; align-items: start; }
.fiche-side { position: sticky; top: 0; display: flex; flex-direction: column; gap: 16px; }
.panel { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px 20px; }
.panel-title { font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 0 0 10px; }
.kv { display: grid; grid-template-columns: 1fr; gap: 0; margin: 0; }
.kv dt { font-size: 13px; color: var(--muted); font-weight: 600; }
.kv dd { margin: 1px 0 12px; font-size: 15.5px; overflow-wrap: anywhere; }
.kv dd:last-child { margin-bottom: 0; }
.contact-line { display: flex; align-items: center; gap: 8px; font-size: 15.5px; padding: 5px 0; overflow-wrap: anywhere; }
.contact-line svg { width: 15px; height: 15px; flex: none; color: var(--muted); }
.budget-state { font-weight: 700; }
.budget-lines { font-size: 14.5px; color: var(--ink-2); margin-top: 6px; }
.saved-flag { font-size: 13px; color: var(--green); margin-left: 8px; opacity: 0; transition: opacity .3s; }
.saved-flag.on { opacity: 1; }

.fsec { padding: 22px 0 20px; border-bottom: 1px solid var(--rule); }
.fsec:first-child { padding-top: 0; }
.fsec-title { font: 600 14px/1.3 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--bordeaux); margin: 0 0 10px; }
.fsec.decision { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 20px 22px; margin: 22px 0; }
.fsec.decision .fsec-title { display: flex; align-items: center; gap: 10px; }
.fsec.angle .prose { font: italic 400 19px/1.55 var(--serif); }
.sources ol { margin: 0; padding-left: 24px; }
.sources li { margin: 6px 0; overflow-wrap: anywhere; }
.sources .host { font-size: 13.5px; color: var(--muted); margin-left: 6px; }
.missing { font-size: 14.5px; color: var(--muted); margin-top: 20px; }

/* ---------- Historique ---------- */
.month { font: 600 14px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 36px 0 12px; }
.hist { display: grid; grid-template-columns: 84px 1fr auto; gap: 22px; align-items: center; padding: 18px 22px; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: 10px; text-decoration: none; color: inherit; transition: border-color .15s; }
.hist:hover { border-color: var(--bordeaux-line); color: inherit; }
.hist-date { text-align: center; border-right: 1px solid var(--rule); padding-right: 18px; }
.hist-day { font: 500 34px/1 var(--serif); }
.hist-wd { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-top: 4px; }
.hist-title { font: 600 19px/1.3 var(--serif); }
.hist-names { font-size: 14.5px; color: var(--muted); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hist-count { text-align: right; font-size: 14.5px; color: var(--ink-2); white-space: nowrap; }
.hist-count strong { font: 500 26px/1 var(--serif); display: block; color: var(--ink); }
.hist-badges { display: flex; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }

/* ---------- Suivi ---------- */
.trow { display: grid; grid-template-columns: 30px minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; padding: 20px 22px; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: 12px; }
.trow.due { box-shadow: inset 3px 0 0 var(--amber); }
.trow-name { font: 600 21px/1.25 var(--serif); }
.trow-name button { all: unset; cursor: pointer; }
.trow-name button:hover { color: var(--bordeaux); }
.trow-meta { font-size: 14.5px; color: var(--muted); margin-top: 3px; }
.trow-contacts { font-size: 14.5px; margin-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.trow-controls { display: grid; grid-template-columns: 1fr 170px; gap: 10px; align-content: start; }
.trow-controls .textarea { grid-column: 1 / -1; min-height: 70px; font-size: 15px; }
.trow-check { padding-top: 4px; }
.trow-check .retain { position: static; padding: 0; }
.due-label { color: var(--amber); font-weight: 700; }

/* ---------- Exclusions, réglages ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.card-plain { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 24px 26px; box-shadow: var(--shadow); }
.xrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: start; padding: 18px 22px; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: 10px; }
.xrow-name { font: 600 19px/1.3 var(--serif); }
.xrow-detail { font-size: 15px; color: var(--ink-2); margin-top: 6px; }
.xrow-meta { font-size: 13.5px; color: var(--muted); margin-top: 6px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.settings-grid .full { grid-column: 1 / -1; }
.dropzone { border: 1.5px dashed var(--rule-2); border-radius: var(--radius); padding: 26px; text-align: center; color: var(--muted); cursor: pointer; transition: all .15s; background: var(--paper); }
.dropzone.over, .dropzone:hover { border-color: var(--bordeaux); color: var(--bordeaux); background: var(--bordeaux-soft); }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

/* ---------- Fenêtre modale ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; background: rgba(28, 26, 25, .45); animation: fade .15s ease-out; }
.modal { width: min(640px, 100%); max-height: calc(100vh - 48px); overflow-y: auto; background: var(--card); border-radius: 14px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .45); padding: 30px 32px 26px; }
.modal h2 { font: 500 28px/1.2 var(--serif); margin: 0 0 6px; }
.choice { display: grid; grid-template-columns: auto 1fr; gap: 14px; padding: 16px 18px; border: 1.5px solid var(--rule-2); border-radius: 10px; cursor: pointer; margin-top: 12px; transition: border-color .15s, background .15s; }
.choice:has(input:checked) { border-color: var(--bordeaux); background: var(--bordeaux-soft); }
.choice input { margin-top: 5px; accent-color: var(--bordeaux); width: 17px; height: 17px; }
.choice strong { font-size: 17px; }
.choice p { margin: 3px 0 0; font-size: 15px; color: var(--ink-2); }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

/* ---------- Messages ---------- */
.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--nav); color: var(--nav-ink); padding: 12px 18px; border-radius: 10px; font-size: 15px; box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .5); pointer-events: auto; animation: rise .2s ease-out; display: flex; gap: 14px; align-items: center; }
.toast button { background: none; border: 0; color: #F0B9BE; font-weight: 700; cursor: pointer; padding: 0; }
.toast.err { background: #6D1B22; color: #fff; }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }

/* ---------- Connexion ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--nav); }
.login-card { width: min(420px, 100%); background: var(--card); border-radius: 16px; padding: 38px 36px 32px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6); }
.login-card .monogram { margin-bottom: 22px; width: 50px; height: 50px; font-size: 20px; }
.login-card h1 { font: 500 30px/1.15 var(--serif); margin: 0 0 4px; }
.login-card form { display: flex; flex-direction: column; gap: 16px; margin-top: 26px; }
.login-error { color: var(--bordeaux); font-size: 15px; min-height: 1.4em; }

.loading { padding: 80px 0; text-align: center; color: var(--muted); }

/* ---------- Écrans intermédiaires ---------- */
@media (max-width: 1280px) {
  .view { padding: 36px 36px 90px; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stat:nth-child(4) { border-left: 0; }
  .stat:nth-child(n+4) { border-top: 1px solid var(--rule); }
}
@media (max-width: 1100px) {
  .cards { grid-template-columns: 1fr; }
  .fiche-grid { grid-template-columns: 1fr; }
  .fiche-side { position: static; }
  .drawer { width: calc(100vw - 60px); }
}

/* ---------- Téléphone ---------- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .shell { display: block; }
  .nav {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 30;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); flex-direction: row;
    border-top: 1px solid var(--nav-3);
  }
  .brand, .nav-foot { display: none; }
  .nav-links { flex-direction: row; width: 100%; justify-content: space-around; }
  .nav-link { flex-direction: column; gap: 3px; padding: 6px 4px; font-size: 11px; flex: 1; text-align: center; position: relative; }
  .nav-link svg { width: 21px; height: 21px; }
  .nav-count { display: none; }
  .nav-dot { position: absolute; top: 5px; right: calc(50% - 16px); margin: 0; }
  .topbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20;
    background: var(--nav); color: var(--nav-ink); padding: 10px 14px calc(10px);
    padding-top: calc(10px + env(safe-area-inset-top));
  }
  .topbar .monogram { width: 34px; height: 34px; font-size: 14px; border-radius: 7px; }
  .topbar-title { font: 600 16px/1.2 var(--serif); flex: 1; }
  .topbar .dot { margin: 0; }
  .topbar .btn-launch { width: auto; padding: 8px 12px; font-size: 14px; }
  .view { padding: 22px 16px 110px; }
  .h-display { font-size: 32px; }
  .masthead { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat { padding: 14px 16px; }
  .stat:nth-child(odd) { border-left: 0; }
  .stat:nth-child(4) { border-left: 1px solid var(--rule); }
  .stat:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .stat-value { font-size: 30px; }
  .priorities { grid-template-columns: 1fr; }
  .toolbar .select, .search { max-width: none; flex: 1 1 100%; }
  .segmented { overflow-x: auto; flex-wrap: nowrap; max-width: 100%; }
  .card { padding: 18px 18px 16px; }
  .card-top { padding-right: 96px; }
  .card-name { font-size: 22px; }
  .drawer { width: 100vw; }
  .drawer-head { padding: 16px 16px 16px; padding-top: calc(16px + env(safe-area-inset-top)); }
  .drawer-body { padding: 20px 16px 90px; }
  .fiche-name { font-size: 28px; }
  .fiche-actions .select, .fiche-actions .input[type=date] { flex: 1 1 100%; }
  .hist { grid-template-columns: 58px 1fr; padding: 14px 16px; gap: 14px; }
  .hist-count { grid-column: 2; text-align: left; }
  .hist-count strong { display: inline; font-size: 18px; margin-right: 4px; }
  .trow { grid-template-columns: 26px minmax(0, 1fr); padding: 16px; }
  .trow-controls { grid-column: 1 / -1; grid-template-columns: 1fr; }
  .form-grid, .settings-grid { grid-template-columns: 1fr; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 4px; margin-top: 36px; }
  .modal { padding: 24px 20px 20px; }
  .full-report .prose { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
