:root {
  --bg: #f6f4ef;
  --card: #ffffff;
  --ink: #1f2a24;
  --muted: #6b736e;
  --line: #e3dfd6;
  --accent: #e8a317;
  --accent-ink: #5a3d00;
  --green: #2f7d4f;
  --green-bg: #e6f2ea;
  --red: #b3412e;
  --red-bg: #f8e7e3;
  --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 15px; line-height: 1.45; }
a { color: var(--green); }
h1 { font-size: 1.5rem; margin: 0 0 4px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
.muted { color: var(--muted); }
.center { text-align: center; }
[hidden] { display: none !important; }

/* Barre du haut */
.topbar {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 12px 24px; background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); text-decoration: none; }
.sun { width: 16px; height: 16px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px #f8e4b5; }
#nav { display: flex; gap: 4px; flex: 1; }
#nav a { padding: 6px 12px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 500; }
#nav a.on, #nav a:hover { background: var(--bg); color: var(--ink); }
.who { display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 0.9rem; }

main { max-width: 1180px; margin: 0 auto; padding: 28px 24px 60px; }

/* Cartes et formulaires */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 18px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--muted); font-weight: 500; }
input, select, textarea {
  font: inherit; color: var(--ink); padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
input[disabled], select[disabled], textarea[disabled] { background: var(--bg); color: var(--muted); }
textarea { min-height: 70px; resize: vertical; }
.check { flex-direction: row; align-items: center; gap: 8px; }
.check input { width: auto; }

button, .btn {
  font: inherit; font-weight: 600; border: 0; border-radius: 8px; padding: 9px 16px; cursor: pointer;
  background: var(--ink); color: #fff; text-decoration: none; display: inline-block;
}
button.secondary { background: var(--bg); color: var(--ink); border: 1px solid var(--line); }
button.danger { background: var(--red-bg); color: var(--red); }
button.link { background: none; color: var(--green); padding: 0; font-weight: 500; }
button[disabled] { opacity: 0.5; cursor: wait; }
.actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; align-items: center; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }

/* Page de connexion */
.login { max-width: 400px; margin: 8vh auto; }
.login .brand { justify-content: center; font-size: 1.3rem; margin-bottom: 24px; }
.login form { display: flex; flex-direction: column; gap: 14px; }

/* Tableau des dossiers */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filters input { max-width: 280px; }
.filters select { max-width: 240px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); font-weight: 600; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #fbf8f1; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 0.8rem; font-weight: 600; background: var(--bg); }
.pill.done { background: var(--green-bg); color: var(--green); }
.pill.warn { background: #fdf1d6; color: var(--accent-ink); }
.pill.off { background: #eee; color: var(--muted); }

/* Suivi d'étapes (espace client) */
.steps { list-style: none; padding: 0; margin: 0; }
.steps li { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; color: var(--muted); }
.steps li .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; font-size: 12px; }
.steps li.done { color: var(--ink); }
.steps li.done .dot { background: var(--green); border-color: var(--green); color: #fff; }
.steps li.now { color: var(--ink); font-weight: 600; }
.steps li.now .dot { border-color: var(--accent); background: #fdf1d6; }

.alert { padding: 12px 14px; border-radius: 8px; background: #fdf1d6; color: var(--accent-ink); margin-bottom: 16px; }
.alert.ok { background: var(--green-bg); color: var(--green); }
.alert.err { background: var(--red-bg); color: var(--red); }

.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: center; }
.list li:last-child { border-bottom: 0; }
.list small { color: var(--muted); }
.private { border-color: #e8c7c0; background: #fffaf9; }
.private h2::after { content: " · visible par toi seul"; font-weight: 400; color: var(--red); font-size: 0.85rem; }

.kit { border: 2px solid var(--accent); background: #fffbf0; }
.kit.done { border-color: var(--green); background: var(--green-bg); }
.kit ol { margin: 0 0 4px; padding-left: 20px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 10; }
.toast.err { background: var(--red); }

@media (max-width: 640px) {
  .topbar { padding: 10px 16px; gap: 10px; }
  main { padding: 20px 16px 40px; }
  .who span { display: none; }
}
