/* GPP Terrain — design system (charte validée sur maquette) */
@import url('https://fonts.googleapis.com/css2?family=Newsreader:wght@500;600;700&family=Hanken+Grotesk:wght@400;500;600;700&display=swap');

:root{
  --cream:#fbf9f4;
  --surface:#ffffff;
  --surface-2:#f5f3ee;
  --navy:#0a1628;
  --navy-2:#101c2e;
  --gold:#c9a227;
  --gold-2:#e5c358;
  --ink:#1b1c19;
  --muted:#6b7280;
  --line:#e5e2d9;
  --green:#10b981;
  --blue:#3b82f6;
  --amber:#f59e0b;
  --red:#dc2626;
  --r:16px;
  --shadow:0 1px 2px rgba(16,28,46,.04), 0 8px 24px rgba(16,28,46,.06);
  --shadow-lg:0 12px 40px rgba(16,28,46,.12);
}

*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;padding:0}
body{
  background:var(--cream); color:var(--ink);
  font-family:'Hanken Grotesk',system-ui,-apple-system,sans-serif;
  font-size:15px; line-height:1.5;
  overscroll-behavior-y:none;
}
h1,h2,h3,h4,.serif{font-family:'Newsreader',Georgia,serif;font-weight:600;letter-spacing:-.015em;margin:0}
button{font-family:inherit;font-size:inherit;cursor:pointer;border:none;background:none;color:inherit}
input,select,textarea{font-family:inherit;font-size:16px}
a{color:inherit;text-decoration:none}

/* ---------- Layout mobile ---------- */
.app{max-width:430px;margin:0 auto;min-height:100vh;background:var(--cream);
     display:flex;flex-direction:column;position:relative;padding-bottom:118px}
.pad{padding:0 18px}
.topbar{display:flex;align-items:flex-start;justify-content:space-between;padding:16px 18px 8px}
.topbar .kicker{font-size:11px;font-weight:700;letter-spacing:.12em;color:var(--gold);
                text-transform:uppercase;margin-bottom:4px}
.topbar h1{font-size:26px;line-height:1.15}
.topbar .sub{font-size:13px;color:var(--muted);margin-top:2px}
.avatar{width:42px;height:42px;border-radius:50%;background:var(--navy);color:#fff;
        display:grid;place-items:center;font-weight:700;font-size:14px;position:relative;flex:0 0 auto}
.avatar::after{content:'';position:absolute;right:-1px;bottom:-1px;width:11px;height:11px;
               border-radius:50%;background:var(--green);border:2px solid var(--cream)}

.offline-pill{display:flex;align-items:center;gap:8px;margin:8px 18px 0;padding:9px 12px;
  background:#fff7ed;border:1px solid #f6d9ab;border-radius:12px;font-size:12.5px;color:#92400e}
.offline-pill b{font-weight:700}
.offline-pill .lnk{margin-left:auto;font-weight:700;color:var(--amber);text-decoration:underline}

/* ---------- Cartes ---------- */
.card{background:var(--surface);border-radius:var(--r);box-shadow:var(--shadow);
      border:1px solid rgba(16,28,46,.04)}
.card-pad{padding:16px}

/* Objectif du jour */
.goal{margin:14px 18px 0;padding:18px;background:var(--navy);color:#fff;border-radius:20px;
      box-shadow:var(--shadow-lg);position:relative;overflow:hidden}
.goal::after{content:'';position:absolute;right:-40px;top:-40px;width:160px;height:160px;
   border-radius:50%;background:radial-gradient(circle,rgba(201,162,39,.28),transparent 70%)}
.goal .row{display:flex;align-items:center;gap:16px}
.ring{width:92px;height:92px;flex:0 0 auto;position:relative;display:grid;place-items:center}
.ring svg{position:absolute;inset:0;transform:rotate(-90deg)}
.ring .val{font-family:'Newsreader',serif;font-size:22px;font-weight:600;color:#fff;line-height:1}
.ring .lbl{font-size:9px;letter-spacing:.1em;text-transform:uppercase;color:#9fb0c9;margin-top:2px}
.goal .pct{font-size:11px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;color:var(--gold-2)}
.goal h3{font-size:17px;margin:4px 0 6px;color:#fff;line-height:1.3}
.goal p{font-size:13px;color:#b9c6da;margin:0}
.goal .foot{margin-top:12px;padding-top:12px;border-top:1px solid rgba(255,255,255,.12);
            display:flex;gap:14px;font-size:12px;color:#b9c6da}
.goal .foot b{color:#fff;font-weight:600}

/* KPI tiles */
.kpis{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin:14px 18px 0}
.kpi{background:var(--surface);border-radius:14px;padding:12px 10px;box-shadow:var(--shadow);
     border:1px solid rgba(16,28,46,.04);text-align:center}
.kpi .n{font-family:'Newsreader',serif;font-size:24px;font-weight:600;line-height:1.1}
.kpi .l{font-size:10.5px;color:var(--muted);text-transform:uppercase;letter-spacing:.07em;margin-top:2px}
.kpi .ic{color:var(--gold);margin-bottom:2px}

/* Section */
.sec-h{display:flex;align-items:baseline;justify-content:space-between;margin:22px 18px 10px}
.sec-h h2{font-size:19px}
.sec-h .more{font-size:12.5px;color:var(--gold);font-weight:700}

/* Carte rendez-vous */
.rdv{display:flex;gap:12px;align-items:flex-start;padding:14px;margin:0 18px 10px;
     background:var(--surface);border-radius:var(--r);box-shadow:var(--shadow);
     border:1px solid rgba(16,28,46,.04)}
.rdv .ini{width:44px;height:44px;border-radius:12px;flex:0 0 auto;display:grid;place-items:center;
          font-weight:700;font-size:14px;background:#eef2f8;color:var(--navy)}
.rdv .body{flex:1;min-width:0}
.rdv .nom{font-weight:600;font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.rdv .adr{font-size:12.5px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.rdv .meta{display:flex;align-items:center;gap:8px;margin-top:6px;flex-wrap:wrap}
.rdv .time{font-size:12.5px;font-weight:700;color:var(--navy)}

.badge{display:inline-flex;align-items:center;gap:4px;padding:3px 8px;border-radius:999px;
       font-size:10.5px;font-weight:700;letter-spacing:.03em;text-transform:uppercase}
.b-nouveau{background:#eef2f8;color:#334e77}
.b-contacte{background:#e8f1fe;color:#1d4ed8}
.b-devis{background:#fef4e2;color:#a16207}
.b-gagne{background:#e6f7f0;color:#047857}
.b-perdu{background:#fdeaea;color:#b91c1c}
.b-rappel{background:#fff1e6;color:#c2410c}

/* Bannière sombre */
.promo{margin:16px 18px 0;padding:16px;border-radius:var(--r);background:linear-gradient(135deg,#0a1628,#14263f);
       color:#fff;display:flex;align-items:center;gap:12px}
.promo h4{font-size:15px;color:#fff}
.promo p{font-size:12px;color:#b9c6da;margin:2px 0 0}
.promo .btn-ghost{border:1px solid rgba(255,255,255,.3);color:#fff;font-size:12px;font-weight:700;
                   padding:7px 12px;border-radius:10px;white-space:nowrap;margin-left:auto}

/* Activité */
.act{display:flex;gap:10px;align-items:center;padding:10px 0;border-bottom:1px solid var(--line)}
.act:last-child{border-bottom:none}
.act .dot{width:8px;height:8px;border-radius:50%;flex:0 0 auto}
.act .t{font-size:13.5px;flex:1}
.act .h{font-size:11.5px;color:var(--muted)}

/* ---------- Bottom nav ---------- */
.nav{position:fixed;bottom:0;left:50%;transform:translateX(-50%);width:100%;max-width:430px;
     background:rgba(255,255,255,.96);backdrop-filter:blur(12px);border-top:1px solid var(--line);
     display:grid;grid-template-columns:repeat(4,1fr);align-items:center;
     padding:8px 0 calc(8px + env(safe-area-inset-bottom));z-index:50}
/* quand la nav est présente, on réserve sa hauteur réelle */
.app:has(.nav){padding-bottom:96px}
.app{padding-bottom:132px;padding-bottom:calc(132px + env(safe-area-inset-bottom))}
.app.has-cta{padding-bottom:132px;padding-bottom:calc(132px + env(safe-area-inset-bottom))}
.nav a{display:flex;flex-direction:column;align-items:center;gap:3px;font-size:10.5px;
       color:var(--muted);font-weight:600;padding:4px 0}
.nav a.on{color:var(--navy)}
.nav a.on .ico{color:var(--gold)}
.nav .plus{width:46px;height:46px;border-radius:50%;background:var(--navy);color:#fff;
           display:grid;place-items:center;margin:-16px auto 0;box-shadow:0 6px 18px rgba(10,22,40,.28)}

/* ---------- Formulaires ---------- */
.field{margin-bottom:12px}
.field label{display:block;font-size:10.5px;font-weight:700;letter-spacing:.09em;
             text-transform:uppercase;color:var(--muted);margin-bottom:5px}
.field input,.field select,.field textarea{
  width:100%;padding:14px 14px;border-radius:13px;border:1.5px solid var(--line);
  background:var(--surface);color:var(--ink);outline:none;transition:border-color .15s}
.field input:focus,.field select:focus,.field textarea:focus{border-color:var(--gold)}
.field textarea{min-height:92px;resize:vertical;line-height:1.45}
.field .hint{font-size:11.5px;color:var(--muted);margin-top:4px}

.chips{display:flex;flex-wrap:wrap;gap:8px}
.chip{padding:9px 14px;border-radius:999px;border:1.5px solid var(--line);background:var(--surface);
      font-size:13px;font-weight:600;color:#4b5563;transition:.15s}
.chip.on{background:var(--navy);border-color:var(--navy);color:#fff}

.seg{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.seg button{padding:13px 8px;border-radius:13px;border:1.5px solid var(--line);background:var(--surface);
            font-size:13px;font-weight:600;color:#4b5563;display:flex;flex-direction:column;
            align-items:center;gap:5px;transition:.15s}
.seg button.on{background:var(--navy);border-color:var(--navy);color:#fff}
.seg button.warm.on{background:var(--gold);border-color:var(--gold);color:#1b1c19}

.switch-row{display:flex;align-items:center;justify-content:space-between;padding:13px 0;
            border-bottom:1px solid var(--line)}
.switch-row:last-child{border-bottom:none}
.switch-row .lbl{font-size:13.5px;font-weight:600}
.switch-row .sub{font-size:11.5px;color:var(--muted)}
.switch{width:46px;height:27px;border-radius:999px;background:#d6d3ca;position:relative;
        transition:.2s;flex:0 0 auto}
.switch.on{background:var(--green)}
.switch::after{content:'';position:absolute;top:3px;left:3px;width:21px;height:21px;
               border-radius:50%;background:#fff;transition:.2s;box-shadow:0 1px 3px rgba(0,0,0,.2)}
.switch.on::after{left:22px}

/* Boutons */
.btn{width:100%;padding:16px;border-radius:14px;background:var(--navy);color:#fff;
     font-weight:700;font-size:15px;display:flex;align-items:center;justify-content:center;gap:8px;
     box-shadow:0 6px 18px rgba(10,22,40,.18);transition:transform .1s}
.btn:active{transform:scale(.985)}
.btn.gold{background:var(--gold);color:#1b1c19;box-shadow:0 6px 18px rgba(201,162,39,.3)}
.btn.outline{background:transparent;color:var(--navy);border:1.5px solid var(--line);box-shadow:none}
.btn.sm{padding:11px 14px;font-size:13px;width:auto}
.btn:disabled{opacity:.5}
.sticky-cta{position:fixed;bottom:0;left:50%;transform:translateX(-50%);width:100%;max-width:430px;
            padding:12px 18px calc(12px + env(safe-area-inset-bottom));background:rgba(251,249,244,.97);
            backdrop-filter:blur(10px);border-top:1px solid var(--line);z-index:60}
.sticky-cta .note{text-align:center;font-size:11px;color:var(--muted);margin-top:7px}
/* réserve de la place pour la CTA fixe en bas */
.has-cta{padding-bottom:132px !important}

/* Produits ligne */
.p-line{display:flex;gap:10px;align-items:center;padding:11px 0;border-bottom:1px solid var(--line)}
.p-line:last-child{border-bottom:none}
.p-line .thumb{width:42px;height:42px;border-radius:10px;background:var(--surface-2);
               display:grid;place-items:center;color:var(--gold);flex:0 0 auto}
.p-line .nm{font-size:13.5px;font-weight:600;line-height:1.3}
.p-line .ds{font-size:11.5px;color:var(--muted)}
.p-line .pr{font-size:13.5px;font-weight:700;margin-left:auto;white-space:nowrap}
.qty{display:flex;align-items:center;gap:8px}
.qty button{width:30px;height:30px;border-radius:9px;border:1.5px solid var(--line);
            display:grid;place-items:center;font-weight:700;color:var(--navy)}
.qty span{min-width:18px;text-align:center;font-weight:700;font-size:13.5px}

/* Recherche + filtres */
.search{margin:8px 18px 0;position:relative}
.search input{width:100%;padding:13px 14px 13px 40px;border-radius:13px;border:1.5px solid var(--line);
              background:var(--surface);outline:none}
.search .mag{position:absolute;left:13px;top:50%;transform:translateY(-50%);color:var(--muted)}
.filters{display:flex;gap:8px;overflow-x:auto;padding:12px 18px 4px;scrollbar-width:none}
.filters::-webkit-scrollbar{display:none}
.filters .chip{white-space:nowrap;font-size:12.5px;padding:8px 13px}

/* Liste prospects */
.pcard{display:block;padding:14px;margin:0 18px 10px;background:var(--surface);border-radius:var(--r);
       box-shadow:var(--shadow);border:1px solid rgba(16,28,46,.04)}
.pcard .row1{display:flex;gap:12px;align-items:center}
.pcard .ini{width:44px;height:44px;border-radius:12px;display:grid;place-items:center;
            font-weight:700;font-size:14px;flex:0 0 auto}
.pcard .nm{font-weight:600;font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pcard .sb{font-size:12.5px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pcard .when{font-size:12px;color:var(--navy);font-weight:700;white-space:nowrap;flex:0 0 auto}
.pcard .row2{display:flex;align-items:center;gap:7px;margin-top:10px;flex-wrap:wrap}
.pcard .amt{font-size:12px;font-weight:700;color:var(--navy)}

/* ---------- Auth ---------- */
.login{min-height:100vh;display:flex;flex-direction:column;justify-content:center;
       padding:32px 24px;max-width:430px;margin:0 auto}
.login .logo{width:64px;height:64px;border-radius:18px;background:var(--navy);display:grid;
             place-items:center;margin-bottom:22px}
.login h1{font-size:30px;line-height:1.15;margin-bottom:6px}
.login p.sub{color:var(--muted);font-size:14px;margin:0 0 26px}

/* ---------- Divers ---------- */
.empty{text-align:center;padding:48px 24px;color:var(--muted)}
.empty .ic{color:var(--line);margin-bottom:12px}
.spinner{width:22px;height:22px;border:2.5px solid rgba(255,255,255,.25);border-top-color:#fff;
         border-radius:50%;animation:spin .7s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.loading{display:grid;place-items:center;padding:60px}
.loading .spinner{border-color:rgba(10,22,40,.15);border-top-color:var(--navy)}

.toast{position:fixed;bottom:96px;left:50%;transform:translateX(-50%) translateY(20px);
       background:var(--navy);color:#fff;padding:12px 20px;border-radius:12px;font-size:13.5px;
       font-weight:600;opacity:0;transition:.25s;z-index:200;max-width:340px;text-align:center;
       box-shadow:var(--shadow-lg);pointer-events:none}
.toast.show{opacity:1;transform:translateX(-50%) translateY(0)}
.toast.err{background:#b91c1c}
.toast.ok{background:#047857}

.bar{height:8px;border-radius:999px;background:var(--surface-2);overflow:hidden}
.bar > i{display:block;height:100%;border-radius:999px;
         background:linear-gradient(90deg,var(--navy),var(--gold))}
.prog{height:3px;background:var(--surface-2)}
.prog > i{display:block;height:100%;background:var(--gold);transition:width .3s}

.hscroll{display:flex;gap:8px;overflow-x:auto;padding:2px 0 4px;scrollbar-width:none}
.hscroll::-webkit-scrollbar{display:none}
.thumb-photo{width:78px;height:78px;border-radius:12px;object-fit:cover;flex:0 0 auto;
             border:1.5px solid var(--line)}
.thumb-add{width:78px;height:78px;border-radius:12px;border:1.5px dashed var(--line);
           display:grid;place-items:center;color:var(--muted);flex:0 0 auto;background:var(--surface-2)}

/* ---------- Dashboard patron : responsive ---------- */
/* Sur mobile/tablette, la sidebar devient une barre horizontale compacte
   pour laisser toute la largeur au contenu (carte, tableaux). */
@media (max-width: 900px){
  .gpp-sidebar{
    width:100% !important;flex:0 0 auto !important;min-height:auto !important;
    position:static !important;flex-direction:row !important;align-items:center;
    padding:12px 14px !important;gap:10px;overflow-x:auto;
  }
  .gpp-sidebar > div:first-child{padding:0 !important;flex:0 0 auto}
  .gpp-sidebar nav{flex-direction:row !important;gap:6px !important;flex:1}
  .gpp-sidebar nav a{padding:8px 10px !important;font-size:12.5px !important;white-space:nowrap}
  .gpp-sidebar > div:last-child{margin-top:0 !important;border-top:none !important;padding-top:0 !important;flex:0 0 auto}
  .gpp-sidebar > div:last-child a{display:none !important}
}

/* Sidebar patron — valeurs par défaut sorties de l'inline pour être surchargeables */
.gpp-sidebar{width:236px;flex:0 0 236px;min-height:100vh;position:sticky;top:0}

/* Conteneur des écrans patron : neutralise le flex-column de .app */
.gpp-sheet{display:flex;flex-direction:row;min-height:100vh;width:100%}
@media (max-width: 900px){
  .gpp-sheet{flex-direction:column}
  .gpp-sheet > main{width:100% !important;padding:18px 16px 32px !important}
}

/* Le dashboard patron n'est pas une vue mobile : il doit occuper tout l'écran */
body:has(.gpp-sheet) #app,
#app.app:has(.gpp-sheet){max-width:none !important;width:100% !important;padding-bottom:0 !important}
