/* ===== Suivi Chantiers — mobile-first — charte Aqua'Bio (eau, épuré) ===== */
:root {
  --bleu: #085a9c; --bleu2: #0a72c2; --cyan: #66c6f5; --accent: #e63946; --ok: #0d9488; --warn: #e9c46a;
  --fond: #f5f5f5; --carte: #ffffff; --texte: #1e3a4c; --gris: #64748b; --bord: #e2e8f0;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; background: var(--fond); color: var(--texte); padding-bottom: 76px; }
a { color: var(--bleu2); text-decoration: none; }
h1 { font-size: 1.35rem; margin: .8rem 0; }
h2 { font-size: 1.05rem; margin: 1.2rem 0 .5rem; }
h3 { font-size: .95rem; margin: .8rem 0 .4rem; }

.container { max-width: 1100px; margin: 0 auto; padding: 12px 14px 40px; }

/* --- barre du haut --- */
.topbar { background: linear-gradient(120deg, #085a9c, #0e9fd8); color: #fff; display: flex; align-items: center; gap: 14px; padding: 10px 16px; position: sticky; top: 0; z-index: 50; }
.brand { color: #fff; font-weight: 700; font-size: 1.05rem; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.brand img { height: 34px; background: #fff; border-radius: 8px; padding: 3px 8px; display: block; }
.login-logo img { max-height: 72px; max-width: 220px; }
.topnav { display: none; gap: 4px; flex: 1; }
.topnav a { color: #cfd9e6; padding: 7px 12px; border-radius: 8px; font-size: .92rem; }
.topnav a.on, .topnav a:hover { background: rgba(255,255,255,.14); color: #fff; }
.userbox { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.userbox a { color: #fff; font-size: .9rem; }
.uname { display: none; }
.btn-ghost { background: transparent; border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 8px; padding: 4px 10px; cursor: pointer; font-size: 1rem; }

/* --- navigation basse (mobile) --- */
.bottomnav { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--bord); display: flex; z-index: 50; padding-bottom: env(safe-area-inset-bottom); }
.bottomnav a { flex: 1; text-align: center; padding: 8px 2px 6px; font-size: .68rem; color: var(--gris); display: flex; flex-direction: column; gap: 2px; }
.bottomnav a .ic { font-size: 1.25rem; }
.bottomnav a.on { color: var(--bleu); font-weight: 600; }

@media (min-width: 860px) {
  body { padding-bottom: 0; }
  .topnav { display: flex; }
  .uname { display: inline; }
  .bottomnav { display: none; }
  h1 { font-size: 1.6rem; }
}

/* --- cartes, listes --- */
.card { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.card h2:first-child { margin-top: 0; }
.list { display: flex; flex-direction: column; gap: 10px; }
.item { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--radius); padding: 12px 14px; display: block; color: var(--texte); }
.item:active { background: #eef2f7; }
.item .t { font-weight: 600; }
.item .s { color: var(--gris); font-size: .85rem; margin-top: 2px; }

.grid2 { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 860px) { .grid2 { grid-template-columns: 1fr 1fr; } }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 860px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--radius); padding: 12px; text-align: center; }
.stat .n { font-size: 1.6rem; font-weight: 700; color: var(--bleu); }
.stat .l { color: var(--gris); font-size: .8rem; }

/* --- badges --- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: .74rem; font-weight: 600; }
.b-prospect { background: #dcf0fd; color: #085a9c; }
.b-vendu, .b-termine { background: #ccfbf1; color: #0f766e; }
.b-perdu { background: #fbe0e2; color: #b02a35; }
.b-planifie { background: #fdf1d6; color: #9a7413; }
.b-en_cours { background: #d8f2fe; color: #0a72c2; }

/* --- formulaires --- */
label { display: block; font-size: .82rem; font-weight: 600; color: var(--gris); margin: 10px 0 4px; }
input[type=text], input[type=tel], input[type=email], input[type=date], input[type=number], input[type=password], select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--bord); border-radius: 10px; font-size: 16px; background: #fff; color: var(--texte);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #8fd4f8; border-color: var(--bleu2); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }

.btn { display: inline-block; background: var(--bleu); color: #fff; border: none; border-radius: 10px; padding: 11px 18px; font-size: .95rem; font-weight: 600; cursor: pointer; margin-top: 10px; }
.btn:active { background: var(--bleu2); }
.btn-ok { background: var(--ok); }
.btn-danger { background: var(--accent); }
.btn-sm { padding: 6px 12px; font-size: .82rem; margin-top: 0; }
.btn-line { background: transparent; color: var(--bleu); border: 1px solid var(--bleu); }
.inline { display: inline; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0; }

.alert { padding: 10px 14px; border-radius: 10px; margin: 10px 0; font-size: .9rem; }
.a-err { background: #fbe0e2; color: #b02a35; }
.a-ok { background: #ccfbf1; color: #0f766e; }

/* --- tableaux --- */
.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th { text-align: left; color: var(--gris); font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; padding: 8px 8px; border-bottom: 2px solid var(--bord); }
.tbl td { padding: 9px 8px; border-bottom: 1px solid var(--bord); vertical-align: top; }
.tbl-wrap { overflow-x: auto; }
.num { text-align: right; white-space: nowrap; }

/* --- photos --- */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin: 8px 0; }
.photos a { position: relative; display: block; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 1px solid var(--bord); }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos form { position: absolute; top: 4px; right: 4px; }
.photos form button { background: rgba(0,0,0,.55); color: #fff; border: none; border-radius: 6px; padding: 2px 7px; cursor: pointer; font-size: .8rem; }
.photo-add { border: 2px dashed var(--bord); border-radius: 10px; padding: 10px; text-align: center; }
.photo-add input[type=file] { width: 100%; font-size: .85rem; }

/* --- planning --- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-head .mois { font-weight: 700; font-size: 1.05rem; text-transform: capitalize; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { text-align: center; font-size: .7rem; color: var(--gris); font-weight: 700; padding: 4px 0; text-transform: uppercase; }
.cal .day { background: var(--carte); border: 1px solid var(--bord); border-radius: 8px; min-height: 64px; padding: 3px; font-size: .72rem; }
.cal .day .dn { color: var(--gris); font-size: .68rem; padding-left: 2px; }
.cal .day.today { border-color: var(--bleu); border-width: 2px; }
.cal .day.off { background: transparent; border: none; }
.cal .ev { display: block; border-radius: 5px; padding: 2px 4px; margin-top: 2px; color: #fff; font-size: .66rem; line-height: 1.25; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ev-planifie { background: #c99b1f; } .ev-en_cours { background: #0e9fd8; } .ev-termine { background: #0d9488; }
.cal-list { margin-top: 14px; }
@media (min-width: 860px) { .cal .day { min-height: 92px; font-size: .8rem; } .cal .ev { font-size: .74rem; } }

/* --- comparaison matériel --- */
.compare-ok { color: var(--ok); font-weight: 700; }
.compare-diff { color: var(--accent); font-weight: 700; }

/* --- page connexion --- */
.login-wrap { min-height: 92vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { width: 100%; max-width: 380px; background: var(--carte); border: 1px solid var(--bord); border-radius: 16px; padding: 26px; }
.login-box h1 { text-align: center; margin-top: 0; }
.login-logo { text-align: center; font-size: 2.4rem; }

details.box { border: 1px solid var(--bord); border-radius: 10px; padding: 10px 14px; margin: 10px 0; background: #fbfcfe; }
details.box summary { cursor: pointer; font-weight: 600; color: var(--bleu2); }
.muted { color: var(--gris); font-size: .85rem; }
.sep { border: none; border-top: 1px solid var(--bord); margin: 14px 0; }
