:root {
  --navy: #023D79;
  --navy-dark: #0D2B4E;
  --teal: #14B2CF;
  --teal-soft: #E3F6FA;
  --bg: #F4F7FA;
  --card: #FFFFFF;
  --line: #DCE4EC;
  --text: #16263A;
  --muted: #5F7184;
  --ok: #1E8E5A;
  --ok-soft: #E4F5EC;
  --warn: #B46A00;
  --warn-soft: #FFF2DC;
  --bad: #C0392B;
  --bad-soft: #FBE7E4;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  line-height: 1.55;
}
h1, h2 { font-family: 'Poppins', system-ui, sans-serif; color: var(--navy-dark); margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; font-weight: 600; }
h2 { font-size: 1.15rem; font-weight: 600; }
a { color: var(--navy); }
.muted { color: var(--muted); }
small { color: var(--muted); font-weight: 400; }

/* Barre du haut */
.topbar {
  display: flex; align-items: center; gap: 2rem;
  background: var(--navy-dark); color: #fff;
  padding: .75rem 1.5rem;
}
.brand { display: flex; align-items: center; gap: .65rem; font-family: 'Poppins', sans-serif; font-weight: 600; }
.brand-mark {
  display: inline-grid; place-items: center; width: 2rem; height: 2rem;
  background: var(--teal); color: var(--navy-dark); border-radius: 6px; font-weight: 700; font-size: .9rem;
}
.topbar nav { display: flex; gap: .25rem; flex: 1; }
.topbar nav a {
  color: #C9D8E8; text-decoration: none; padding: .4rem .8rem; border-radius: 6px; font-weight: 500; font-size: .95rem;
}
.topbar nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.topbar nav a.active { background: rgba(20,178,207,.18); color: #fff; }
.who { font-size: .9rem; color: #C9D8E8; }
.who a { color: #fff; margin-left: .75rem; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 1.5rem; display: grid; gap: 1.25rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem 1.5rem; }

/* Formulaires */
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin: 1rem 0; align-items: end; }
label { display: grid; gap: .3rem; font-weight: 500; font-size: .92rem; }
input, select {
  font: inherit; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); width: 100%;
}
input:focus, select:focus, .drop:focus-visible, .btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--teal); outline-offset: 2px;
}
.btn {
  font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--navy);
  padding: .55rem 1rem; border-radius: 8px; text-decoration: none; display: inline-block; white-space: nowrap;
}
.btn:hover { border-color: var(--navy); }
.btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn.primary:hover { background: var(--navy-dark); }
.btn.small { padding: .3rem .65rem; font-size: .82rem; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
form.inline { display: inline-flex; gap: .4rem; align-items: center; margin-right: .5rem; }
form.inline input { width: 11rem; padding: .3rem .5rem; font-size: .85rem; }

/* Zone de dépôt */
.drop {
  display: grid; justify-items: center; gap: .2rem; padding: 2rem 1rem;
  border: 2px dashed #9FB6CC; border-radius: var(--radius); background: #F8FBFD; cursor: pointer; text-align: center;
  transition: border-color .15s, background .15s;
}
.drop strong { font-family: 'Poppins', sans-serif; color: var(--navy); font-weight: 600; }
.drop span { color: var(--muted); font-size: .92rem; }
.drop:hover, .drop.over { border-color: var(--teal); background: var(--teal-soft); }
.drop.disabled { opacity: .5; pointer-events: none; }

.upload-panel { margin-top: 1rem; padding: 1rem 1.1rem; background: var(--teal-soft); border-radius: var(--radius); }
.up-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.bar { height: 8px; background: #fff; border-radius: 99px; overflow: hidden; margin: .6rem 0 .3rem; }
.bar > div { height: 100%; width: 0; background: var(--teal); transition: width .25s; }
#up-msg { margin: 0; font-size: .9rem; }
#up-msg.err { color: var(--bad); font-weight: 500; }

/* Liste des documents */
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.pill { font-size: .8rem; padding: .25rem .7rem; border-radius: 99px; background: var(--bg); color: var(--muted); font-weight: 500; }
.pill.on { background: var(--ok-soft); color: var(--ok); }
.pill.off { background: var(--warn-soft); color: var(--warn); }
.table-wrap { overflow-x: auto; margin-top: .5rem; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: .82rem; padding: .55rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: .75rem .6rem; border-bottom: 1px solid #EEF2F6; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.doc-title { font-weight: 600; color: var(--navy-dark); }
.doc-sub { color: var(--muted); font-size: .82rem; }
.progress { width: 170px; height: 8px; background: #E8EEF4; border-radius: 99px; overflow: hidden; display: flex; }
.progress i { display: block; height: 100%; }
.p-ok { background: var(--ok); }
.p-verif { background: #E3A008; }
.p-err { background: var(--bad); }
.p-run { background: var(--teal); }
.prog-label { font-size: .78rem; color: var(--muted); margin-top: .25rem; }
.badge { display: inline-block; padding: .2rem .6rem; border-radius: 99px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-run { background: var(--teal-soft); color: #0A7F96; }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-bad { background: var(--bad-soft); color: var(--bad); }
.b-off { background: #ECEFF3; color: var(--muted); }
.actions { white-space: nowrap; text-align: right; }
.actions .btn { margin-left: .25rem; }
.empty { text-align: center; color: var(--muted); padding: 2rem 0 .5rem; }

/* Messages */
.notice { padding: .7rem 1rem; border-radius: 8px; margin: 0 0 1rem; font-size: .92rem; }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }

/* Connexion / installation */
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 1.5rem; }
.auth-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 2rem; width: 100%; max-width: 420px; }
.auth-card .brand { color: var(--navy-dark); margin-bottom: 1.25rem; }
.auth-card form { display: grid; gap: 1rem; margin-top: 1rem; }
.checks { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: .35rem; font-size: .92rem; }
.checks li::before { content: ''; display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .6rem; }
.checks .good::before { background: var(--ok); }
.checks .bad::before { background: var(--bad); }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: .75rem 1rem; padding: .75rem 1rem; }
  .who { width: 100%; }
  .wrap { padding: 1rem; }
  .progress { width: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
