/* Quitus — feuille de style de l'application.
   Design neutre et sobre : l'identité visuelle du client (logo, nom)
   s'affiche dans l'en-tête, par-dessus cette base neutre. Polices système
   uniquement (pas de dépendance externe, cohérent avec un hébergement
   mutualisé et la protection des données du comité). */

:root {
  --bg: #f4f5f6;
  --surface: #ffffff;
  --surface-alt: #eceff1;
  --text: #1d2327;
  --text-muted: #5b6570;
  --border: #dde1e4;
  --accent: #3d5a6c;
  --accent-hover: #314857;
  --accent-ink: #ffffff;
  --good: #2f6f4e;
  --good-soft: #e1efe6;
  --danger: #a3352b;
  --danger-soft: #f6e2df;
  --warn: #8f5f0f;
  --warn-soft: #f3e8cf;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(20, 24, 28, .05), 0 4px 14px -6px rgba(20, 24, 28, .12);
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px clamp(16px, 4vw, 32px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.app-header .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.app-header .brand img { height: 34px; width: auto; display: block; }
.app-header .brand strong { font-size: 17px; letter-spacing: -.01em; }
.app-header nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.app-header nav a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 14.5px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 6px;
}
.app-header nav a:hover, .app-header nav a.active { background: var(--surface-alt); color: var(--text); }
.app-header .user-box { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-muted); }
.app-header .user-box form { margin: 0; }

.container { max-width: 980px; margin: 0 auto; padding: clamp(16px, 4vw, 32px); }
.container.narrow { max-width: 620px; }

h1 { font-size: clamp(22px, 3vw, 27px); margin: 0 0 6px; }
h2 { font-size: 18px; margin: 0 0 12px; }
.page-intro { color: var(--text-muted); margin: 0 0 24px; max-width: 68ch; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat .n { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .label { color: var(--text-muted); font-size: 13px; text-transform: uppercase; letter-spacing: .03em; }
.stat.retard .n { color: var(--danger); }

table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); background: var(--surface-alt); }
tbody tr:hover { background: var(--surface-alt); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table-wrap table { margin: 0; border: none; }
.table-wrap .table-wrap table { border: none; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.badge.brouillon { background: var(--surface-alt); color: var(--text-muted); }
.badge.en_validation { background: var(--warn-soft); color: var(--warn); }
.badge.validee { background: var(--good-soft); color: var(--good); }
.badge.refusee { background: var(--danger-soft); color: var(--danger); }
.badge.payee { background: #dde7ee; color: var(--accent); }
.badge.annulee { background: var(--surface-alt); color: var(--text-muted); }
.badge.retard { background: var(--danger-soft); color: var(--danger); }
.badge.en_attente { background: var(--warn-soft); color: var(--warn); }
.badge.acceptee { background: var(--good-soft); color: var(--good); }
.badge.a_venir { background: var(--surface-alt); color: var(--text-muted); }

label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 5px; color: var(--text); }
.field { margin-bottom: 16px; }
.field .hint { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }
input[type="text"], input[type="email"], input[type="number"], input[type="date"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 15px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 10px 18px;
  font-size: 14.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-good { background: var(--good); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-alt); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }

.alert { border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px; font-size: 14.5px; }
.alert-error { background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); }
.alert-success { background: var(--good-soft); color: var(--good); border: 1px solid color-mix(in srgb, var(--good) 30%, transparent); }

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted);
  background: var(--surface-alt);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone.dragover { border-color: var(--accent); background: #eef2f4; color: var(--text); }
.dropzone .filename { margin-top: 10px; font-weight: 700; color: var(--text); }
.dropzone input[type="file"] { display: none; }

.pdf-frame {
  width: 100%;
  height: min(70vh, 800px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
}

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.timeline li:last-child { border-bottom: none; }
.timeline .num {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--surface-alt);
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 700; color: var(--text-muted);
}
.timeline .num.done { background: var(--good); color: #fff; }
.timeline .num.refused { background: var(--danger); color: #fff; }
.timeline .num.current { background: var(--accent); color: #fff; }
.timeline .who { font-weight: 700; font-size: 14.5px; }
.timeline .meta { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.timeline .comment { margin-top: 6px; font-size: 14px; background: var(--surface-alt); border-radius: 6px; padding: 8px 10px; }

.journal-list { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.journal-list li { padding: 7px 0; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.journal-list li:last-child { border-bottom: none; }
.journal-list time { font-variant-numeric: tabular-nums; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; align-items: flex-end; }
.filters .field { margin-bottom: 0; min-width: 180px; }

.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }

footer.app-footer { text-align: center; color: var(--text-muted); font-size: 12.5px; padding: 32px 16px; }

@media (max-width: 640px) {
  .app-header { flex-direction: column; align-items: stretch; }
  .app-header nav { justify-content: center; }
  table.responsive-stack thead { display: none; }
  table.responsive-stack, table.responsive-stack tbody, table.responsive-stack tr, table.responsive-stack td { display: block; width: 100%; }
  table.responsive-stack tr { border-bottom: 2px solid var(--border); padding: 10px 0; }
  table.responsive-stack td { border: none; padding: 4px 12px; }
  table.responsive-stack td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
}
