/* OHLALA! Eaux Vives — fichier clients & ambassadeurs. Styles de l'application. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* neutres : une seule échelle, teintée du bleu nuit OHLALA */
  --n-0: #FFFFFF;
  --n-50: #F9FAFA;
  --n-100: #F3F4F5;
  --n-150: #ECEEEF;
  --n-200: #E3E6E8;
  --n-300: #CBD1D5;
  --n-500: #626F77;
  --n-600: #4E5A62;
  --n-900: #0F1F27;

  --bg: var(--n-100);
  --surface: var(--n-0);
  --ink: var(--n-900);
  --ink-2: var(--n-600);
  --muted: var(--n-500);
  --line: var(--n-200);
  --line-soft: var(--n-150);
  --control: var(--n-300);

  /* marque */
  --topbar: #0B0B0B;
  --side-bg: #0E222C;            /* bleu nuit du site OHLALA */
  --side-ink: #B4C3CA;
  --side-muted: #8EA2AB;
  --brand: #E9530E;              /* logo, repères actifs (jamais du texte sur blanc) */
  --primary: #C7440B;            /* boutons principaux : texte blanc à 4,8:1 */
  --primary-hover: #AC3A09;
  --primary-text: #AE3B09;       /* liens et actions textuelles orangés */
  --amb-bg: #FDF0E8;
  --amb-ink: #9E3707;

  /* états */
  --ok: #0B7048;
  --ok-bg: #E6F4EC;
  --warn-bg: #FFF5E0;
  --warn-ink: #7A4A00;
  --danger: #B92218;
  --danger-hover: #9C1C14;
  --danger-bg: #FDECEA;

  --r-card: 6px;
  --r-ctl: 4px;
  --r-sm: 3px;
  --elev: 0 0 0 1px rgba(15, 31, 39, 0.07), 0 1px 2px rgba(15, 31, 39, 0.06);
  --elev-pop: 0 0 0 1px rgba(15, 31, 39, 0.08), 0 12px 32px -8px rgba(15, 31, 39, 0.28);
  --ring: 0 0 0 3px rgba(233, 83, 14, 0.25);

  --ctl-h: 36px;
  --ctl-h-lg: 44px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (pointer: coarse) {
  :root { --ctl-h: 44px; --ctl-h-lg: 52px; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--control) transparent; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--primary);
}
::selection { background: var(--selection, rgba(233, 83, 14, 0.2)); }
a { color: var(--ink); text-decoration-color: var(--control); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
code { font-size: 0.92em; background: var(--n-150); padding: 1px 5px; border-radius: var(--r-sm); }

h1, h2, h3 { margin: 0; color: var(--ink); text-wrap: balance; }
h1 { font-size: 22px; line-height: 1.25; font-weight: 650; letter-spacing: -0.018em; }
h2 { font-size: 15px; line-height: 1.35; font-weight: 600; letter-spacing: -0.006em; }
h3 { font-size: 14px; line-height: 1.4; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

.boot { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }

/* ------------------------------------------------------------ structure */
/* Le bandeau et le menu suivent les couleurs choisies dans Réglages (variables injectées par index.php).
   data-band / data-side valent « light » quand la couleur choisie est claire : on passe alors en encre foncée. */
:root { --band-ink: #FFFFFF; --band-muted: #A3A9AD; --band-veil: rgba(255, 255, 255, 0.08); --band-line: rgba(255, 255, 255, 0.14);
  --side-strong: #FFFFFF; --side-veil: rgba(255, 255, 255, 0.06); --side-veil-on: rgba(255, 255, 255, 0.1); --side-mark: var(--brand); }
html[data-band="light"] { --band-veil: rgba(15, 31, 39, 0.05); --band-line: rgba(15, 31, 39, 0.14); }
html[data-side="light"] { --side-strong: var(--ink); --side-veil: rgba(15, 31, 39, 0.05); --side-veil-on: rgba(15, 31, 39, 0.08); }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: 56px; background: var(--topbar); color: var(--band-ink);
  display: flex; align-items: center; gap: 20px; padding: 0 max(16px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
}
html[data-band="light"] .topbar { box-shadow: 0 1px 0 var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--band-ink); text-decoration: none; min-width: 0; }
.brand:hover { color: var(--band-ink); }
.brand img { height: 36px; width: auto; max-width: 180px; object-fit: contain; display: block; }
.brand-name { font-weight: 650; font-size: 16px; letter-spacing: -0.012em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--band-ink); }
.brand-sep { width: 1px; height: 22px; background: var(--band-line); }
.brand-app { color: var(--band-muted); font-size: 13px; font-weight: 500; white-space: nowrap; }
.top-search { flex: 1 1 auto; display: flex; justify-content: center; min-width: 0; }
.top-search form { position: relative; width: 100%; max-width: 480px; }
.top-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--band-muted); pointer-events: none; }
.top-search input {
  width: 100%; height: 36px; border-radius: var(--r-ctl); border: 1px solid var(--band-line); background: var(--band-veil); color: var(--band-ink);
  padding: 0 12px 0 36px; font-size: 14px;
}
.top-search input::placeholder { color: var(--band-muted); }
.top-search input:focus { outline: none; border-color: var(--band-muted); }
.top-search kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); min-width: 20px; height: 20px; padding: 0 5px; border-radius: var(--r-sm); border: 1px solid var(--band-line); color: var(--band-muted); font: 500 12px/18px var(--font); text-align: center; pointer-events: none; }
.top-search input:focus + kbd, .top-search input:not(:placeholder-shown) + kbd { display: none; }
.top-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.top-icon { width: 36px; height: 36px; border-radius: var(--r-ctl); border: 0; background: transparent; color: var(--band-muted); display: grid; place-items: center; cursor: pointer; text-decoration: none; }
.top-icon:hover { background: var(--band-veil); color: var(--band-ink); }
.top-phone, .lbl-short, .show-sm, .nav-item.nav-scan { display: none; }
.top-icon.active { background: var(--band-veil); color: var(--band-ink); }
.top-user { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 4px; border: 0; border-radius: var(--r-ctl); background: transparent; color: var(--band-ink); cursor: pointer; font-size: 13px; font-weight: 550; }
.top-user:hover, .top-user.active { background: var(--band-veil); color: var(--band-ink); }
a.top-user { text-decoration: none; }
.top-user .avatar { width: 28px; height: 28px; font-size: 12px; background: var(--band-veil); color: var(--band-ink); }
.top-user .who-role { color: var(--band-muted); font-weight: 500; }

.shell { display: flex; min-height: calc(100vh - 56px); background: linear-gradient(to right, var(--side-bg) 224px, transparent 224px); }
.side {
  width: 224px; flex-shrink: 0; padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; background: var(--side-bg);
  position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto;
}
@media (min-width: 1024px) { html[data-side="light"] .side { box-shadow: 1px 0 0 var(--line); } }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: var(--r-ctl);
  color: var(--side-ink); font-weight: 500; text-decoration: none;
}
.nav-item svg { color: var(--side-muted); }
.nav-item:hover { background: var(--side-veil); color: var(--side-strong); }
.nav-item.active { background: var(--side-veil-on); color: var(--side-strong); font-weight: 600; }
.nav-item.active svg { color: var(--side-mark); }
.side .nav-item:focus-visible { outline-color: var(--side-strong); }
.side-foot { margin-top: auto; padding: 10px; font-size: 12.5px; color: var(--side-muted); display: flex; flex-direction: column; gap: 6px; }
.net { display: inline-flex; align-items: center; gap: 7px; }
.net::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #2FB36B; }
.net.off::before { background: var(--danger); }

.main { flex: 1; min-width: 0; padding: 24px 32px 72px; }
.wrap { width: 90%; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; }
.page-head p { margin-top: 2px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.back { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); font-size: 13px; font-weight: 500; text-decoration: none; margin-bottom: -8px; }
.back:hover { color: var(--ink); }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* ------------------------------------------------------------ cartes */
.card { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--elev); padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card-flush { padding: 0; gap: 0; overflow: hidden; }
.card-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 12px; padding: 14px 20px; }
.card-flush > .card-head + * { border-top: 1px solid var(--line); }
.card-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--n-50); }
.card-link { color: var(--primary-text); font-size: 13px; font-weight: 600; text-decoration: none; }
.card-link:hover { text-decoration: underline; }

/* indicateurs : une seule carte, chiffres séparés par des filets */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); background: var(--surface); border-radius: var(--r-card); box-shadow: var(--elev); overflow: hidden; }
.metric { padding: 14px 20px 16px; border-left: 1px solid var(--line); margin-left: -1px; }
.metric-label { font-size: 13px; color: var(--muted); }
.metric-value { font-size: 24px; line-height: 1.2; font-weight: 600; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.metric-value.amb { color: var(--amb-ink); }
.metrics.inset { box-shadow: none; border-top: 1px solid var(--line); border-radius: 0; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }

/* lignes clé : valeur */
.rows { display: flex; flex-direction: column; }
.row { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-top: 1px solid var(--line-soft); }
.row:first-child { border-top: 0; padding-top: 0; }
.row:last-child { padding-bottom: 0; }
.row > :first-child { color: var(--muted); flex-shrink: 0; }
.row > :last-child { text-align: right; overflow-wrap: anywhere; }

/* ------------------------------------------------------------ boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: var(--ctl-h); padding: 0 14px;
  border-radius: var(--r-ctl); border: 0; background: var(--surface); color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--control), 0 1px 0 rgba(15, 31, 39, 0.04);
  font-size: 14px; font-weight: 550; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color 0.12s ease, box-shadow 0.12s ease, color 0.12s ease;
}
.btn svg { color: var(--ink-2); }
.btn:hover { background: var(--n-50); color: var(--ink); }
.btn:active { background: var(--n-150); }
.btn:disabled, .btn[aria-disabled="true"] { cursor: not-allowed; background: var(--n-150); color: #8B959B; box-shadow: none; }
.btn:disabled svg { color: currentColor; }
.btn-primary, .btn-orange {
  background: var(--primary); color: #FFFFFF;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.18), 0 1px 1px rgba(15, 31, 39, 0.12);
}
.btn-primary svg, .btn-orange svg { color: #FFFFFF; }
.btn-primary:hover:not(:disabled), .btn-orange:hover:not(:disabled) { background: var(--primary-hover); color: #FFFFFF; }
.btn-primary:active:not(:disabled), .btn-orange:active:not(:disabled) { background: var(--primary-active, #963208); }
.btn-danger { background: var(--danger); color: #FFFFFF; box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.18); }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); color: #FFFFFF; }
.btn-danger-outline { color: var(--danger); }
.btn-danger-outline svg { color: var(--danger); }
.btn-danger-outline:hover { background: var(--danger-bg); color: var(--danger); }
.btn-lg { height: var(--ctl-h-lg); padding: 0 18px; font-size: 15px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-icon { width: var(--ctl-h); padding: 0; background: transparent; box-shadow: none; color: var(--muted); }
.btn-icon:hover { background: var(--n-150); color: var(--ink); }
.btn-icon svg { color: currentColor; }
.btn-on-dark { background: var(--primary); color: #FFFFFF; box-shadow: none; font-weight: 600; }
.btn-on-dark svg { color: #FFFFFF; }
.btn-on-dark:hover { background: var(--primary-hover); color: #FFFFFF; }
.btn-on-dark.active { background: var(--band-veil); color: var(--band-ink); box-shadow: inset 0 0 0 1px var(--band-line); }
.btn-on-dark.active svg { color: var(--band-ink); }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--primary-text); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-align: left; font-size: inherit; }
.link-btn:hover { text-decoration: underline; }
.link-danger { color: var(--danger); }

/* ------------------------------------------------------------ badges, avatars */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--r-sm); font-size: 12px; font-weight: 550; white-space: nowrap; background: var(--n-150); color: var(--ink-2); }
.badge svg { margin-left: -1px; }
.badge-amb { background: var(--amb-bg); color: var(--amb-ink); }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-strong { background: var(--ink); color: #FFFFFF; }
.badge-client, .badge-river { background: var(--n-150); color: var(--ink-2); }

.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--n-150); color: var(--ink-2); font-weight: 600; font-size: 12px; letter-spacing: 0.02em; display: inline-grid; place-items: center; flex-shrink: 0; }
.avatar.amb { background: var(--amb-bg); color: var(--amb-ink); }
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }
.avatar.lg { width: 48px; height: 48px; font-size: 16px; }

.who { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 550; text-decoration: none; white-space: nowrap; }
.who:hover span:last-child { text-decoration: underline; text-decoration-color: var(--control); text-underline-offset: 3px; }
.ident { display: flex; align-items: center; gap: 14px; min-width: 0; }
.ident > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

/* ------------------------------------------------------------ tableaux, listes */
.table-wrap { overflow-x: auto; position: relative; }
.table { width: 100%; border-collapse: collapse; min-width: 520px; font-variant-numeric: tabular-nums; }
.table th { text-align: left; padding: 8px 12px; font-size: 12.5px; font-weight: 550; color: var(--muted); white-space: nowrap; background: var(--n-50); border-bottom: 1px solid var(--line); }
.table td { padding: 10px 12px; border-top: 1px solid var(--line-soft); color: var(--ink-2); vertical-align: middle; }
.table tbody tr:first-child td { border-top: 0; }
.table tbody tr:hover td { background: var(--n-50); }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table td.strong { color: var(--ink); font-weight: 550; }
.empty { padding: 32px 20px; text-align: center; color: var(--muted); }

.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 20px; border-top: 1px solid var(--line-soft); min-width: 0; }
.list-item:first-child { border-top: 0; }
.list-item .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* onglets segmentés (Tous / Ambassadeurs) */
.chips { display: inline-flex; padding: 2px; gap: 2px; background: var(--n-150); border-radius: var(--r-ctl); }
.chip { display: inline-flex; align-items: center; height: calc(var(--ctl-h) - 4px); padding: 0 12px; border-radius: var(--r-sm); color: var(--ink-2); font-size: 13px; font-weight: 550; text-decoration: none; }
.chip:hover { color: var(--ink); }
.chip.active { background: var(--surface); color: var(--ink); box-shadow: var(--elev); }

/* ------------------------------------------------------------ formulaires */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label, .label { font-size: 13px; font-weight: 550; color: var(--ink); }
.req { color: var(--danger); }
.input, .select, .textarea {
  width: 100%; height: var(--ctl-h); border-radius: var(--r-ctl); border: 1px solid var(--control); background: var(--surface);
  padding: 0 11px; font-size: 14px; color: var(--ink); transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.input::placeholder, .textarea::placeholder { color: #87929A; }
.input:hover, .select:hover, .textarea:hover { border-color: #B3BBC0; }
.textarea { padding: 9px 11px; height: auto; min-height: 96px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--n-100); color: var(--muted); border-color: var(--n-200); cursor: not-allowed; opacity: 1; }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(185, 34, 24, 0.18); }
@media (pointer: coarse) { .input, .select, .textarea { font-size: 16px; } }
.search { position: relative; flex: 1 1 260px; min-width: 0; }
.field > .search { flex: 0 0 auto; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .input { padding-left: 34px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 16px; }
.form-grid .span-all { grid-column: 1 / -1; }
.check { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--primary); flex-shrink: 0; }
@media (pointer: coarse) { .check { min-height: 44px; align-items: center; } .check input { width: 20px; height: 20px; margin: 0; } }
.hint { font-size: 13px; color: var(--muted); }
.error-text { font-size: 13px; font-weight: 550; color: var(--danger); }
.divider { height: 1px; background: var(--line); margin: 4px 0; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-ctl); background: var(--n-100); color: var(--ink-2); font-size: 13.5px; }
.notice svg { margin-top: 1px; color: var(--muted); }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.ok svg { color: var(--ok); }
.notice.warn { background: var(--warn-bg); color: var(--warn-ink); }
.notice.warn svg { color: var(--warn-ink); }
.notice.error { background: var(--danger-bg); color: var(--danger); }

/* interrupteur */
.switch { width: 52px; height: 36px; border: 0; background: transparent; padding: 0; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; border-radius: 999px; }
.switch-track { position: relative; width: 36px; height: 20px; border-radius: 999px; background: var(--n-300); transition: background-color 0.15s ease; display: block; }
.switch-knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 2px rgba(15, 31, 39, 0.3); transition: transform 0.15s ease; display: block; }
.switch[aria-checked="true"] .switch-track { background: var(--primary); }
.switch[aria-checked="true"] .switch-knob { transform: translateX(16px); }
.switch:disabled { cursor: progress; opacity: 0.6; }
@media (pointer: coarse) { .switch { height: 44px; width: 60px; } .switch-track { width: 44px; height: 26px; } .switch-knob { width: 22px; height: 22px; } .switch[aria-checked="true"] .switch-knob { transform: translateX(18px); } }

/* ------------------------------------------------------------ fiche client */
.amb-head { display: flex; align-items: center; gap: 12px; }
.amb-head .grow { flex: 1; min-width: 0; }
.amb-head h2 { display: flex; align-items: center; gap: 8px; }
.tile { width: 36px; height: 36px; border-radius: var(--r-ctl); background: var(--n-150); color: var(--ink-2); display: grid; place-items: center; flex-shrink: 0; }
.tile.amb { background: var(--amb-bg); color: var(--amb-ink); }
.tile.ok { background: var(--ok-bg); color: var(--ok); }
.card-num { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }

/* ------------------------------------------------------------ venue */
.venue-bar { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 16px 24px; }
.venue-bar .status { margin: 0; }
.stick-sentinel { height: 0; margin-bottom: -20px; }
.venue-bar .grow { flex: 999 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.venue-count { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.venue-count strong { font-size: 18px; font-weight: 600; letter-spacing: -0.012em; font-variant-numeric: tabular-nums; }
.venue-bar .btn { flex: 0 1 240px; }
.progress { display: flex; gap: 4px; }
.progress span { flex: 1; height: 6px; border-radius: 1px; background: var(--n-200); transition: background-color 0.2s ease; }
.progress span.on { background: var(--primary); }
.progress.ready span.on { background: var(--ok); }
.status { font-size: 13px; color: var(--muted); font-weight: 500; }
.status.ready { color: var(--ok); }
.pick { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 6px 10px; border-radius: var(--r-ctl); border: 0; background: transparent; text-align: left; cursor: pointer; }
.pick:hover { background: var(--n-100); }
.pick .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0; }
.pick .add { color: var(--primary-text); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.section-label { font-size: 12.5px; font-weight: 550; color: var(--muted); }
.email-fix { flex-basis: 100%; padding-left: 44px; }

/* venue validée */
.done-head { display: flex; align-items: center; gap: 14px; }
.done-check { width: 44px; height: 44px; border-radius: 50%; background: var(--ok); color: #FFFFFF; display: grid; place-items: center; flex-shrink: 0; }
.reward { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--r-ctl); background: var(--amb-bg); }
.reward strong { display: block; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }

/* ------------------------------------------------------------ scanner */
.scanner { padding: 0; gap: 0; overflow: hidden; }
.scanner-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; }
.scanner-bar .select { width: auto; max-width: 100%; }
.scanner-view { position: relative; background: #0B0B0B; min-height: 380px; overflow: hidden; display: grid; place-items: center; }
.scanner-view video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner-frame { position: relative; width: 220px; height: 220px; pointer-events: none; }
.scanner-frame i { position: absolute; width: 36px; height: 36px; border: 3px solid var(--brand); }
.scanner-frame i:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 4px; }
.scanner-frame i:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 4px; }
.scanner-frame i:nth-child(3) { left: 0; bottom: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 4px; }
.scanner-frame i:nth-child(4) { right: 0; bottom: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 4px; }
.scanner-msg { position: absolute; left: 16px; right: 16px; bottom: 14px; text-align: center; font-size: 13px; color: #C9CDD0; }
.result-ok { box-shadow: inset 0 0 0 1px var(--ok), var(--elev); }
.result-err { box-shadow: inset 0 0 0 1px var(--danger), var(--elev); }
.result-title { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ok); }
.result-err .result-title { color: var(--danger); }
.result-name { font-size: 18px; font-weight: 600; letter-spacing: -0.012em; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }

/* ------------------------------------------------------------ réglages : identité visuelle */
.logo-zone { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 16px 20px; align-items: center; }
.logo-preview { background: var(--topbar); border-radius: var(--r-ctl); min-height: 76px; padding: 16px 20px; display: flex; align-items: center; color: var(--band-ink); }
.logo-preview img { max-height: 44px; max-width: 100%; width: auto; object-fit: contain; display: block; }
.logo-preview .brand-name { font-size: 18px; }
.color-row { display: flex; gap: 8px; align-items: center; }
.color-row input[type="color"] { flex: 0 0 44px; width: 44px; height: var(--ctl-h); padding: 3px; border: 1px solid var(--control); border-radius: var(--r-ctl); background: var(--surface); cursor: pointer; }
.color-row .input { font-variant-numeric: tabular-nums; text-transform: uppercase; }
@media (max-width: 760px) { .logo-zone { grid-template-columns: minmax(0, 1fr); } }

/* ------------------------------------------------------------ connexion */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: var(--r-card); box-shadow: var(--elev-pop); overflow: hidden; }
.auth-brand { background: var(--topbar); padding: 22px 28px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth-brand img { height: 44px; width: auto; display: block; }
.auth-brand span { color: var(--band-muted); font-size: 13px; font-weight: 500; text-align: right; }
.auth-brand .brand-name { font-size: 18px; text-align: left; }
.auth-brand img { max-width: 220px; object-fit: contain; }
.auth-body { padding: 24px 28px 28px; display: flex; flex-direction: column; gap: 16px; }
.auth-body .btn { margin-top: 4px; }

/* ------------------------------------------------------------ fenêtres et notifications */
.modal { border: 0; border-radius: var(--r-card); padding: 0; width: min(440px, calc(100vw - 32px)); box-shadow: var(--elev-pop); color: var(--ink); }
.modal::backdrop { background: rgba(15, 31, 39, 0.4); }
.modal form { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.modal h2 { font-size: 16px; }
.modal p { color: var(--ink-2); }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 8px; }
#toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; align-items: center; gap: 8px; width: max-content; max-width: min(460px, calc(100vw - 32px)); }
.toast { background: #1A1A1A; color: #FFFFFF; padding: 10px 14px; border-radius: var(--r-ctl); font-size: 13.5px; font-weight: 500; box-shadow: var(--elev-pop); transition: opacity 0.25s ease, transform 0.25s ease; }
.toast-error { background: var(--danger); }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ------------------------------------------------------------ écrans moyens et étroits */
@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (max-width: 1023px) {
  .shell { flex-direction: column; min-height: 0; background: none; }
  .side {
    position: sticky; top: 56px; z-index: 20; width: auto; height: auto; padding: 0 12px; overflow: visible;
    flex-direction: row; background: var(--surface); box-shadow: 0 1px 0 var(--line);
  }
  .nav { flex-direction: row; gap: 0; overflow-x: auto; width: 100%; min-width: 0; scrollbar-width: none; }
  .nav-item { flex-shrink: 0; height: 46px; border-radius: 0; padding: 0 12px; box-shadow: inset 0 -2px 0 transparent; color: var(--ink-2); }
  .nav-item svg { color: var(--muted); }
  .nav-item:hover { background: transparent; color: var(--ink); }
  .nav-item.active { background: transparent; color: var(--ink); box-shadow: inset 0 -2px 0 var(--brand); }
  .side .nav-item:focus-visible { outline-color: var(--brand); }
  .wrap { width: 100%; }
  .side-foot { display: none; }
  .main { padding: 20px 20px 64px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .venue-bar { position: sticky; top: 112px; z-index: 15; box-shadow: 0 -10px 0 var(--bg), var(--elev); transition: box-shadow 0.15s ease; }
  .venue-bar.is-stuck { box-shadow: 0 -10px 0 var(--bg), var(--elev-pop); }
}
@media (max-width: 760px) {
  .topbar { gap: 4px; padding: 0 max(8px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left)); }
  .brand img { height: 32px; }
  .brand-sep, .brand-app { display: none; }
  .top-search { display: none; }
  .top-phone { display: grid; }
  .top-actions { margin-left: auto; }
  .top-actions { gap: 2px; }
  .top-actions .btn-on-dark, .top-logout { display: none; }
  .top-user .who-name { display: none; }
  .top-user { padding: 0 8px; }

  /* navigation en bas de l'écran, à portée du pouce ; « Scanner » en orangé, à droite */
  .side {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; z-index: 40; height: auto;
    padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    background: var(--side-bg); box-shadow: 0 -1px 0 rgba(15, 31, 39, 0.12);
  }
  .nav { gap: 4px; overflow: visible; }
  .nav-item {
    flex: 1 1 0; min-width: 0; flex-direction: column; justify-content: center; gap: 3px; height: 52px; padding: 0 2px;
    border-radius: var(--r-ctl); box-shadow: none; color: var(--side-ink); font-size: 12px; font-weight: 550; line-height: 1.2;
  }
  .nav-item svg { display: block; width: 22px; height: 22px; color: var(--side-muted); }
  .nav-item:hover { background: transparent; color: var(--side-strong); }
  .nav-item.active { background: var(--side-veil-on); color: var(--side-strong); box-shadow: none; }
  .nav-item.active svg { color: var(--side-mark); }
  .side .nav-item:focus-visible { outline-color: var(--side-strong); }
  .lbl { display: none; }
  .lbl-short { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-settings, .nav-amb { display: none; }
  .nav-item.active-sm { background: var(--side-veil-on); color: var(--side-strong); }
  .nav-item.active-sm svg { color: var(--side-mark); }
  .nav-item.nav-scan { display: flex; background: var(--primary); color: #FFFFFF; }
  /* pendant la saisie, le clavier du téléphone prend la place : la barre du bas se retire */
  html:has(.main :is(input, textarea, select):focus) .side { display: none; }
  .nav-scan svg, .nav-scan.active svg { color: #FFFFFF; }
  .nav-scan:hover, .nav-scan.active { background: var(--primary-hover); color: #FFFFFF; }

  .main { padding: 16px max(14px, env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); }
  #toasts { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .venue-bar { top: 66px; }
  .venue-bar .status { display: none; }
  .show-sm { display: inline-flex; }
  .user-meta.show-sm { display: block; font-size: 13px; font-weight: 400; color: var(--muted); }
  .page-head .actions .btn { flex: 1 1 auto; }
  .list-item .ellipsis { white-space: normal; overflow-wrap: anywhere; }
  .done-actions { width: 100%; flex-direction: column-reverse; }
  .done-actions .btn { width: 100%; }

  /* fenêtres de confirmation : panneau qui monte du bas, boutons pleine largeur */
  .modal { width: 100%; max-width: none; margin: auto 0 0; border-radius: var(--r-card) var(--r-card) 0 0; max-height: 92vh; }
  .modal form { padding: 20px max(16px, env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .modal-actions { flex-direction: column-reverse; gap: 8px; }
  .modal-actions .btn { width: 100%; height: var(--ctl-h-lg); }
  h1 { font-size: 20px; }
  .btn { white-space: normal; text-align: center; }
  .page-head .actions { width: 100%; }
  .metric { padding: 12px 16px 14px; }
  .metric-value { font-size: 20px; }
  .email-fix { padding-left: 0; }
  .venue-bar { gap: 12px; padding: 12px 14px; }
  .venue-bar .btn { flex: 1 1 100%; }
  .hide-sm { display: none; }
  .table { min-width: 0; }
  .table td.nowrap { white-space: normal; }
}
/* ------------------------------------------------------------ écran tactile : aucune cible sous 44 px */
@media (pointer: coarse) {
  .top-icon { width: 44px; height: 44px; }
  .top-user { height: 44px; }
  .top-search input { height: 44px; font-size: 16px; }
  .brand { min-height: 44px; }
  .btn-sm { height: var(--ctl-h); padding: 0 14px; font-size: 14px; }
  .chip { height: var(--ctl-h); }
  .back, .card-link, .link-btn { min-height: 44px; display: inline-flex; align-items: center; }
  .back { margin-bottom: -14px; }
  .card-head .card-link { margin: -12px 0; }
  .who { min-height: 44px; }
  .table td { padding-top: 4px; padding-bottom: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
