:root {
  --navy: #0F172A;
  --amber: #F59E0B;
  --bg: #F1F5F9;
  --card: #FFFFFF;
  --text: #0F172A;
  --muted: #64748B;
  --line: #E2E8F0;
  --ok: #10B981;
  --bad: #EF4444;
  --wait: #F59E0B;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  padding-bottom: env(safe-area-inset-bottom);
}

#app { max-width: 560px; margin: 0 auto; min-height: 100vh; }
.center { padding: 48px 16px; text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

header.bar {
  position: sticky; top: 0; z-index: 5;
  background: var(--navy); color: #fff;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  display: flex; align-items: center; gap: 12px;
}
header.bar .title { flex: 1; min-width: 0; }
header.bar .title b { display: block; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header.bar .title span { font-size: 13px; color: #CBD5E1; }
.plate {
  background: var(--amber); color: var(--navy);
  font-weight: 800; border-radius: 8px; padding: 4px 8px; font-size: 13px;
  white-space: nowrap;
}
.iconbtn {
  background: transparent; border: 1px solid #334155; color: #fff;
  border-radius: 10px; padding: 8px 10px; font-size: 14px; min-height: 40px;
}

nav.tabs {
  display: flex; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: calc(64px + env(safe-area-inset-top)); z-index: 4;
}
nav.tabs button {
  flex: 1; border: 0; background: none; padding: 14px 4px; font-size: 14px;
  color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; min-height: 48px;
}
nav.tabs button[aria-selected="true"] { color: var(--navy); border-bottom-color: var(--amber); }

main { padding: 16px; }
h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 20px 0 8px; }
h2:first-child { margin-top: 4px; }

.card {
  background: var(--card); border-radius: 14px; padding: 14px 16px;
  border: 1px solid var(--line); margin-bottom: 10px;
}
button.card { width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; display: block; }
.row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.op-route { font-weight: 700; font-size: 16px; }
.op-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.amount { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }

.chip {
  display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 8px;
  border-radius: 999px; white-space: nowrap;
}
.chip.pending { background: #FEF3C7; color: #92400E; }
.chip.validated { background: #D1FAE5; color: #065F46; }
.chip.rejected { background: #FEE2E2; color: #991B1B; }
.chip.due { background: #FEF3C7; color: #92400E; }
.chip.s-wait { background: #E2E8F0; color: #334155; }
.chip.s-run { background: #DBEAFE; color: #1E40AF; }
.chip.s-done { background: #D1FAE5; color: #065F46; }
.chip.s-late { background: #FEF3C7; color: #92400E; }
.chip.s-bad { background: #FEE2E2; color: #991B1B; }

.step-actions .btn { min-height: 56px; }
.btn.ok { background: var(--ok); color: #fff; }
.btn.late { background: var(--amber); color: var(--navy); }
.picks { display: flex; flex-wrap: wrap; gap: 8px; }
.pick {
  font: inherit; font-size: 14px; border: 1px solid #CBD5E1; background: #fff;
  color: var(--navy); border-radius: 999px; padding: 8px 14px; min-height: 40px;
}
.pick:active { background: #FEF3C7; }
.pick.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.field { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }

form { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
label.check { display: flex; align-items: center; gap: 10px; min-height: 48px; }
label.check input { width: 24px; height: 24px; min-height: 0; padding: 0; flex: none; }
label[hidden] { display: none; }
input, select, textarea {
  font: inherit; font-size: 16px; padding: 12px; border-radius: 10px;
  border: 1px solid #CBD5E1; background: #fff; color: var(--text); width: 100%;
  min-height: 48px;
}
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid #FDE68A; border-color: var(--amber); }

.btn {
  font: inherit; font-weight: 700; border: 0; border-radius: 12px; padding: 14px 16px;
  min-height: 50px; width: 100%; cursor: pointer;
}
.btn.primary { background: var(--navy); color: #fff; }
.btn.accent { background: var(--amber); color: var(--navy); }
.btn.ghost { background: transparent; color: var(--navy); border: 1px solid #CBD5E1; }
.btn.danger { background: transparent; color: var(--bad); border: 1px solid #FCA5A5; }
.btn:disabled { opacity: .55; }
.btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.auth { padding: calc(40px + env(safe-area-inset-top)) 16px 24px; }
.brand { text-align: center; margin-bottom: 24px; }
.brand img { width: 72px; height: 72px; }
.brand img.logo { width: 128px; height: 128px; filter: drop-shadow(0 4px 12px rgb(15 23 42 / .18)); }
header.bar .bar-logo { width: 34px; height: 34px; flex: none; border-radius: 50%; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.brand h1 { margin: 10px 0 2px; font-size: 22px; }
.switch { display: flex; gap: 8px; margin-bottom: 16px; }
.switch button {
  flex: 1; border: 1px solid #CBD5E1; background: #fff; border-radius: 10px;
  padding: 10px; font: inherit; font-weight: 600; min-height: 44px; color: var(--muted);
}
.switch button[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }

.error {
  background: #FEE2E2; color: #991B1B; border-radius: 10px; padding: 10px 12px; font-size: 14px;
}
.notice {
  background: #FEF3C7; color: #78350F; border-radius: 10px; padding: 12px; font-size: 14px;
}

.detail dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; }
.detail dt { color: var(--muted); font-size: 14px; }
.detail dd { margin: 0; font-weight: 600; word-break: break-word; }
.back { margin-bottom: 12px; }
.due-box {
  margin-top: 12px; background: #FFFBEB; border: 1px solid #FDE68A; border-radius: 12px;
  padding: 12px; display: flex; justify-content: space-between; align-items: center;
}

#toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom));
  max-width: 528px; margin: 0 auto; background: var(--navy); color: #fff;
  padding: 14px 16px; border-radius: 12px; font-weight: 600; z-index: 20;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .25);
}
#toast.bad { background: var(--bad); }

.empty { text-align: center; color: var(--muted); padding: 24px 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* install + alerts cards */
.card.setup { border: 1px solid #FDE68A; background: #FFFBEB; display: grid; gap: 8px; }
.card.setup.warn { border-color: #FECACA; background: #FEF2F2; }
.card.setup p { margin: 0; }
.setup.ok-line {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 14px; color: #065F46; padding: 4px 2px;
}
.btn.small-btn { min-height: 36px; padding: 6px 14px; width: auto; font-size: 14px; }
.steps-how { margin: 0; padding-left: 20px; font-size: 14px; color: var(--muted, #475569); display: grid; gap: 4px; }

/* Argent en main (Encaissements tab) */
.cash-card { background: var(--navy); color: #fff; border-color: var(--navy); }
.cash-card .op-meta { color: #CBD5E1; }
.cash-label { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--amber); font-weight: 700; }
.cash-total { font-size: 32px; font-weight: 800; font-variant-numeric: tabular-nums; margin: 4px 0 6px; overflow-wrap: anywhere; }

/* in-app office alert */
.alarm {
  position: fixed; left: 0; right: 0; top: 0; z-index: 30;
  padding: calc(14px + env(safe-area-inset-top)) 16px 14px;
  background: #DC2626; color: #fff; box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
  animation: alarm-pulse 1s ease-in-out 6;
}
.alarm-title { font-size: 18px; font-weight: 800; }
.alarm-body { margin-top: 4px; font-weight: 600; }
.alarm-btns { display: flex; gap: 8px; margin-top: 10px; }
.alarm-btns .btn { flex: 1; }
.alarm-open { background: #fff; color: #DC2626; }
.alarm-ok { background: rgba(255, 255, 255, .18); color: #fff; border: 1px solid rgba(255, 255, 255, .6); }
@keyframes alarm-pulse { 50% { background: #991B1B; } }
.btns-inline { display: inline-flex; gap: 6px; }
.steps { padding-left: 20px; margin: 6px 0; }
.steps li { margin: 4px 0; }
