:root {
  --blue: #0b5ed7;
  --blue-dark: #084298;
  --green: #1b8a4c;
  --red: #c62828;
  --orange: #b8860b;
  --gray-50: #f7f8fa;
  --gray-100: #eef0f3;
  --gray-300: #d6dae0;
  --gray-500: #8a919c;
  --gray-800: #2b2f36;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
}

.container {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: white;
  border-bottom: 1px solid var(--gray-300);
  padding: 10px 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand { font-weight: 700; color: var(--gray-800); text-decoration: none; flex: 0 0 auto; }
.topbar nav {
  display: flex;
  gap: 10px;
  font-size: 13px;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}
.topbar nav a { color: var(--gray-500); text-decoration: none; flex: 0 0 auto; }
.topbar nav a.active, .topbar nav a:hover { color: var(--blue); }
@media (max-width: 400px) {
  .topbar { flex-wrap: wrap; }
  .topbar .brand { width: 100%; }
  .topbar nav { width: 100%; justify-content: space-between; gap: 6px; }
}

h1 { font-size: 20px; margin: 8px 0 4px; }
h2 { font-size: 16px; margin: 20px 0 10px; color: var(--gray-800); }
.subtitle { color: var(--gray-500); margin: 0 0 16px; font-size: 14px; }
.back-link { color: var(--blue); text-decoration: none; font-size: 14px; }

.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 12px; font-size: 14px; }
.flash-error { background: #fdecea; color: var(--red); }
.flash-ok { background: #e6f4ea; color: var(--green); }

label { display: block; font-size: 13px; color: var(--gray-500); margin-bottom: 12px; }
input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 16px;
  background: white;
  color: var(--gray-800);
}

.btn {
  display: inline-block;
  border: none;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}
.btn-block { display: block; width: 100%; }
.btn-primary { background: var(--blue); color: white; }
.btn-primary:active { background: var(--blue-dark); }
.btn-secondary { background: var(--gray-100); color: var(--gray-800); border: 1px solid var(--gray-300); }
.btn-action { background: white; border: 1px solid var(--blue); color: var(--blue); width: 100%; padding: 14px; margin-bottom: 8px; }
.btn-small { padding: 6px 10px; font-size: 13px; background: var(--gray-100); border: 1px solid var(--gray-300); }

.login-box { margin-top: 60px; }

.card-list { margin-bottom: 8px; }
.card {
  display: block;
  background: #fff8e1;
  border: 1px solid #f0d98c;
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
  text-decoration: none;
  color: var(--gray-800);
}
.card-title { font-weight: 600; }
.card-sub { font-size: 13px; color: var(--gray-500); }

.monnayeur-card {
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}
.monnayeur-nom { font-weight: 700; }
.monnayeur-sub { font-size: 13px; color: var(--gray-500); margin-bottom: 10px; }
.action-grid { display: flex; flex-direction: column; gap: 6px; }

.stepper { list-style: none; padding: 0; display: flex; gap: 6px; margin: 16px 0; flex-wrap: wrap; }
.stepper li {
  flex: 1;
  min-width: 90px;
  font-size: 11px;
  text-align: center;
  padding: 8px 4px;
  border-radius: 8px;
  background: var(--gray-100);
  color: var(--gray-500);
}
.stepper li.current { background: #e8f0fe; color: var(--blue); font-weight: 600; }
.stepper li.done { background: #e6f4ea; color: var(--green); font-weight: 600; }
.stepper li.error { background: #fdecea; color: var(--red); font-weight: 600; }

.photo-block {
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 16px;
}
.pb-label { margin: 0 0 10px; font-size: 15px; }
.pb-preview img { width: 100%; border-radius: 8px; margin-bottom: 10px; display: block; }
.pb-status { font-size: 13px; margin-top: 8px; color: var(--gray-500); }
.pb-status.ok { color: var(--green); }
.pb-status.erreur { color: var(--red); }

.manual-form { margin-top: 10px; border-top: 1px dashed var(--gray-300); padding-top: 10px; }
.manual-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.manual-row label { flex: 1; margin: 0; font-size: 13px; color: var(--gray-800); }
.manual-row input { width: 80px; margin: 0; padding: 6px 8px; }

.extract-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 10px; }
.extract-table th, .extract-table td { padding: 5px 6px; border-bottom: 1px solid var(--gray-100); text-align: right; }
.extract-table th:first-child, .extract-table td:first-child { text-align: left; }
.extract-total { font-weight: 700; }

.recap-final { margin-top: 20px; }
.recap-table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.recap-table td { padding: 8px 6px; border-bottom: 1px solid var(--gray-100); }
.recap-table td:last-child { text-align: right; font-weight: 600; }
.ecart-ok { color: var(--green); }
.ecart-ko { color: var(--red); }

.statut-badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.statut-terminee, .statut-badge.statut-terminee { background: #e6f4ea; color: var(--green); }
.statut-anomalie, .statut-badge.statut-anomalie { background: #fdecea; color: var(--red); }
.statut-en_cours, .statut-badge.statut-en_cours { background: #fff8e1; color: var(--orange); }

.photo-thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.thumb { font-size: 12px; padding: 6px 10px; background: var(--gray-100); border-radius: 8px; text-decoration: none; color: var(--gray-800); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filters select, .filters input { width: auto; flex: 1 1 130px; margin-top: 0; }
.filters .btn { flex: 0 0 auto; }

.op-list { display: flex; flex-direction: column; gap: 8px; }
.op-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  border: 1px solid var(--gray-300);
  border-left: 4px solid var(--gray-300);
  border-radius: 8px;
  padding: 10px 12px;
  text-decoration: none;
  color: var(--gray-800);
}
.op-row.statut-terminee { border-left-color: var(--green); }
.op-row.statut-anomalie { border-left-color: var(--red); }
.op-row.statut-en_cours { border-left-color: var(--orange); }
.op-row-title { font-size: 14px; font-weight: 600; }
.op-row-sub { font-size: 12px; color: var(--gray-500); }
.op-row-amount { text-align: right; font-size: 14px; font-weight: 600; }

.admin-form { background: white; border: 1px solid var(--gray-300); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.admin-form-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.checkbox-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.checkbox-inline input { width: auto; margin: 0; }
.users-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; font-size: 13px; }
.users-table th, .users-table td { padding: 6px; border-bottom: 1px solid var(--gray-100); text-align: left; }

details summary { cursor: pointer; color: var(--blue); font-size: 14px; margin-bottom: 8px; }
