:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --ink: #1f2933;
  --muted: #647084;
  --primary: #1d4ed8;
  --primary-dark: #1e40af;
  --ok: #15803d;
  --warn: #b45309;
  --danger: #b91c1c;
  --border: #e2e8f0;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
header.site {
  background: #0f172a;
  color: #fff;
  padding: .8rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
header.site a { color: #e2e8f0; }
header.site .brand { font-weight: 700; font-size: 1.05rem; }
header.site nav a { margin-left: 1rem; font-size: .92rem; }
.container { max-width: 920px; margin: 1.5rem auto; padding: 0 1.2rem; }
.container.wide { max-width: 1200px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.2rem;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
h1 { font-size: 1.5rem; margin: 0 0 .3rem; }
h2 { font-size: 1.15rem; margin: 0 0 .8rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* Formulaires */
label { display: block; font-weight: 600; margin: .8rem 0 .25rem; font-size: .92rem; }
input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=file], textarea, select {
  width: 100%;
  padding: .55rem .65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .95rem;
  font-family: inherit;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--primary);
  border-color: var(--primary);
}
.helptext { color: var(--muted); font-size: .82rem; margin-top: .2rem; }
.errorlist { color: var(--danger); list-style: none; padding: 0; margin: .3rem 0; font-size: .85rem; }
.field { margin-bottom: .4rem; }

/* Boutons */
.btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: .6rem 1.1rem;
  border-radius: 8px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn.secondary { background: #e2e8f0; color: var(--ink); }
.btn.ghost { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.2rem; }

/* Progression */
.progress { background: #e2e8f0; border-radius: 999px; height: 9px; overflow: hidden; margin: .6rem 0 1rem; }
.progress > span { display: block; height: 100%; background: var(--primary); }
.steps { display: flex; gap: .4rem; flex-wrap: wrap; list-style: none; padding: 0; margin: 0 0 1rem; }
.steps li { font-size: .82rem; padding: .25rem .6rem; border-radius: 999px; background: #eef2f7; color: var(--muted); }
.steps li.active { background: var(--primary); color: #fff; }
.steps li.done { background: #dcfce7; color: var(--ok); }

/* Badges de statut */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.badge.draft { background: #f1f5f9; color: #475569; }
.badge.submitted { background: #dbeafe; color: #1e40af; }
.badge.under_review { background: #fef9c3; color: #854d0e; }
.badge.incomplete { background: #fee2e2; color: #991b1b; }
.badge.validated { background: #dcfce7; color: #166534; }
.badge.archived { background: #e5e7eb; color: #374151; }

/* Tableaux */
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
tr:hover td { background: #f8fafc; }

/* Messages */
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.messages li { padding: .7rem 1rem; border-radius: 8px; margin-bottom: .5rem; }
.messages li.success { background: #dcfce7; color: #166534; }
.messages li.error { background: #fee2e2; color: #991b1b; }
.messages li.info, .messages li.warning { background: #fef9c3; color: #854d0e; }

.doc-item { border: 1px solid var(--border); border-radius: 8px; padding: 1rem; margin-bottom: 1rem; }
.na-fields { margin-top: .6rem; padding-left: 1rem; border-left: 3px solid var(--border); }
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem; }
.toolbar .grow { flex: 1; min-width: 200px; }
footer.site { text-align: center; color: var(--muted); font-size: .82rem; padding: 2rem 1rem; }
