/* Radar Achat-Revente — thème commun : bleu nuit + orange */
:root {
  --bg: #f3f5fa; --panel: #ffffff; --fg: #0f1b2d; --muted: #5b6b82; --line: #e2e8f0;
  --navy: #0b1f3a; --navy-2: #163a6b; --accent: #f97316; --accent-2: #ea580c; --accent-fg: #ffffff;
  --ok: #15803d; --ok-bg: #e7f6ec; --warn: #b45309; --warn-bg: #fff4e3; --bad: #dc2626; --bad-bg: #fdecec;
  --chip: #edf1f7; --blue: #2563eb; --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 27, 45, .05), 0 6px 20px rgba(15, 27, 45, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1424; --panel: #111f36; --fg: #e8eef8; --muted: #93a3bd; --line: #22375a;
    --navy: #06101f; --navy-2: #12305a; --accent: #fb923c; --accent-2: #f97316; --accent-fg: #1a0d04;
    --ok: #4ade80; --ok-bg: #0f2e1d; --warn: #fbbf24; --warn-bg: #33270d; --bad: #f87171; --bad-bg: #3a1414;
    --chip: #1a2b47; --blue: #60a5fa; --shadow: none; color-scheme: dark;
  }
}
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1 { font: 750 26px/1.15 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif !important; letter-spacing: -.02em; margin: 0; }
a { color: inherit; }
html:not([data-role=admin]) .admin-only { display: none !important; }
.wrap > * { min-width: 0; }   /* un élément trop large ne doit jamais élargir la page sur téléphone */

/* ---------- bandeau de navigation ---------- */
.rhead { position: sticky; top: 0; z-index: 900; background: var(--navy); color: #fff; box-shadow: 0 2px 12px rgba(0, 0, 0, .18); }
.rhead .in { max-width: 1500px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 18px; min-height: 58px; }
.rbrand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; font-weight: 750; font-size: 16px; white-space: nowrap; }
.rbrand .logo { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, #fb923c, #ea580c); display: grid; place-items: center; font-size: 16px; font-weight: 800; color: #fff; }
.rbrand small { font-weight: 500; color: rgba(255, 255, 255, .65); }
.rlinks { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.rlinks::-webkit-scrollbar { display: none; }
.rlinks a { color: rgba(255, 255, 255, .75); text-decoration: none; font-size: 14px; font-weight: 600; padding: 8px 12px; border-radius: 999px; white-space: nowrap; }
.rlinks a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.rlinks a.on { color: #fff; background: var(--accent-2); }
.rlinks a .badge { background: #fff; color: var(--accent-2); border-radius: 999px; padding: 0 6px; margin-left: 5px; font-size: 11px; }
.ruser { display: flex; align-items: center; gap: 8px; font-size: 13px; color: rgba(255, 255, 255, .8); white-space: nowrap; }
.ruser button, .ruser a { background: rgba(255, 255, 255, .1); color: #fff; border: 0; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; text-decoration: none; }
.ruser button:hover, .ruser a:hover { background: rgba(255, 255, 255, .18); }
.rlinks a[aria-current] { box-shadow: none; }
/* sous-menu : les pages de la rubrique, une seule barre */
.rsous { background: var(--navy-2); }
.rhead .rsous .in { max-width: 1500px; margin: 0 auto; padding: 0 16px; display: flex; flex-wrap: nowrap; gap: 4px; min-height: 0; overflow-x: auto; scrollbar-width: none; }
.rsous .in::-webkit-scrollbar { display: none; }
.rsous a { color: rgba(255, 255, 255, .78); text-decoration: none; font-size: 13.5px; font-weight: 600; padding: 9px 12px 7px; border-bottom: 3px solid transparent; white-space: nowrap; }
.rsous a:hover { color: #fff; }
.rsous a.on { color: #fff; border-bottom-color: var(--accent); }
.rsous a .badge { background: #fff; color: var(--accent-2); border-radius: 999px; padding: 0 6px; margin-left: 5px; font-size: 11px; }
/* compte */
.ruser { position: relative; }
.ruser .rcompte { display: flex; align-items: center; gap: 7px; padding: 4px 10px 4px 4px; }
.ruser .rcompte .ini { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 750; font-size: 13px; }
.ruser .rcompte .nom { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.rmenu { position: absolute; right: 0; top: calc(100% + 8px); background: var(--panel); color: var(--fg); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); padding: 6px; min-width: 230px; z-index: 950; display: grid; gap: 2px; }
.rmenu[hidden] { display: none; }
.rmenu .qui { font-size: 12px; color: var(--muted); padding: 6px 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; white-space: normal; overflow-wrap: anywhere; }
.ruser .rmenu button, .ruser .rmenu a { background: none; color: var(--fg); text-align: left; border-radius: 8px; padding: 9px 10px; font-size: 14px; }
.ruser .rmenu button:hover, .ruser .rmenu a:hover { background: var(--chip); }
@media (max-width: 1100px) { .ruser .rcompte .nom { display: none; } .ruser .rcompte { padding: 4px; } }
@media (max-width: 760px) {
  .rhead .in { flex-wrap: wrap; gap: 6px 12px; padding: 8px 12px; }
  .rlinks { order: 3; flex-basis: 100%; }
  .ruser { margin-left: auto; }
  .rhead .rsous .in { padding: 0 12px; flex-wrap: nowrap; gap: 2px; }
}

/* éléments déplacés dans Administration (recherches, réglages) : gardés dans la page pour son code, jamais affichés */
.depl { display: none !important; }
.rregl { font-size: 12.5px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.rregl:hover { color: var(--fg); text-decoration: underline; }
/* fiabilité d'une affaire */
.rfiab { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; cursor: help; white-space: nowrap; }
.rfiab.ok { background: var(--ok-bg); color: var(--ok); }
.rfiab.moy { background: var(--warn-bg); color: var(--warn); }
.rfiab.bas { background: var(--bad-bg); color: var(--bad); }

/* ---------- éléments communs ---------- */
.rbtn { font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; border-radius: 10px; padding: 9px 16px; border: 1px solid var(--line); background: var(--panel); color: var(--fg); text-decoration: none; display: inline-block; }
.rbtn:hover { border-color: var(--muted); }
.rbtn.p { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.rbtn.p:hover { background: var(--accent-2); border-color: var(--accent-2); }
.rbtn.s { font-size: 12px; padding: 6px 11px; background: var(--chip); border-color: var(--chip); border-radius: 8px; }
.rbtn.s.p { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.rbtn:disabled { opacity: .5; cursor: default; }
.rbtn[hidden] { display: none; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.kpi .v { font: 750 26px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif !important; letter-spacing: -.02em; }
.rtoast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 14px; z-index: 2000; box-shadow: 0 6px 24px rgba(0, 0, 0, .3); max-width: 90vw; text-align: center; }
.rcheck { font-size: 12px; margin: 0; padding-left: 18px; }
.rcheck li { margin: 2px 0; }
.chip.contact { background: var(--blue); color: #fff; }

/* ---------- fenêtres ---------- */
.rmodal-fond { position: fixed; inset: 0; background: rgba(6, 16, 31, .55); display: flex; align-items: flex-end; justify-content: center; z-index: 1000; }
@media (min-width: 700px) { .rmodal-fond { align-items: center; } }
.rmodal { background: var(--panel); color: var(--fg); width: min(640px, 100%); max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 18px; display: grid; gap: 10px; box-shadow: 0 10px 40px rgba(0, 0, 0, .3); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
@media (min-width: 700px) { .rmodal { border-radius: 18px; } }
.rmodal h2 { margin: 0; font-size: 18px; }
.rmodal .sous { color: var(--muted); font-size: 12px; }
.rmodal label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.rmodal input, .rmodal select, .rmodal textarea { font: inherit; font-size: 14px; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px; width: 100%; box-sizing: border-box; }
.rmodal textarea { min-height: 170px; resize: vertical; }
.rmodal .ligne { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rmodal .actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.rmodal .err { color: var(--bad); font-size: 13px; }

/* ---------- bouton « retour en haut » (pages longues) ---------- */
.rhaut { position: fixed; right: 18px; bottom: 22px; z-index: 950; width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(11, 31, 58, .55); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 4px 16px rgba(0, 0, 0, .2);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity .25s, transform .25s, background .2s; }
.rhaut.on { opacity: 1; transform: none; pointer-events: auto; }
.rhaut:hover, .rhaut:focus-visible { background: rgba(234, 88, 12, .85); }
.rhaut svg { width: 22px; height: 22px; }
@media (max-width: 600px) { .rhaut { right: 14px; bottom: 16px; width: 44px; height: 44px; } }

/* ---------- moteurs / boîtes à problèmes ---------- */
.chip.mp, .b.mp { background: #9a3412; color: #fff; }
.mpbtn { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.rbtn.mp-toggle.on { background: var(--bad); border-color: var(--bad); color: #fff; }
.mp-liste { display: grid; gap: 10px; max-height: 55vh; overflow: auto; padding-right: 4px; }
.rmodal label.mp-l { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; color: var(--fg); font-size: 14px; cursor: pointer; }
.rmodal label.mp-l input { width: auto; margin-top: 3px; }
.mp-l small { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; }
.mp-note { font-size: 12px; color: #9a3412; margin-top: 4px; }
@media (prefers-color-scheme: dark) { .mp-note { color: #fdba74; } }

/* ---------- synchro rapide ---------- */
.ruser .rsync-btn { background: var(--accent); color: #fff; font-weight: 700; }
.ruser .rsync-btn:hover { background: var(--accent-2); }
.ruser .rsync-btn.on { animation: rpulse 1.2s ease-in-out infinite; }
@keyframes rpulse { 50% { opacity: .65; } }
.rsync { position: fixed; left: 18px; bottom: 22px; z-index: 960; width: min(420px, calc(100vw - 36px)); background: var(--navy); color: #fff;
  border-radius: 14px; padding: 14px 16px; box-shadow: 0 10px 36px rgba(0, 0, 0, .35); display: grid; gap: 6px; font-size: 14px; }
.rsync[hidden] { display: none; }
.rsync-t { font-weight: 700; }
.rsync-s { color: rgba(255, 255, 255, .8); font-size: 13px; line-height: 1.4; }
.rsync-a { display: flex; gap: 8px; justify-content: flex-end; }
.rsync .rbtn.s:not(.p) { background: rgba(255, 255, 255, .12); color: #fff; border-color: transparent; }
@media (max-width: 760px) { .ruser .rsync-btn { padding: 6px 10px; } .rsync { left: 12px; bottom: 74px; } }

/* ---------- appli téléphone : barre d'onglets en bas, feuille « Plus », confort tactile ---------- */
.rtab { display: none; }
.rplus-t { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 10px 2px 2px; }
.rplus-qui { font-size: 13px; color: var(--muted); padding: 0 2px 4px; overflow-wrap: anywhere; }
.rplus .rplus-l { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; box-sizing: border-box; text-align: left;
  background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; font: inherit; font-size: 15px; font-weight: 600;
  text-decoration: none; cursor: pointer; margin-top: 6px; }
.rplus .rplus-l::after { content: "›"; color: var(--muted); font-size: 18px; line-height: 1; }
.rplus .rplus-l small { color: var(--muted); font-weight: 500; margin-left: auto; }
@media (max-width: 760px) {
  .rlinks { display: none; }                       /* le menu du haut est remplacé par la barre du bas */
  .rhead .in { min-height: 52px; }
  .rtab { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 940;
    background: var(--panel); border-top: 1px solid var(--line); box-shadow: 0 -4px 18px rgba(6, 16, 31, .10);
    padding: 0 max(4px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(4px, env(safe-area-inset-left)); }
  .rtab a, .rtab button { display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 56px; padding: 6px 2px 5px; border: 0; background: none;
    color: var(--muted); font: inherit; font-size: 11px; font-weight: 600; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .rtab svg { width: 23px; height: 23px; }
  .rtab .on { color: var(--accent-2); }
  .rtab a:active, .rtab button:active { background: var(--chip); }
  html.rtabbar body { padding-bottom: calc(58px + env(safe-area-inset-bottom)); box-sizing: border-box; }
  html.rtabbar .rhaut { bottom: calc(70px + env(safe-area-inset-bottom)); }
  html.rtabbar .rsync { bottom: calc(70px + env(safe-area-inset-bottom)); }
  html.rtabbar .rtoast { bottom: calc(74px + env(safe-area-inset-bottom)); }
  .rmodal { padding-bottom: calc(18px + env(safe-area-inset-bottom)); max-height: 88vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  /* iPhone : un champ de moins de 16 px fait zoomer toute la page quand on tape dedans */
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]), select, textarea { font-size: 16px !important; }
}
/* appli installée : pas de sélection de texte accidentelle sur les barres */
html.rinstallee .rhead, html.rinstallee .rtab { -webkit-user-select: none; user-select: none; }
