/* Work Space - theme noir & blanc, mobile first */
:root {
  --noir: #0a0a0a;
  --blanc: #ffffff;
  --gris-bg: #f2f2f4;
  --gris-carte: #ffffff;
  --gris-ligne: #e3e3e6;
  --gris-texte: #6b6b70;
  --accent: #0a0a0a;
  --alerte: #e8540a;
  --vert: #1f9d57;
  --radius: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--gris-bg);
  color: var(--noir);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

#app { min-height: 100vh; }

/* ---------- Ecran / header ---------- */
.screen { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  background: var(--noir);
  color: var(--blanc);
  padding: calc(var(--safe-top) + 14px) 18px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 { font-size: 19px; font-weight: 700; margin: 0; letter-spacing: 0.3px; }
.topbar .sub { font-size: 13px; color: #b9b9bf; margin: 0; }
.topbar .back {
  background: none; border: none; color: var(--blanc);
  font-size: 26px; line-height: 1; padding: 0 4px 0 0; cursor: pointer;
}
.topbar .spacer { flex: 1; }
.topbar .ghost-btn {
  background: rgba(255,255,255,.14); color: #fff; border: none;
  border-radius: 20px; padding: 7px 13px; font-size: 13px; font-weight: 600; cursor: pointer;
}

.content { flex: 1; padding: 18px; padding-bottom: calc(24px + var(--safe-bottom)); }

/* ---------- Login ---------- */
.login {
  min-height: 100vh;
  background: var(--noir);
  color: var(--blanc);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 26px calc(32px + var(--safe-bottom));
}
.login .logo {
  text-align: center;
  font-weight: 800;
  letter-spacing: 3px;
  line-height: 1.02;
  margin-bottom: 42px;
}
.login .logo .l1 { font-size: 58px; display: block; }
.login .logo .l2 { font-size: 58px; display: block; }
.login label { font-size: 13px; color: #b9b9bf; display: block; margin: 0 0 6px 2px; }
.login input {
  width: 100%;
  background: #1b1b1e;
  border: 1px solid #2d2d31;
  color: #fff;
  border-radius: 12px;
  padding: 15px 16px;
  font-size: 17px;
  margin-bottom: 16px;
}
.login input:focus { outline: none; border-color: #5a5a60; }
.login .forgot { text-align: right; font-size: 14px; color: #b9b9bf; margin: -6px 2px 22px; }
.login .forgot a { color: #b9b9bf; text-decoration: none; }

/* ---------- Boutons ---------- */
.btn {
  display: block; width: 100%;
  border: none; border-radius: 14px;
  padding: 16px; font-size: 17px; font-weight: 700;
  cursor: pointer; text-align: center;
}
.btn-primary { background: var(--blanc); color: var(--noir); }
.login .btn-primary { background: #fff; color: #000; }
.btn-dark { background: var(--noir); color: #fff; }
.btn-ghost { background: #ececef; color: var(--noir); }
.btn-alerte { background: var(--alerte); color: #fff; }
.btn-vert { background: var(--vert); color: #fff; }
.btn + .btn { margin-top: 10px; }
.btn:active { transform: scale(0.99); opacity: .92; }
.btn:disabled { opacity: .4; }

/* ---------- Home grid (facon iOS) ---------- */
.home-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px 14px;
  margin-top: 8px;
}
.app-tile { text-align: center; cursor: pointer; }
.app-tile .icon {
  width: 72px; height: 72px; margin: 0 auto 8px;
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; color: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,.14);
  position: relative;
}
.app-tile .icon.workday { background: linear-gradient(160deg,#2b2b2e,#000); }
.app-tile .icon.rh { background: linear-gradient(160deg,#3a7bd5,#2456a6); }
.app-tile .icon.chat { background: linear-gradient(160deg,#1f9d57,#157a41); }
.app-tile .label { font-size: 13px; font-weight: 600; }
.app-tile.soon .icon { filter: grayscale(.4); opacity: .55; }
.app-tile .badge {
  position: absolute; top: -6px; right: -6px;
  background: #c9c9ce; color: #fff; font-size: 9px; font-weight: 700;
  border-radius: 10px; padding: 2px 6px; letter-spacing: .3px;
}

/* ---------- Cartes chantier / taches ---------- */
.section-title {
  font-size: 13px; font-weight: 700; color: var(--gris-texte);
  text-transform: uppercase; letter-spacing: .6px;
  margin: 22px 2px 10px;
}
.chantier-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 26px 2px 10px;
}
.chantier-head .nom { font-size: 17px; font-weight: 700; }
.chantier-head .lieu { font-size: 13px; color: var(--gris-texte); }

.card {
  background: var(--gris-carte);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
  overflow: hidden;
}
.task {
  display: flex; align-items: center; gap: 13px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--gris-ligne);
  cursor: pointer;
}
.task:last-child { border-bottom: none; }
.task .num {
  flex: none; width: 27px; height: 27px; border-radius: 50%;
  background: #ececef; color: var(--noir);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.task.fait .num { background: var(--vert); color: #fff; }
.task.en_cours .num { background: var(--noir); color: #fff; }
.task .body { flex: 1; min-width: 0; }
.task .titre { font-size: 16px; font-weight: 600; }
.task.fait .titre { color: var(--gris-texte); text-decoration: line-through; }
.task .meta { font-size: 12.5px; color: var(--gris-texte); margin-top: 2px; }
.task .chev { color: #c4c4c9; font-size: 20px; flex: none; }
.pill {
  display: inline-block; font-size: 11px; font-weight: 700;
  border-radius: 8px; padding: 2px 7px; vertical-align: middle;
}
.pill.en_cours { background: #111; color: #fff; }
.pill.fait { background: #e4f6ec; color: var(--vert); }

/* ---------- Detail tache ---------- */
.detail-h { font-size: 24px; font-weight: 800; margin: 4px 0 4px; }
.detail-sub { color: var(--gris-texte); font-size: 14px; margin-bottom: 18px; }
.desc-box {
  background: var(--gris-carte); border-radius: var(--radius);
  padding: 16px; margin-bottom: 18px; font-size: 15.5px;
}
.timer {
  text-align: center; font-size: 46px; font-weight: 800;
  font-variant-numeric: tabular-nums; letter-spacing: 1px;
  margin: 10px 0 18px;
}
.timer small { display: block; font-size: 13px; font-weight: 600; color: var(--gris-texte); letter-spacing: .4px; }

.photos-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 16px; }
.photo-thumb {
  width: 72px; height: 72px; border-radius: 12px; object-fit: cover;
  border: 1px solid var(--gris-ligne);
}
.photo-add {
  width: 72px; height: 72px; border-radius: 12px;
  border: 2px dashed #c4c4c9; background: #fafafb;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: #9a9aa0; cursor: pointer;
}

/* ---------- Probleme ---------- */
.cat-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 6px 0 20px; }
.cat {
  display: flex; align-items: center; gap: 14px;
  background: var(--gris-carte); border: 2px solid transparent;
  border-radius: 14px; padding: 16px; cursor: pointer;
}
.cat.sel { border-color: var(--alerte); }
.cat .emo { font-size: 26px; }
.cat .t { font-weight: 700; }
.cat .d { font-size: 13px; color: var(--gris-texte); }
textarea {
  width: 100%; min-height: 110px; border-radius: 14px;
  border: 1px solid var(--gris-ligne); padding: 14px; font-size: 16px;
  font-family: inherit; resize: vertical; margin-bottom: 14px;
}
textarea:focus { outline: none; border-color: #9a9aa0; }

/* ---------- Pointage ---------- */
.point-log { margin-top: 22px; }
.point-item {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--gris-carte); border-radius: 12px; padding: 13px 15px; margin-bottom: 9px;
}
.point-item .t { font-weight: 600; }
.point-item .h { color: var(--gris-texte); font-size: 14px; font-variant-numeric: tabular-nums; }
.gps-note { font-size: 12.5px; color: var(--gris-texte); margin-top: 6px; text-align: center; }

/* ---------- Divers ---------- */
.hint { font-size: 13.5px; color: var(--gris-texte); margin: 2px 2px 14px; }
.spacer-md { height: 10px; }
.center { text-align: center; }
.toast {
  position: fixed; left: 50%; bottom: calc(26px + var(--safe-bottom));
  transform: translateX(-50%);
  background: #000; color: #fff; padding: 13px 20px; border-radius: 26px;
  font-size: 14.5px; font-weight: 600; z-index: 50;
  box-shadow: 0 6px 20px rgba(0,0,0,.3); max-width: 86%; text-align: center;
  animation: toastin .2s ease;
}
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 8px); } }
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; z-index: 60; padding: 26px;
}
.sheet {
  background: #fff; border-radius: 20px; padding: 26px 22px; width: 100%; max-width: 360px; text-align: center;
}
.sheet .big { font-size: 40px; margin-bottom: 8px; }
.sheet h3 { margin: 0 0 6px; font-size: 20px; }
.sheet p { color: var(--gris-texte); font-size: 14.5px; margin: 0 0 20px; }

/* ---------- formulaires ---------- */
.field { margin-bottom: 15px; }
.field > label { display: block; font-size: 13px; font-weight: 600; color: var(--gris-texte); margin: 0 2px 6px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--gris-ligne); border-radius: 12px;
  padding: 13px 14px; font-size: 16px; font-family: inherit; background: #fff; color: var(--noir);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: #9a9aa0; }
.field textarea { min-height: 70px; resize: vertical; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field .hintline { font-size: 12.5px; color: var(--gris-texte); margin: 6px 2px 0; }

/* ---------- compteur UJT ---------- */
.ujt-box {
  background: var(--noir); color: #fff; border-radius: var(--radius);
  padding: 18px 20px; margin: 4px 0 18px;
}
.ujt-box .big { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ujt-box .lbl { font-size: 12.5px; color: #b9b9bf; letter-spacing: .4px; text-transform: uppercase; }
.ujt-box .split { display: flex; gap: 22px; margin-top: 10px; }
.ujt-box .split div span { display: block; }
.ujt-box .split .v { font-size: 18px; font-weight: 700; }
.ujt-box .split .k { font-size: 11px; color: #b9b9bf; }

/* ---------- chantiers ---------- */
.ch-card {
  background: var(--gris-carte); border-radius: var(--radius); padding: 15px 16px;
  margin-bottom: 11px; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.ch-card .nom { font-size: 17px; font-weight: 700; }
.ch-card .tags { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 11.5px; font-weight: 600; background: #ececef; color: #444; border-radius: 8px; padding: 3px 8px; }
.tag.ujt { background: #111; color: #fff; }
.kv { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--gris-ligne); font-size: 15px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--gris-texte); }
.kv .v { font-weight: 600; text-align: right; max-width: 60%; }
.file-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--gris-carte); border-radius: 10px; padding: 11px 13px; margin-bottom: 8px; font-size: 14.5px;
}
.file-item a { color: var(--noir); text-decoration: none; font-weight: 600; }
.deal-item { text-align: left; padding: 14px 15px; border-bottom: 1px solid var(--gris-ligne); cursor: pointer; }
.deal-item:last-child { border-bottom: none; }
.deal-item .dn { font-weight: 700; }
.deal-item .dm { font-size: 13px; color: var(--gris-texte); margin-top: 2px; }
.deal-list { max-height: 60vh; overflow-y: auto; text-align: left; margin: 0 -4px; }
