/* ===== Pointeuse Miliboo — charte ===== */
:root {
  --sauge: #b7b9a6;
  --olive: #757763;
  --olive-dark: #5d5f4e;
  --bleu: #adb9c8;
  --blanc: #fff;
  --texte: #212529;
  --muted: #6c6f66;
  --bg: #f5f5f1;
  --line: #e3e4dc;
  --danger: #b4483c;
  --danger-bg: #fbecea;
  --warn: #a9761c;
  --warn-bg: #fbf3e2;
  --ok: #4f6b45;
  --ok-bg: #edf2e8;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(33,37,41,.04), 0 8px 24px rgba(33,37,41,.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--texte);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
h1, h2, h3 { margin: 0 0 .5rem; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
a { color: var(--olive); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }

/* ===== Landing / Login ===== */
body.landing {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #f7f7f3 0%, #e9eae1 55%, #dfe4ea 100%);
  padding: 24px 16px;
}
.landing-wrap { max-width: 460px; width: 100%; text-align: center; }
.landing-logo { height: 42px; margin-bottom: 28px; }
.landing-wrap .lead { color: var(--muted); font-size: 1.05rem; margin: 0 0 24px; }
.features { list-style: none; padding: 0; margin: 0 0 32px; text-align: left; display: inline-block; }
.features li { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--olive); flex: none; }
.foot { margin-top: 32px; color: var(--muted); font-size: .8rem; }
.login-card { width: 100%; max-width: 400px; text-align: center; padding: 32px 24px; }
.login-logo { height: 34px; margin-bottom: 20px; }
.login-card form { text-align: left; margin-top: 20px; }

/* ===== Buttons ===== */
.btn {
  appearance: none; border: 1px solid transparent; border-radius: 12px;
  padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer;
  transition: background .15s, transform .05s, box-shadow .15s, opacity .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--olive); color: var(--blanc); }
.btn-primary:hover:not(:disabled) { background: var(--olive-dark); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--texte); }
.btn-ghost:hover:not(:disabled) { background: #eeefe8; }
.btn-danger { background: transparent; border-color: #e7c3be; color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-bg); }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }
.btn-sm { padding: 6px 12px; font-size: .85rem; border-radius: 10px; }
.btn-block { width: 100%; }

/* ===== Forms ===== */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: .85rem; font-weight: 600; color: var(--muted); }
input, select {
  font: inherit; color: var(--texte); background: var(--blanc);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px;
  width: 100%; min-height: 44px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--olive); box-shadow: 0 0 0 3px rgba(117,119,99,.18); }
.select-sm { width: auto; min-height: 36px; padding: 6px 10px; font-size: .9rem; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; }
.row-actions { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 14px; }
@media (min-width: 640px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .span2 { grid-column: span 2; }
}

/* Switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: .9rem; }
.switch input { display: none; }
.slider { width: 42px; height: 24px; background: var(--line); border-radius: 24px; position: relative; transition: background .15s; flex: none; }
.slider::after { content: ""; position: absolute; width: 18px; height: 18px; top: 3px; left: 3px; background: var(--blanc); border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .slider { background: var(--olive); }
.switch input:checked + .slider::after { transform: translateX(18px); }

/* ===== Top bar ===== */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-logo { height: 24px; }
.topbar-user { flex: 1; display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.user-name { font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 3px 8px; border-radius: 999px; background: var(--bleu); color: var(--texte); }
.badge:empty { display: none; }
@media (max-width: 420px) { .user-name { display: none; } }

/* ===== Layout ===== */
.container { max-width: 960px; margin: 0 auto; padding: 16px; padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
.card { background: var(--blanc); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; border: 1px solid #eceee6; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head h3 { margin: 0; }
.view + .view { margin-top: 8px; }

/* Loading */
.loading { text-align: center; padding: 60px 0; color: var(--muted); }
.spinner { width: 34px; height: 34px; margin: 0 auto 12px; border: 3px solid var(--line); border-top-color: var(--olive); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Alerts */
.alert { border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; font-size: .95rem; border: 1px solid transparent; }
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: #efcfca; }
.alert-warn { background: var(--warn-bg); color: var(--warn); border-color: #f0dfba; }
.alert-ok { background: var(--ok-bg); color: var(--ok); border-color: #d4e0cc; }
.alert strong { display: block; margin-bottom: 2px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 50; background: var(--texte); color: var(--blanc); padding: 12px 18px; border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.2); font-size: .95rem; max-width: calc(100% - 32px);
}
.toast.error { background: var(--danger); }

/* ===== Vendeur ===== */
.status-card { background: linear-gradient(150deg, var(--blanc) 0%, #f3f4ee 100%); }
.status-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.status-head h2 { margin: 0; }
.status-head p { margin: 0 0 2px; }
.state-pill { font-size: .8rem; font-weight: 700; padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.state-hors { background: #eceee6; color: var(--muted); }
.state-pointe { background: var(--ok-bg); color: var(--ok); }
.state-pause { background: var(--warn-bg); color: var(--warn); }
.clock { font-size: 3.2rem; font-weight: 300; text-align: center; letter-spacing: -.02em; margin: 14px 0 0; font-variant-numeric: tabular-nums; }
#v-date { margin: 0 0 10px; text-transform: capitalize; }
.meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; padding-top: 12px; border-top: 1px solid var(--line); }
.meta dt { font-size: .78rem; color: var(--muted); }
.meta dd { margin: 2px 0 0; font-weight: 600; }

.punch-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }
.punch {
  appearance: none; border: none; border-radius: 18px; min-height: 104px;
  font: inherit; font-size: 1.15rem; font-weight: 700; color: var(--blanc); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  box-shadow: 0 6px 16px rgba(93,95,78,.25); transition: transform .06s, opacity .15s, filter .15s;
  -webkit-tap-highlight-color: transparent;
}
.punch .ico { font-size: 1.3rem; opacity: .9; }
.punch:active:not(:disabled) { transform: scale(.97); }
.punch:disabled { opacity: .35; cursor: not-allowed; box-shadow: none; filter: grayscale(.4); }
.punch.busy { opacity: .7; pointer-events: none; }
.punch-arrivee { background: linear-gradient(160deg, #84866f, var(--olive-dark)); }
.punch-depart { background: linear-gradient(160deg, #6f715c, #4a4c3d); }
.punch-pause { background: linear-gradient(160deg, #c3c5b2, #9fa18b); color: var(--texte); }
.punch-reprise { background: linear-gradient(160deg, #a4a68f, var(--olive)); }
#v-geo-hint { margin: 4px 0 18px; }

/* ===== Tabs ===== */
.tabs { display: flex; gap: 4px; padding: 4px; background: #e9eae2; border-radius: 14px; margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 1; appearance: none; border: none; background: transparent; font: inherit; font-weight: 600; font-size: .92rem; color: var(--muted); padding: 10px 14px; border-radius: 10px; cursor: pointer; white-space: nowrap; }
.tab.active { background: var(--blanc); color: var(--texte); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid #f0f1eb; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn + .btn { margin-left: 6px; }
.empty { color: var(--muted); text-align: center; padding: 20px 0; font-size: .92rem; }
.tag { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #eceee6; }
.tag-arrivee, .tag-reprise { background: var(--ok-bg); color: var(--ok); }
.tag-pause { background: var(--warn-bg); color: var(--warn); }
.tag-depart { background: #e6eaf0; color: #4d5a6b; }
.tag-refuse { background: var(--danger-bg); color: var(--danger); }
.tag-demo { background: var(--bleu); }

/* Planning (vendeur) */
.plan-today { display: flex; align-items: baseline; gap: 10px; font-size: 1.4rem; font-weight: 600; color: var(--texte); }
.plan-today small { font-size: .85rem; color: var(--muted); font-weight: 400; }

/* Planning grid (responsable) */
.plan-grid { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 12px; }
.plan-row { display: grid; grid-template-columns: 84px 1fr 1fr 88px 40px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid #f0f1eb; }
.plan-row:last-child { border-bottom: none; }
.plan-day { font-weight: 600; font-size: .92rem; }
.plan-day small { display: block; color: var(--muted); font-weight: 400; font-size: .75rem; }
.plan-row input { min-height: 40px; padding: 8px; }
.btn-dupl {
  appearance: none; border: 1px solid var(--olive); background: var(--olive); color: var(--blanc);
  border-radius: 10px; height: 40px; cursor: pointer; font: inherit; font-size: .8rem; font-weight: 600; padding: 0 8px;
}
.btn-dupl:hover:not(:disabled) { background: var(--olive-dark); }
.btn-dupl:disabled { opacity: .4; cursor: not-allowed; background: #cfd0c4; border-color: #cfd0c4; }
.icon-btn { appearance: none; border: 1px solid var(--line); background: var(--blanc); border-radius: 10px; height: 40px; cursor: pointer; color: var(--danger); font-size: 1rem; }
.icon-btn:hover { background: var(--danger-bg); }
@media (min-width: 640px) { .plan-row { grid-template-columns: 140px 1fr 1fr 96px 44px; } }

/* Boutique list mobile tweak */
@media (max-width: 560px) {
  .hide-sm { display: none; }
  .clock { font-size: 2.8rem; }
}
