/* Recall — Console d'enquête. Identité teal / ardoise, données en mono. */

:root {
  --bg: #eef2f4;
  --bg-glow: radial-gradient(1200px 480px at 12% -10%, rgba(15, 118, 110, 0.12), transparent 55%),
    radial-gradient(900px 420px at 100% 0%, rgba(15, 23, 42, 0.06), transparent 50%);
  --surface: #ffffff;
  --surface-2: #f4f7f8;
  --elev: #ffffff;
  --line: #d8e0e4;
  --line-strong: #b9c5cc;
  --text: #0f172a;
  --muted: #5b6b76;
  --faint: #8a9aa5;
  --accent: #0f766e;
  --accent-2: #0d9488;
  --accent-bg: rgba(15, 118, 110, 0.1);
  --accent-line: rgba(15, 118, 110, 0.35);
  --ok: #15803d;
  --ok-bg: rgba(21, 128, 61, 0.1);
  --warn: #c2410c;
  --warn-bg: rgba(194, 65, 12, 0.11);
  --danger: #be123c;
  --danger-bg: rgba(190, 18, 60, 0.1);
  --violet: #0e7490;
  --violet-bg: rgba(14, 116, 144, 0.1);
  --radius: 12px;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
  --sans: "Source Sans 3", "Segoe UI", Helvetica, Arial, sans-serif;
  --display: "Outfit", "Source Sans 3", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  background-image: var(--bg-glow);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.lbl {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* Topbar ------------------------------------------------------------ */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
}
.brand {
  display: flex; align-items: center; gap: 11px; color: inherit;
}
.brand:hover { color: inherit; }
.brand-mark { color: var(--accent); display: inline-flex; line-height: 0; }
.brand-mark svg { display: block; filter: drop-shadow(0 2px 6px rgba(15, 118, 110, 0.28)); }
.brand-text { display: flex; flex-direction: column; gap: 1px; line-height: 1.15; }
.brand-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.03em;
}
.brand-tag {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 500;
}
.spacer { flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface-2); font-size: 12.5px;
}
.chip .k { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.chip .k.ok { background: var(--ok); }
.chip .k.bad { background: var(--danger); }
.linkbtn {
  position: relative; background: none; border: none; color: var(--muted); cursor: pointer;
  font: inherit; padding: 6px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius); transition: color 140ms ease-out, background-color 140ms ease-out;
}
.linkbtn:hover { color: var(--text); background: var(--surface-2); }
.linkbtn:active { transform: scale(0.94); }
.linkbtn::after { content: ""; position: absolute; inset: -8px; }

main { max-width: 980px; margin: 0 auto; padding: 22px 20px 72px; width: 100%; }
.view { display: none; }
.view.active { display: block; animation: viewIn 180ms ease-out; }

@media (prefers-reduced-motion: reduce) {
  *, .view.active, .modal, .modal-bg { animation: none !important; }
  .btn:active, .linkbtn:active { transform: none; }
}

h2.title {
  font-family: var(--display);
  font-size: 22px; font-weight: 600; margin: 4px 0 2px;
  letter-spacing: -0.02em; text-wrap: balance;
}
.sub { color: var(--muted); font-size: 13.5px; margin: 0 0 16px; text-wrap: pretty; }
.list-row .t { text-wrap: pretty; }

/* Cards / KPI ------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 12px 28px rgba(15, 23, 42, 0.045);
}
.card + .card { margin-top: 14px; }
.grid-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 13px 15px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.kpi .lbl { color: var(--accent); }
.kpi .v {
  font-family: var(--display);
  font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px;
  letter-spacing: -0.02em;
}
.kpi .v.ok { color: var(--ok); } .kpi .v.warn { color: var(--warn); } .kpi .v.danger { color: var(--danger); }

/* Pills ------------------------------------------------------------- */
.pill {
  font-family: var(--mono); font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 20px;
  white-space: nowrap; display: inline-block; box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}
.pill.CONFIRME { background: var(--ok-bg); color: var(--ok); }
.pill.DECOUVERT { background: var(--warn-bg); color: var(--warn); }
.pill.NON_VERIFIABLE { background: var(--surface-2); color: var(--muted); }
.pill.DECES { background: var(--danger-bg); color: var(--danger); }
.pill.INDIVISION { background: var(--accent-bg); color: var(--accent); }
.pill.LISTE_ROUGE { background: var(--danger-bg); color: var(--danger); }
.pill.ERROR { background: var(--danger-bg); color: var(--danger); }
.pill.queued { background: var(--surface-2); color: var(--muted); }
.pill.running { background: var(--accent-bg); color: var(--accent); }
.pill.done { background: var(--ok-bg); color: var(--ok); }
.pill.resumable { background: var(--warn-bg); color: var(--warn); }
.pill.eta {
  background: var(--surface-2); color: var(--text);
  display: inline-flex; align-items: center; gap: 5px;
}

/* Buttons ----------------------------------------------------------- */
.btn {
  font: inherit; font-size: 13.5px; padding: 9px 15px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  cursor: pointer; display: inline-flex; gap: 7px; align-items: center; min-height: 40px;
  transition-property: transform, background-color, box-shadow, border-color, filter;
  transition-duration: 140ms; transition-timing-function: ease-out;
}
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-bg); }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12), 0 6px 16px rgba(15, 118, 110, 0.28);
}
.btn-primary:hover { background: var(--accent-2); filter: none; }
.btn-lg { min-height: 46px; padding: 11px 20px; font-size: 14.5px; border-radius: 14px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.launch-row { margin-top: 18px; }

.btn-reco {
  background: var(--accent-bg); border-color: var(--accent-line); color: var(--accent);
  font-weight: 600; border-radius: 999px; padding: 7px 13px; min-height: 36px;
}
.btn-reco[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.25);
}
.btn-reco[aria-pressed="false"] {
  background: var(--surface); color: var(--muted); border-color: var(--line);
}

body.mode-reco .adv-only { display: none !important; }
body.mode-reco #sec-new { max-width: 640px; }
body.mode-reco .home-sec + .home-sec { border-top: none; padding-top: 18px; }
body:not(.mode-reco) #advToggle { display: none !important; }

/* Forms ------------------------------------------------------------- */
label.f { display: block; margin-bottom: 4px; }
input[type="text"], input[type="email"], input[type="number"], select {
  width: 100%; padding: 10px 12px; background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--text); font: inherit; font-size: 14px;
}
input:focus, select:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-bg); }
.check { display: flex; gap: 9px; align-items: center; font-size: 13.5px; cursor: pointer; }
.check input { width: auto; }
.check.locked { cursor: default; opacity: 0.92; color: var(--muted); }
.check.locked input { cursor: not-allowed; }
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg button { font: inherit; font-size: 13px; padding: 8px 14px; background: var(--surface); color: var(--muted); border: none; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent-bg); color: var(--accent); font-weight: 600; }

/* Dropzone ---------------------------------------------------------- */
.dropzone {
  border: 1.5px dashed var(--line-strong); border-radius: 16px; padding: 34px 22px; text-align: center;
  color: var(--muted); cursor: pointer; transition: border-color .14s, background .14s, transform .14s;
  background: rgba(255,255,255,0.55);
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--accent-line); background: var(--accent-bg); color: var(--text);
}
.dropzone .dz-title { margin: .55rem 0 0; font-weight: 600; color: var(--text); }
.dropzone .ic { color: var(--accent); }

/* Tables ------------------------------------------------------------ */
.tablewrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); }
table.data td { padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: none; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover td { background: var(--surface-2); }

/* Progress ---------------------------------------------------------- */
.bar { height: 9px; background: var(--surface-2); border-radius: 20px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 20px; transition: width .3s; }

.legend { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.legend .pill { cursor: pointer; opacity: 0.55; transition: opacity .12s; }
.legend .pill.on, .legend .pill:hover { opacity: 1; }

.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--line); }
.list-row:first-child { border-top: none; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .grow .t { font-size: 14px; font-weight: 600; }

.eta-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--accent-bg); color: var(--accent);
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  border: 1px solid var(--accent-line);
}
.eta-chip[hidden] { display: none !important; }

/* Modal ------------------------------------------------------------- */
.modal-bg {
  position: fixed; inset: 0; z-index: 200; background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
  animation: fadeIn 140ms ease-out;
}
.modal {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  max-width: 640px; width: 100%; max-height: 80vh; overflow: auto; padding: 20px 22px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14), 0 2px 6px rgba(15, 23, 42, 0.08);
  animation: popIn 160ms cubic-bezier(0.2, 0.7, 0.3, 1);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(6px) scale(0.99); } to { opacity: 1; transform: none; } }
@keyframes viewIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.modal pre { white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* Toast ------------------------------------------------------------- */
#toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(8px);
  background: var(--elev); border: 1px solid var(--line-strong); border-radius: 12px;
  padding: 11px 16px; font-size: 13px; z-index: 300; box-shadow: 0 12px 32px rgba(15,23,42,.18);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { border-color: var(--danger); color: var(--danger); }

.home-sec { margin-top: 30px; }
.home-sec:first-child { margin-top: 4px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 0 12px; flex-wrap: wrap; }
.section-head h2 {
  font-family: var(--display);
  font-size: 18px; font-weight: 600; margin: 0;
  display: inline-flex; align-items: center; gap: 10px;
  letter-spacing: -0.02em; text-wrap: balance;
}
.section-head h2 .ic {
  width: 32px; height: 32px; padding: 7px; box-sizing: border-box;
  background: var(--accent-bg); color: var(--accent); border-radius: 10px;
  border: 1px solid var(--accent-line);
}
.home-sec + .home-sec { border-top: 1px solid var(--line); padding-top: 26px; }
.back {
  background: none; border: none; color: var(--muted); font: inherit; font-size: 13px;
  cursor: pointer; display: inline-flex; gap: 6px; align-items: center; padding: 6px 0; margin-bottom: 6px;
}
.back:hover { color: var(--text); }
.empty { text-align: center; color: var(--muted); padding: 34px 10px; }
.spin { animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
  .topbar { padding: 10px 14px; gap: 8px; }
  .brand-tag { display: none; }
  .btn-reco span { display: none; }
  .opt-grid { grid-template-columns: 1fr; }
  main { padding: 16px 14px 56px; }
}
