/* ─────────────────────────────────────────────────────────────
   Intranet Protecsure Électronique — charte graphique
   Reprend fidèlement les styles de la maquette de référence.
───────────────────────────────────────────────────────────── */

:root {
  --bg:#0a1220; --panel:#0f1a2c; --panel2:#142338; --line:#21344f;
  --ink:#e8eef6; --muted:#8fa3bf; --dim:#5d7088;
  --navy:#15335B; --navy-lt:#1e4a82; --navy-soft:#15335b40;
  --acc:#2fb6d4; --acc-soft:#0e3340; --acc-ink:#04141a;
  --ok:#34c77b; --warn:#e8a23d; --bad:#ee5a52; --info:#3d8fd6;
  --radius:8px; --shadow:0 4px 20px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 13px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #1e3147; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

a { color: inherit; text-decoration: none; }

/* ─── Layout principal ─── */
#app { display: flex; height: 100vh; overflow: hidden; }
aside {
  width: 236px; flex: 0 0 236px;
  background: #070d18; border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.brand {
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 11px;
  text-decoration: none; color: inherit;
}
.brand img { width: 46px; height: 46px; object-fit: contain; }
.brand .name { font-weight: 700; letter-spacing: .4px; font-size: 14px; line-height: 1.1; }
.brand .sub { color: var(--acc); font-size: 9.5px; letter-spacing: 1.6px; text-transform: uppercase; margin-top: 3px; }

nav { padding: 10px 8px; overflow-y: auto; flex: 1; }
nav .grp {
  color: #4f6680;
  font-size: 10px; letter-spacing: 1.3px; text-transform: uppercase;
  padding: 14px 10px 6px;
}
.navbtn {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: 6px;
  color: var(--muted); font-size: 13.5px;
  margin-bottom: 1px; transition: .12s;
  position: relative; cursor: pointer;
}
.navbtn:hover { background: var(--panel); color: var(--ink); }
.navbtn.on { background: var(--navy-soft); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--acc); }
.navbtn .ic { width: 18px; text-align: center; font-size: 15px; }

.who {
  padding: 12px 14px; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.who .av {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--navy); display: grid; place-items: center;
  font-weight: 700; font-size: 12px; color: #fff;
}
.who .nm { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .rl { font-size: 10.5px; color: var(--dim); }
.av-sm {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--navy); display: grid; place-items: center;
  font-weight: 700; font-size: 11px; color: #fff;
}

main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
header.top {
  padding: 14px 26px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--panel); flex: 0 0 auto;
}
header.top h1 { margin: 0; font-size: 18px; font-weight: 700; }
header.top .crumb { color: var(--dim); font-size: 11.5px; margin-top: 2px; }
.content { flex: 1; overflow-y: auto; padding: 24px 26px; }

/* ─── Boutons ─── */
.btn {
  background: var(--navy); color: #fff; border: none;
  padding: 8px 15px; border-radius: 6px;
  font-weight: 600; font-size: 13px;
  display: inline-flex; align-items: center; gap: 7px;
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--navy-lt); }
.btn.acc { background: var(--acc); color: var(--acc-ink); }
.btn.acc:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn.ghost:hover { color: var(--ink); border-color: #2d445f; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.danger { background: transparent; color: var(--bad); border: 1px solid #4a2421; }
.btn.danger:hover { background: #2a1513; }

/* ─── Cartes & layout grids ─── */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
}
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.kpi {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
  position: relative; overflow: hidden;
}
.kpi .lab { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; }
.kpi .val { font-size: 27px; font-weight: 800; margin-top: 6px; letter-spacing: -.5px; }
.kpi .foot { font-size: 11.5px; color: var(--dim); margin-top: 3px; }
.kpi .bar { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--acc); }

/* ─── Tableaux ─── */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px;
  padding: 9px 12px; border-bottom: 1px solid var(--line); font-weight: 600;
}
td { padding: 11px 12px; border-bottom: 1px solid #172638; font-size: 13px; }
tr:hover td { background: #122036; }
td.r, th.r { text-align: right; }

/* ─── Tags ─── */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.tag.ok { background: #0f2e1f; color: var(--ok); }
.tag.warn { background: #332512; color: var(--warn); }
.tag.bad { background: #331715; color: var(--bad); }
.tag.info { background: #102a40; color: var(--acc); }
.tag.dim { background: #1a2940; color: var(--muted); }
.tag.prospect { background: #2a2412; color: var(--warn); }
.tag.client { background: #0f2e1f; color: var(--ok); }

/* ─── Utilitaires ─── */
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.sec-title { font-size: 15px; font-weight: 700; margin: 0 0 2px; }
.sec-sub { color: var(--dim); font-size: 12px; margin: 0 0 16px; }
.muted { color: var(--muted); }
.mini { font-size: 11.5px; }
.stk-low { color: var(--bad); font-weight: 700; }
.link { color: var(--acc); cursor: pointer; text-decoration: none; }
.link:hover { text-decoration: underline; }
.chip { padding: 2px 8px; border-radius: 5px; background: var(--bg); border: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.divider { height: 1px; background: var(--line); margin: 18px 0; }

/* ─── Formulaires ─── */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; }
.field label {
  font-size: 11.5px; color: var(--muted);
  font-weight: 600; letter-spacing: .3px;
}
.field input, .field select, .field textarea {
  background: var(--bg); border: 1px solid var(--line); color: var(--ink);
  padding: 8px 11px; border-radius: 6px; outline: none; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--acc); }
.field textarea { resize: vertical; min-height: 64px; }
.field.row2 { flex-direction: row; gap: 12px; }
.field.row2 > div { flex: 1; }
.field.row3 { flex-direction: row; gap: 12px; }
.field.row3 > div { flex: 1; }
.check {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink); cursor: pointer;
}
.check input[type="checkbox"] { accent-color: var(--acc); width: 16px; height: 16px; }

/* ─── Flash messages ─── */
.flash {
  padding: 10px 14px; border-radius: 7px; margin-bottom: 14px;
  font-size: 13px; font-weight: 500;
}
.flash-ok { background: #0f2e1f; color: var(--ok); border: 1px solid #1f4a2f; }
.flash-bad { background: #331715; color: var(--bad); border: 1px solid #5a2722; }
.flash-info { background: #102a40; color: var(--acc); border: 1px solid #1c4660; }

/* ─── Empty state ─── */
.empty { text-align: center; padding: 50px 20px; color: var(--dim); }
.empty .e-ic { font-size: 38px; margin-bottom: 10px; opacity: .5; }

/* ─── Tabs ─── */
.tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px; flex-wrap: wrap;
}
.tabs button, .tabs .navbtn-tab {
  background: transparent; border: none;
  color: var(--muted); padding: 9px 14px;
  font-size: 13px; border-bottom: 2px solid transparent;
  margin-bottom: -1px; text-decoration: none;
  cursor: pointer; display: inline-flex;
}
.tabs button.on, .tabs .navbtn-tab.on {
  color: var(--acc); border-bottom-color: var(--acc); font-weight: 600;
}

/* ─── Modale (réservée pour les modules à venir) ─── */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(2, 6, 14, .74);
  display: grid; place-items: center;
  z-index: 50; padding: 20px;
}
.modal {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; width: 100%; max-width: 560px;
  max-height: 92vh; overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal h3 {
  margin: 0; padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  font-size: 16px; display: flex; align-items: center; gap: 10px;
}
.modal .body { padding: 20px 22px; }
.modal .foot {
  padding: 14px 22px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 10px; align-items: center;
}

/* ─── Pages d'authentification (sans sidebar) ─── */
body.auth-body {
  background: radial-gradient(circle at 30% 20%, #15335B 0%, #0a1220 60%);
  display: grid; place-items: center; min-height: 100vh;
}
.auth-shell {
  width: 100%; max-width: 420px; padding: 24px;
  display: flex; flex-direction: column; gap: 24px;
}
.auth-brand {
  display: flex; align-items: center; gap: 14px;
  justify-content: center;
}
.auth-brand img { width: 64px; height: 64px; object-fit: contain; }
.auth-brand .name { font-weight: 800; font-size: 18px; letter-spacing: 1px; }
.auth-brand .sub { color: var(--acc); font-size: 10.5px; letter-spacing: 2px; text-transform: uppercase; }
.auth-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 26px;
  box-shadow: var(--shadow);
}
.auth-card h2 { margin: 0 0 6px; font-size: 20px; }
.auth-sub { color: var(--muted); margin: 0 0 18px; font-size: 13px; }
.auth-foot {
  text-align: center; color: var(--dim);
  font-size: 11px; letter-spacing: .3px;
}

/* ─────────────────────────────────────────────────────────────
   PIPELINE (kanban drag & drop)
───────────────────────────────────────────────────────────── */
.pipe {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  align-items: start;
}
.pcol {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 220px;
  display: flex;
  flex-direction: column;
}
.pcol.dragover { border-color: var(--acc); background: #0e2233; }
.pcol .ph {
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.pcol .ph .t { font-size: 12px; font-weight: 700; letter-spacing: .3px; }
.pcol .ph .c {
  font-size: 11px; color: var(--dim);
  background: var(--bg); padding: 1px 8px; border-radius: 20px;
}
.pcol .pbody {
  padding: 10px;
  display: flex; flex-direction: column; gap: 9px; flex: 1;
}
.pcard {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  cursor: grab;
  transition: .12s;
  border-left: 3px solid var(--acc);
}
.pcard:hover { border-color: #2d445f; transform: translateY(-1px); }
.pcard.dragging { opacity: .4; }
.pcard .pt { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.pcard .pm {
  font-size: 11px; color: var(--muted);
  display: flex; justify-content: space-between;
}
.pcard .pv { color: var(--acc); font-weight: 700; font-size: 12px; margin-top: 6px; }
.stepbar { display: flex; gap: 3px; margin-top: 8px; }
.stepbar i { flex: 1; height: 3px; border-radius: 2px; background: #21344f; }
.stepbar i.done { background: var(--acc); }

/* ─────────────────────────────────────────────────────────────
   PICKER PRODUITS (parc, items projet, devis)
───────────────────────────────────────────────────────────── */
.prodpick {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.prodbtn {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px;
  text-align: left;
  transition: .12s;
  position: relative;
  cursor: pointer;
  color: inherit;
}
.prodbtn:hover { border-color: var(--acc); }
.prodbtn .pn { font-weight: 600; font-size: 12.5px; margin-bottom: 3px; }
.prodbtn .pr { font-size: 11px; color: var(--muted); }
.prodbtn .qbadge {
  position: absolute; top: 8px; right: 8px;
  background: var(--acc); color: var(--acc-ink);
  font-weight: 800; font-size: 11px;
  border-radius: 20px; min-width: 20px; height: 20px;
  display: grid; place-items: center; padding: 0 5px;
}
.qty-ctrl {
  display: flex; align-items: center; gap: 8px; margin-top: 8px;
}
.qty-ctrl button {
  width: 26px; height: 26px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--bg);
  color: var(--ink); font-size: 15px; font-weight: 700;
  display: grid; place-items: center;
}
.qty-ctrl button:hover { border-color: var(--acc); color: var(--acc); }
.qty-ctrl .n { min-width: 24px; text-align: center; font-weight: 700; }

/* ─────────────────────────────────────────────────────────────
   ACTIVITÉS (icônes type + items)
───────────────────────────────────────────────────────────── */
.acttype { display: flex; gap: 8px; }
.acttype button {
  flex: 1; background: var(--panel2);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 11px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  color: var(--muted); font-size: 11.5px; font-weight: 600;
}
.acttype button .ai { font-size: 19px; }
.acttype button.on { border-color: var(--acc); background: var(--acc-soft); color: var(--acc); }
.act-item {
  display: flex; gap: 11px;
  padding: 11px 0;
  border-bottom: 1px solid #172638;
}
.act-ic {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: grid; place-items: center;
  font-size: 16px; flex: 0 0 34px;
  background: var(--panel2);
}

/* ─────────────────────────────────────────────────────────────
   PLANNING TECHNICIEN
───────────────────────────────────────────────────────────── */
.tp-grid {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.tp-tech {
  padding: 12px;
  border-bottom: 1px solid #172638;
  border-right: 1px solid var(--line);
  background: var(--panel2);
  font-weight: 600; font-size: 13px;
  display: flex; align-items: center; gap: 8px;
}
.tp-lane {
  border-bottom: 1px solid #172638;
  padding: 8px;
  display: flex; flex-direction: column; gap: 7px;
  min-height: 62px;
}
.intv {
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 12px;
  border-left: 3px solid;
  cursor: pointer;
}
.intv.install { background: #102a40; border-left-color: var(--acc); }
.intv.maint { background: #2a2412; border-left-color: var(--warn); }
.intv.prov { opacity: .7; border-style: dashed; border-left-style: solid; }
.intv .it { font-weight: 600; }
.intv .il { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ─────────────────────────────────────────────────────────────
   PROGRESS BAR (objectifs)
───────────────────────────────────────────────────────────── */
.progress {
  height: 8px;
  background: var(--bg);
  border-radius: 6px;
  overflow: hidden;
}
.progress i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--navy-lt), var(--acc));
  border-radius: 6px;
}

/* ─────────────────────────────────────────────────────────────
   LÉGENDE COULEURS
───────────────────────────────────────────────────────────── */
.legend {
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--muted);
}
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i {
  width: 10px; height: 10px;
  border-radius: 3px;
  display: inline-block;
}

/* ─────────────────────────────────────────────────────────────
   GED / Documents
───────────────────────────────────────────────────────────── */
.ged-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
  background: var(--panel2);
}
.ged-item .fi {
  width: 36px; height: 36px;
  border-radius: 7px;
  background: var(--bg);
  display: grid; place-items: center;
  font-size: 16px;
}

/* ─────────────────────────────────────────────────────────────
   DEVIS / LIGNES FACTURE
───────────────────────────────────────────────────────────── */
.invoice-line {
  display: grid;
  grid-template-columns: 1fr 80px 110px 60px 110px 34px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.invoice-line input { padding: 7px 9px; }

/* ─────────────────────────────────────────────────────────────
   MAIL PREVIEW (journal d'alertes stock)
───────────────────────────────────────────────────────────── */
.mailbox {
  background: #0c1626;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 14px;
  font-size: 12.5px;
}
.mailbox .mh {
  display: flex; justify-content: space-between;
  color: var(--muted); font-size: 11px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px; margin-bottom: 8px;
}

/* ─── Responsive — kanban en colonnes scrollables sur petit écran ─── */
@media (max-width: 1200px) {
  .pipe { grid-template-columns: repeat(5, minmax(220px, 1fr)); overflow-x: auto; }
}

/* ─── Print ─── */
@media print {
  aside, header.top, .no-print { display: none !important; }
  .content { padding: 0; overflow: visible; }
  body { background: #fff; color: #000; }
}
