/* Couleurs provisoires : elles seront remplacées par celles du manuel du logo. */
:root {
  --brand: #2f6b3a;
  --brand-dark: #234f2b;
  --brand-soft: #e6f0e7;
  --bg: #f5f6f3;
  --card: #ffffff;
  --text: #1d231e;
  --muted: #667066;
  --line: #dde2dc;
  --danger: #b3261e;
  --radius: 14px;
  --tap: 46px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-size: 16px; }
body { -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }

/* ---------- structure */
.topbar {
  position: sticky; top: 0; z-index: 5; background: var(--brand); color: #fff;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px; display: flex; align-items: center; gap: 10px;
}
.topbar h1 { font-size: 1.1rem; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar button { background: transparent; border: 0; color: #fff; min-height: 40px; padding: 0 8px; font-size: 1rem; cursor: pointer; }
main { padding: 12px 12px calc(84px + var(--safe-b)); max-width: 980px; margin: 0 auto; }
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: var(--safe-b);
}
.tabs a {
  flex: 1; text-align: center; padding: 8px 4px 10px; text-decoration: none; color: var(--muted); font-size: .78rem;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tabs a .ico { font-size: 1.35rem; line-height: 1; }
.tabs a.on { color: var(--brand); font-weight: 600; }

/* ---------- éléments */
.card { background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; border: 1px solid var(--line); }
.card h2 { font-size: 1rem; margin: 0 0 10px; color: var(--brand-dark); display: flex; align-items: center; gap: 8px; }
.card h2 .grow { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); font-size: .9rem; }
.small { font-size: .82rem; }
.btn {
  min-height: var(--tap); padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; color: var(--text);
}
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn.danger { color: var(--danger); border-color: #e9c3c0; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: .9rem; }
.btn.block { width: 100%; }
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.actions .btn { flex-direction: column; font-size: .8rem; min-height: 60px; padding: 4px; }
.actions .btn .ico { font-size: 1.3rem; }
.actions .btn[aria-disabled="true"] { opacity: .35; pointer-events: none; }

label { display: block; font-size: .85rem; color: var(--muted); margin: 10px 0 4px; }
input[type=text], input[type=tel], input[type=email], input[type=number], input[type=date], input[type=password], input[type=search], select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff;
}
textarea { min-height: 90px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; min-height: var(--tap); color: var(--text); font-size: 1rem; margin: 0; }
.check input { width: 22px; height: 22px; accent-color: var(--brand); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }

.filters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0 12px; }
.filters select { min-height: 40px; padding: 6px 8px; font-size: .9rem; }
@media (max-width: 640px) { .filters { grid-template-columns: 1fr 1fr; } }

.list .item {
  display: flex; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; margin-bottom: 8px; text-decoration: none; color: inherit;
}
.item .main { flex: 1; min-width: 0; }
.item .title { font-weight: 600; }
.item .sub { color: var(--muted); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .price { font-weight: 700; color: var(--brand-dark); white-space: nowrap; }
.group-h { margin: 16px 4px 8px; font-weight: 700; color: var(--brand-dark); display: flex; justify-content: space-between; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .75rem; font-weight: 600; white-space: nowrap; background: #eee; }
.st-a_contacter { background: #fde7c7; color: #7a4a00; }
.st-contacte { background: #ffe9a8; color: #6b5300; }
.st-a_soumissionner { background: #e8defa; color: #4b2a8a; }
.st-soumission_envoyee { background: #ddd5f5; color: #3d2a7a; }
.st-confirme { background: #cfe6ff; color: #0b4a8c; }
.st-fait { background: #fff3a0; color: #5c5200; }
.st-paye { background: #d4efd8; color: #1d5a2a; }
.st-a_revoir { background: #e2f1e6; color: #26603a; }
.st-skip { background: #e6e6e6; color: #555; }
.st-perdu { background: #f6d4d1; color: #8a1f17; }
.tag { display: inline-block; padding: 1px 6px; border-radius: 6px; font-size: .72rem; background: var(--brand-soft); color: var(--brand-dark); margin-right: 3px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: .95rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.log { border-top: 1px solid var(--line); padding: 8px 0; font-size: .92rem; }
.log:first-of-type { border-top: 0; }
.pre { white-space: pre-wrap; }

.board { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
.board .col { min-width: 250px; max-width: 280px; flex: 0 0 auto; scroll-snap-align: start; }
.board .col h3 { font-size: .9rem; margin: 0 0 8px; display: flex; justify-content: space-between; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.stat .v { font-size: 1.5rem; font-weight: 700; color: var(--brand-dark); }
.stat .l { color: var(--muted); font-size: .85rem; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }

.login { max-width: 380px; margin: 12vh auto 0; padding: 0 16px; }
.login .logo { text-align: center; font-size: 3rem; }
.login h1 { text-align: center; color: var(--brand-dark); font-size: 1.3rem; }
.error { color: var(--danger); margin-top: 8px; min-height: 1.2em; }
.fab {
  position: fixed; right: 16px; bottom: calc(76px + var(--safe-b)); z-index: 6; width: 56px; height: 56px; border-radius: 50%;
  background: var(--brand); color: #fff; border: 0; font-size: 1.8rem; box-shadow: 0 4px 12px rgba(0,0,0,.2); cursor: pointer;
}
#toast {
  position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%); background: #222; color: #fff;
  padding: 10px 16px; border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 20; max-width: 90vw;
}
#toast.show { opacity: .95; }
dialog { border: 0; border-radius: 16px; padding: 16px; width: min(520px, 94vw); max-height: 90vh; }
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog h3 { margin: 0 0 8px; color: var(--brand-dark); }
dialog .row { margin-top: 14px; justify-content: flex-end; }
.banner { background: #fff3cd; color: #6b5300; padding: 8px 12px; border-radius: 10px; margin-bottom: 10px; font-size: .9rem; }
