/* Identité reprise de la maquette Auto_Pilotage_UIX : papier, marine, teal.
   Polices système en attendant d'héberger Fraunces et Source Sans 3 sur le VPS
   (pas de Google Fonts : l'adresse IP des clients ne part pas chez un tiers). */
:root {
  --ink: #1a2330; --ink-soft: #4a5563;
  --paper: #f4f0e8; --paper-2: #ebe6dc; --white: #fcfbf8; --line: #ddd6c8;
  --navy: #1c3a5a; --navy-2: #163049;
  --teal: #2a7a6e; --teal-soft: #e4f1ee;
  --amber: #9a6418; --amber-soft: #f8edd8;
  --red: #a33a32; --red-soft: #f8e6e4;
  --shadow: 0 1px 0 rgba(28, 58, 90, 0.04), 0 12px 28px rgba(28, 58, 90, 0.06);
  --serif: Fraunces, Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--paper); color: var(--ink); font: 16px/1.5 var(--sans); }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--navy); }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.rail { background: var(--navy-2); color: #d7e2ec; padding: 28px 16px 20px; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; padding: 0 8px 28px; color: #fff; }
.brand.sombre { color: var(--ink); padding: 0 0 20px; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; background: #c9e8e1; color: var(--navy-2);
  display: grid; place-items: center; font: 640 18px var(--serif); }
.brand b { display: block; font-size: 14px; }
.brand small { color: #9bb0c4; font-size: 11px; font-weight: 500; }
.brand.sombre small { color: var(--ink-soft); }
nav { display: grid; gap: 4px; }
nav a { color: #c5d4e2; text-decoration: none; padding: 10px 12px; border-radius: 8px; font-weight: 600; font-size: 14px; }
nav a:hover { background: #234461; color: #fff; }
nav a.active { background: #fff; color: var(--navy-2); }
.rail-foot { margin-top: auto; padding: 16px 10px 0; border-top: 1px solid #2d4d6c; font-size: 13px; }
.rail-foot strong { color: #fff; display: block; }
.lien-discret { background: none; border: 0; padding: 0; color: #9bb0c4; text-decoration: underline; font-size: 13px; }

.stage { min-width: 0; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 28px;
  border-bottom: 1px solid var(--line); background: var(--white); }
.env { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); flex: none; }
.dot.warn { background: var(--amber); }
.pill { border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 4px 10px;
  font-size: 12px; font-weight: 600; color: var(--navy); white-space: nowrap; }

.page { padding: 28px clamp(16px, 3vw, 40px) 48px; max-width: 1280px; }
.page-head h1, .carte-seule h1 { font: 520 clamp(28px, 3vw, 36px)/1.15 var(--serif); letter-spacing: -0.03em; margin: 0 0 6px; }
.lede { margin: 0 0 22px; color: var(--ink-soft); max-width: 62ch; }
.layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.7fr); gap: 18px; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  margin-bottom: 16px; overflow: hidden; }
.card-h { padding: 16px 18px 12px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.card-h h2 { margin: 0; font-size: 15px; font-weight: 700; }
.card-h span { font-size: 12px; color: var(--ink-soft); }
.caption { margin: 0; padding: 12px 18px 16px; font-size: 12px; color: var(--ink-soft); border-top: 1px dashed var(--line); }
.empty { padding: 20px 18px; color: var(--ink-soft); margin: 0; }
.muted { color: var(--ink-soft); }
.rouge { color: var(--red); }

.btn { border: 1px solid var(--line); background: var(--white); border-radius: 8px; padding: 8px 12px;
  font-weight: 600; font-size: 13px; color: var(--ink); white-space: nowrap; text-decoration: none; display: inline-block; }
.btn:hover { border-color: #c4bbaa; }
.btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn.primary:hover { background: #142c44; }
.btn.quiet { background: transparent; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: start; }
.actions-row form { margin: 0; }

.tag { display: inline-flex; align-items: center; border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 700; }
.tag.ok { background: var(--teal-soft); color: var(--teal); }
.tag.warn { background: var(--amber-soft); color: var(--amber); }
.tag.bad { background: var(--red-soft); color: var(--red); }
.tag.neutral { background: var(--paper-2); color: var(--ink-soft); }

.ligne { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 12px 18px; border-top: 1px solid var(--paper-2); color: inherit; text-decoration: none; font-size: 14px; }
.ligne:hover { background: var(--paper); }
.ligne-titre { font-weight: 600; }
.task { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--paper-2); }
.task h3 { margin: 0 0 4px; font-size: 14px; }
.task.done h3 { opacity: 0.55; text-decoration: line-through; }
.meta { font-size: 12px; color: var(--ink-soft); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.jalons { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.health { list-style: none; margin: 0; padding: 4px 18px 16px; }
.health li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--paper-2); font-size: 13px; }
.health li:first-child { border-top: 0; }

.formulaire { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; padding: 12px 18px 16px; align-items: end; }
.formulaire.en-ligne { border-top: 1px solid var(--paper-2); }
label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-soft); }
input, select { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; color: var(--ink); min-width: 0; }
.pile { display: grid; gap: 12px; }

.seul { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.carte-seule { background: var(--white); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  padding: 28px; width: min(460px, 100%); }
.alerte { background: var(--red-soft); color: var(--red); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.note-locale { background: var(--amber-soft); color: var(--amber); border-radius: 8px; padding: 10px 12px; font-size: 13px; }

/* ---- Ma semaine : priorités et indicateurs (maquette UIX) ---- */
.priority-stack { display: grid; gap: 10px; margin-bottom: 14px; }
.priority { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 16px; align-items: center;
  background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); }
.priority.urgent { border-left: 4px solid var(--red); }
.priority.bientot { border-left: 4px solid var(--amber); }
.priority.calme { border-left: 4px solid var(--teal); }
.why { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.why b { display: block; font: 640 22px var(--serif); color: var(--ink); letter-spacing: -0.03em; margin-top: 2px; }
.priority h2 { margin: 0 0 4px; font-size: 16px; font-weight: 700; }
.priority p { margin: 0; color: var(--ink-soft); font-size: 14px; }
.note-discrete { font-size: 12px; color: var(--ink-soft); margin: 0 0 22px; }
.empty.carte { background: var(--white); border: 1px dashed var(--line); border-radius: 12px; }
.kpi-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin: 22px 0; }
.kpi { background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 14px 14px 12px; }
.kpi .lbl { font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.kpi strong { display: block; margin-top: 8px; font: 640 22px var(--serif); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.kpi em { font-style: normal; font-size: 11px; color: var(--ink-soft); }
.kpi .def { margin: 8px 0 0; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 11px; line-height: 1.4; color: var(--ink-soft); }
.kpi.hero { background: var(--navy); color: #fff; border-color: var(--navy); }
.kpi.hero .lbl, .kpi.hero em, .kpi.hero .def { color: #c5d6e6; }
.kpi.hero .def { border-top-color: #3a5a7a; }

/* ---- Météo des dossiers ---- */
.meteo { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 8px; }
.meteo i { width: 8px; height: 8px; border-radius: 50%; }
.meteo.rouge { background: var(--red-soft); color: var(--red); } .meteo.rouge i { background: var(--red); }
.meteo.orange { background: var(--amber-soft); color: var(--amber); } .meteo.orange i { background: var(--amber); }
.meteo.vert { background: var(--teal-soft); color: var(--teal); } .meteo.vert i { background: var(--teal); }
.meteo-ligne { display: grid; gap: 2px; color: inherit; text-decoration: none; width: 100%; }
.meteo-tete { margin: 4px 0 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }

/* ---- Fiche client ---- */
.sommaire { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 18px; }
.sommaire a { border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600;
  color: var(--ink-soft); text-decoration: none; background: var(--white); }
.sommaire a:hover { border-color: var(--navy); color: var(--navy); }
section[id] { scroll-margin-top: 16px; }
.bloc { padding: 14px 18px; border-top: 1px solid var(--paper-2); display: grid; gap: 8px; }
.bloc-h { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.bloc h3 { margin: 0; font-size: 14px; }
.detail { margin: 4px 0 0; font-size: 13px; color: var(--ink-soft); }
.texte { white-space: pre-line; }
.lignes { list-style: none; margin: 0; padding: 0 18px 8px; }
.lignes li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--paper-2);
  font-size: 13px; align-items: center; }
.lignes li:first-child { border-top: 0; }
.bloc .lignes { padding: 0; }
.outils { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
form.inline { display: inline-flex; gap: 4px; align-items: center; margin: 0; }
.etat select { padding: 4px 6px; font-size: 12px; }
.btn.petit { padding: 4px 8px; font-size: 12px; }
.bascule { border: 1px solid var(--line); background: var(--paper); color: var(--ink-soft); border-radius: 999px;
  padding: 2px 10px; font-size: 11px; font-weight: 700; }
.bascule.on { background: var(--teal-soft); color: var(--teal); border-color: #b9dcd5; }
.tag.client { background: #e3ebf3; color: var(--navy); text-decoration: none; }
progress { width: 100%; height: 8px; border: 0; border-radius: 99px; background: var(--paper-2); overflow: hidden; appearance: none; }
progress::-webkit-progress-bar { background: var(--paper-2); border-radius: 99px; }
progress::-webkit-progress-value { background: var(--teal); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--teal); border-radius: 99px; }
details.ajout { border-top: 1px solid var(--paper-2); }
details.ajout summary { padding: 10px 18px; font-size: 13px; font-weight: 600; color: var(--navy); cursor: pointer; }
.bloc details.ajout summary { padding-left: 0; }
.formulaire.large { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.formulaire .plein { grid-column: 1 / -1; }
label.case { display: flex; gap: 6px; align-items: center; font-size: 13px; }
textarea { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; color: var(--ink); font: inherit; resize: vertical; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (max-width: 980px) {
  .priority { grid-template-columns: 1fr; gap: 10px; }
  .lignes li, .bloc-h { flex-direction: column; align-items: flex-start; }
  .outils { justify-content: flex-start; }
  .app { grid-template-columns: 1fr; }
  .rail { height: auto; position: static; padding: 12px 16px; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
  .brand { padding: 0; flex: 1; }
  .brand small, .rail-foot strong { display: none; }
  nav { display: flex; overflow-x: auto; gap: 4px; order: 3; flex-basis: 100%; }
  nav a { white-space: nowrap; }
  .rail-foot { margin: 0; padding: 0; border: 0; }
  .layout { grid-template-columns: 1fr; }
  .top { padding: 12px 16px; }
  .page { padding: 18px 16px 40px; }
  .ligne { grid-template-columns: 1fr; gap: 4px; }
  .task { grid-template-columns: 1fr; }
}

/* Pied de page : mentions et données */
.pied { margin: 28px 0 8px; font-size: 13px; color: var(--ink-soft); text-align: center; }
.pied a { color: inherit; }
.mentions h2 { font: 520 20px/1.3 var(--serif); margin: 22px 0 8px; }
.mentions p, .mentions li { max-width: 68ch; }
