/* NDF — mobile-first, minimal */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #fafafa;
  color: #1a1a1a;
}

.container {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1.25rem;
}

h1 { font-size: 1.4rem; margin: 0 0 0.25rem; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 0.25rem; }
p  { color: #555; margin-top: 0; }

.error {
  background: #fdecea;
  border: 1px solid #f5c6cb;
  color: #a33;
  padding: 0.6rem 0.8rem 0.6rem 1.6rem;
  border-radius: 0.5rem;
}
.error li { margin: 0.2rem 0; }

form { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 1.25rem; }

label { font-weight: 600; display: block; margin-bottom: 0.45rem; }

input, select, textarea, button {
  font: inherit;
  padding: 0.85rem;
  border-radius: 0.5rem;
  border: 1px solid #ccc;
  width: 100%;
}

button {
  background: #1a1a1a;
  color: #fff;
  border: none;
  cursor: pointer;
  width: auto;
}

button:active { opacity: 0.85; }

.btn-secondary {
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #ccc;
}

.section {
  border: 1px solid #ddd;
  border-radius: 0.75rem;
  padding: 1.1rem;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  background: #fff;
}

.section legend { font-weight: 700; padding: 0 0.4rem; }

.hint { font-size: 0.8rem; color: #777; margin: 0.4rem 0 0; }

.ligne-row {
  border: 1px dashed #ccc;
  border-radius: 0.75rem;
  padding: 1.1rem;
  margin-bottom: 1.1rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ligne-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0;
}
.ligne-title { font-size: 0.95rem; margin: 0; color: #1a1a1a; }
.ligne-remove {
  background: none;
  border: none;
  color: #a33;
  text-decoration: underline;
  font-size: 0.85rem;
  padding: 0.25rem;
}

table.recap {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 0.9rem;
  margin: 1rem 0;
}
.recap th, .recap td {
  border: 1px solid #ddd;
  padding: 0.5rem 0.4rem;
  text-align: left;
  vertical-align: top;
}
.recap th { background: #f2f2f2; }
.recap .num { text-align: right; white-space: nowrap; }
.recap tfoot td { font-weight: 700; background: #f2f2f2; }
.recap small { color: #777; }

ol.steps { color: #333; }
ol.steps li { margin: 0.35rem 0; }

.sig-box {
  border: 1px dashed #999;
  border-radius: 0.75rem;
  padding: 0.75rem;
  background: #fff;
}
#signature {
  width: 100%;
  height: 9rem;
  border: 1px solid #ddd;
  border-radius: 0.5rem;
  background: #fff;
  touch-action: none;
}
.sig-error { color: #a33; font-weight: 600; }
#sig-clear { margin-top: 0.5rem; }

.confirmation {
  background: #eaf6ec;
  border: 1px solid #bcd9c2;
  color: #1d4a26;
  border-radius: 0.75rem;
  padding: 1.25rem;
  margin: 1rem 0;
  text-align: center;
}
.confirmation h1 { color: #1d4a26; }
.confirmation p { color: #2c5a35; }
.numero-big {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  margin: 0.75rem 0;
}

@media (min-width: 40rem) {
  h1 { font-size: 1.8rem; }
  .field { max-width: 24rem; }
  table.recap { font-size: 1rem; }
}

/* --- shared layout helpers (accounts ticket 06; rebuilt well-formed) --- */

.success {
  background: #e8f5e9;
  border: 1px solid #c8e6c9;
  color: #2e7d32;
  padding: 0.6rem 0.8rem;
  border-radius: 0.5rem;
}

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.row-between form, .actions form, .account-head form { margin-top: 0; }

.actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
}
.actions form { display: inline-flex; flex-direction: row; margin-top: 0; }

.btn-quiet {
  background: #eee;
  color: #1a1a1a;
  padding: 0.35rem 0.7rem;
  width: auto;
  border: 1px solid #ddd;
  font-size: 0.9rem;
}
.btn-quiet:hover { background: #e2e2e2; }
.btn-danger { color: #a33; }

.btn-secondary-link {
  display: inline-block;
  padding: 0.75rem 0.2rem;
  color: #1a1a1a;
  width: fit-content;
}

.stacked { max-width: 24rem; }
.muted { color: #777; font-size: 0.9rem; }

.member-nav { margin: 0.5rem 0 1rem; }
.member-nav p { margin: 0.35rem 0; }

/* --- admin area navigation (ticket 09) --- */

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.75rem 0 0.25rem;
}
.admin-nav a {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 1.5rem;
  padding: 0.35rem 0.85rem;
  text-decoration: none;
  color: #1a1a1a;
  font-size: 0.9rem;
}
.admin-nav a:hover { background: #f2f2f2; }

/* --- accounts list --- */

.account-list { list-style: none; padding: 0; margin: 0.5rem 0 1.5rem; }
.account-card {
  border: 1px solid #eee;
  border-radius: 0.6rem;
  padding: 0.8rem;
  margin-bottom: 0.6rem;
  background: #fff;
}
.account-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 1rem;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-on    { background: #e8f5e9; color: #2e7d32; }
.badge-off   { background: #fdecea; color: #a33; }
.badge-pending { background: #fff8e1; color: #8a6d00; }
.badge-admin { background: #e3f2fd; color: #0d47a1; }

/* statut pills: token class on the shared .badge (ADR-0001 tokens) */

.statut-soumise  { background: #e3f2fd; color: #0d47a1; }
.statut-validee  { background: #e8f5e9; color: #2e7d32; }
.statut-payee    { background: #e0f2f1; color: #00695c; }
.statut-rejetee  { background: #fdecea; color: #a33; }

.token-box {
  margin: 0.5rem 0;
  padding: 0.5rem 0.7rem;
  background: #f6f6f6;
  border-radius: 0.4rem;
}
.token-box code {
  display: block;
  word-break: break-all;
  margin-top: 0.25rem;
}

/* --- tracking page & detail meta (dl) --- */

.suivi-detail {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 1rem;
  margin: 1rem 0;
  font-size: 0.95rem;
}
.suivi-detail dt { font-weight: 600; color: #555; }
.suivi-detail dd { margin: 0; }
.suivi { margin-top: 1rem; }
.note { font-size: 0.85rem; color: #777; }
.motif {
  background: #fdecea;
  border: 1px solid #f5c6cb;
  color: #a33;
  padding: 0.6rem 0.8rem;
  border-radius: 0.5rem;
  margin: 0.75rem 0;
}

/* --- dashboard filters & table (ticket 09) --- */

.filters {
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: stretch;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 0.6rem;
  padding: 0.8rem;
}
.filters .field { display: flex; flex-direction: column; }
.filters label { font-weight: 600; font-size: 0.85rem; margin-bottom: 0.25rem; }
.filters button { align-self: flex-start; }
.table-wrap { overflow-x: auto; margin: 0.75rem 0; }
.table-wrap .recap { margin: 0; }

/* --- note detail (ticket 09) --- */

.rib-box {
  border: 1px dashed #c9a227;
  background: #fffbea;
  border-radius: 0.6rem;
  padding: 0.7rem 0.9rem;
  margin: 0.75rem 0;
}
.rib { margin: 0.35rem 0; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.justif-list { list-style: none; padding: 0; margin: 0.5rem 0; }
.justif-list li {
  border: 1px solid #eee;
  border-radius: 0.5rem;
  padding: 0.55rem 0.7rem;
  margin-bottom: 0.45rem;
  background: #fff;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
}
.signature-img {
  max-width: 100%;
  border: 1px solid #ddd;
  border-radius: 0.5rem;
  background: #fff;
  padding: 0.5rem;
}
.journal { list-style: none; padding: 0; margin: 0.5rem 0 1rem; }
.journal li {
  border-left: 3px solid #ddd;
  padding: 0.35rem 0 0.35rem 0.7rem;
  margin-bottom: 0.4rem;
  font-size: 0.92rem;
}
.reject-form { margin-top: 0.75rem; }
.reject-form textarea { margin-top: 0.25rem; }

@media (min-width: 40rem) {
  .filters { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
  .filters .field { min-width: 12rem; flex: 1; }
}

/* --- ticket 13: justificatif accumulation (recap) --- */

.justif-pick {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.justif-pick .justif-list { margin: 0; }
.justif-pick .justif-list li { flex-wrap: wrap; }

.justif-add {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: #1a1a1a;
  padding: 0.55rem 0.7rem;
  border: 1px solid #ccc;
  border-radius: 0.5rem;
  background: #fff;
  width: fit-content;
}
.justif-add:hover { background: #f2f2f2; }
.justif-add input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.justif-meta {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
  min-width: 0;
}
.justif-name { word-break: break-word; }
.justif-size { color: #777; font-size: 0.8rem; white-space: nowrap; }

.justif-remove {
  background: none;
  border: none;
  color: #a33;
  text-decoration: underline;
  cursor: pointer;
  width: auto;
  padding: 0.2rem 0.3rem;
  font-size: 0.85rem;
}
.justif-error { color: #a33; font-weight: 600; margin: 0; font-size: 0.85rem; }
