/* app-bons.css — styles communs Bons de commande Pluralis (agent terrain / RP / CS)
   Adapté de app-hotel.css — palette charte Altitude (cf. CHARTE_GRAPHIQUE.md), mobile-first. */

:root {
  --bg: #f7f8fb; --surface: #ffffff; --card: #ffffff; --border: #e5e9f2;
  --blue: #1e3a8a; --blue-glow: #3b82f6; --cyan: #0891b2;
  --text: #0f172a; --text2: #475569; --text3: #94a3b8; --white: #ffffff;
  --green: #059669; --green-bg: #ecfdf5;
  --red: #dc2626; --red-bg: #fef2f2;
  --yellow: #d97706; --yellow-bg: #fffbeb;
  --purple: #7c3aed; --purple-bg: #f5f3ff;
  --orange: #ea580c; --orange-bg: #fff7ed;
  --gray-bg: #f1f5f9;
  --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-full: 999px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 14px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg); color: var(--text); min-height: 100%;
  padding-bottom: env(safe-area-inset-bottom);
}
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px 14px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue-glow); outline-offset: -1px; }

/* ── Header ── */
.hd {
  position: sticky; top: 0; z-index: 20;
  background: var(--blue); color: var(--white);
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  display: flex; align-items: center; gap: 10px;
}
.hd h1 { font-size: 17px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-btn {
  width: 38px; height: 38px; border-radius: var(--r-full); flex: 0 0 auto;
  background: rgba(255, 255, 255, .14); color: var(--white);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.hd-sub { font-size: 12px; opacity: .8; font-weight: 500; }

/* ── Conteneur / cartes ── */
.wrap { padding: 16px; max-width: 720px; margin: 0 auto; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px;
}
.muted { color: var(--text2); font-size: 13px; }
.titre-section { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text3); margin: 18px 0 8px; }

/* ── Boutons ── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px; border-radius: var(--r-md); font-weight: 700; font-size: 16px;
}
.btn-primary { background: var(--blue); color: var(--white); }
.btn-success { background: var(--green); color: var(--white); }
.btn-danger  { background: var(--red); color: var(--white); }
.btn-ghost   { background: var(--gray-bg); color: var(--text); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-big { padding: 20px; font-size: 19px; border-radius: var(--r-lg); }
.btn-ligne { display: flex; gap: 10px; }
.btn-ligne .btn { flex: 1; }

/* ── Choix du type de demande (3 gros boutons, agents terrain) ── */
.choix-type {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow); padding: 18px 16px; margin-bottom: 10px;
}
.choix-type .ico {
  width: 46px; height: 46px; border-radius: var(--r-md); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
}
.choix-type .t { font-size: 16px; font-weight: 800; }
.choix-type .s { font-size: 12px; color: var(--text2); margin-top: 2px; }
.ico-encombrants { background: var(--orange-bg); color: var(--orange); }
.ico-sacs        { background: var(--red-bg); color: var(--red); }
.ico-divers      { background: var(--purple-bg); color: var(--purple); }

/* ── Badges statut demande ── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--r-full); font-size: 12px; font-weight: 700;
}
.st-A_CHIFFRER { background: #ecfeff; color: var(--cyan); }
.st-EN_ATTENTE { background: var(--yellow-bg); color: var(--yellow); }
.st-VALIDEE    { background: #eff6ff; color: #1d4ed8; }   /* validée — à réaliser */
.st-REALISEE   { background: #f5f3ff; color: #7c3aed; }   /* réalisée — bon à éditer */
.st-TERMINEE   { background: var(--green-bg); color: var(--green); }
.st-ACCEPTEE   { background: var(--green-bg); color: var(--green); }  /* rétro-compat */
.st-REFUSEE    { background: var(--red-bg); color: var(--red); }

/* ── Filtres (chips) ── */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; }
.chip {
  flex: 0 0 auto; padding: 8px 14px; border-radius: var(--r-full);
  background: var(--surface); border: 1px solid var(--border);
  font-size: 13px; font-weight: 700; color: var(--text2); white-space: nowrap;
}
.chip.actif { background: var(--blue); border-color: var(--blue); color: var(--white); }

/* ── Sélection du lieu (montées les plus proches) ── */
.site-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 12px; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); margin-bottom: 8px;
}
.site-item.sel { border-color: var(--blue); background: #eff6ff; }
.site-item .dist { flex: 0 0 auto; font-size: 12px; font-weight: 800; color: var(--blue); }
.site-item .t { font-weight: 700; font-size: 14px; }
.site-item .s { font-size: 12px; color: var(--text2); margin-top: 1px; }

/* ── Photos ── */
.photos-ligne { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.photo-bloc { position: relative; }
.photo-mini { width: 84px; height: 84px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--border); display: block; }
.photo-x {
  position: absolute; top: -8px; right: -8px; width: 26px; height: 26px;
  border-radius: var(--r-full); background: var(--red); color: var(--white);
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow);
}

/* ── Stepper m³ ── */
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper button {
  width: 52px; height: 52px; border-radius: var(--r-md); flex: 0 0 auto;
  background: var(--gray-bg); font-size: 24px; font-weight: 800; color: var(--text);
}
.stepper input { text-align: center; font-size: 20px; font-weight: 800; }

/* ── Modal bottom-sheet ── */
.modal-fond {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 40;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: var(--surface); border-radius: var(--r-lg) var(--r-lg) 0 0;
  width: 100%; max-width: 720px; max-height: 92vh; overflow-y: auto;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
}
.modal h2 { font-size: 18px; margin-bottom: 14px; }
.champ { margin-bottom: 14px; }
.champ label { display: block; font-size: 13px; font-weight: 600; color: var(--text2); margin-bottom: 6px; }

/* ── Onglets bas (app Pluralis : Demandes / Admin) ── */
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex; background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  flex: 1; padding: 10px 4px 12px; text-align: center;
  font-size: 11px; font-weight: 600; color: var(--text3);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.tabs button .ico { display: flex; align-items: center; justify-content: center; }
.tabs button.actif { color: var(--blue); }
.avec-tabs { padding-bottom: 86px; }

/* ── Lignes de liste ── */
.ligne {
  display: flex; align-items: center; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.ligne:last-child { border-bottom: none; }
.ligne .principal { flex: 1; min-width: 0; }
.ligne .titre { font-weight: 700; font-size: 15px; }
.ligne .sous { font-size: 12px; color: var(--text2); margin-top: 2px; }
.ligne .ico-type {
  width: 38px; height: 38px; border-radius: var(--r-sm); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
}

/* ── Détail : tableau de champs ── */
.fiche { border-top: 1px solid var(--border); }
.fiche-ligne { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.fiche-ligne .k { flex: 0 0 118px; font-size: 12px; color: var(--text3); font-weight: 600; padding-top: 2px; }
.fiche-ligne .v { flex: 1; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }

/* ── Divers ── */
.vide { text-align: center; color: var(--text3); padding: 32px 12px; font-size: 14px; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 60;
  background: #111827; color: var(--white); padding: 12px 18px;
  border-radius: var(--r-full); font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow); max-width: 90vw; text-align: center;
}
.pastille {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-full);
  background: var(--red); color: var(--white); font-size: 11px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
}
.ecran-login { max-width: 380px; margin: 0 auto; padding: 40px 20px; text-align: center; }
.ecran-login .logo-titre { font-size: 22px; font-weight: 800; color: var(--blue); margin: 12px 0 4px; }

/* Code secret affiché une seule fois (création compte) */
.mdp-genere {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 22px; font-weight: 800; letter-spacing: 2px; text-align: center;
  background: var(--gray-bg); border-radius: var(--r-sm); padding: 14px; margin: 10px 0;
  user-select: all; -webkit-user-select: all;
}
