/* Premium Services — Courses
   Palette reprise du site : noir #0a0a0a, or #c9a84c, crème #f5f0e8.
   Mobile d'abord ; au-delà de 960 px, menu latéral et listes en colonnes. */

:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #f0ece3;
  --text: #17150f;
  --muted: #6d675c;
  --border: #e3ddd0;
  --ink: #0a0a0a;
  --on-ink: #f5f0e8;
  --gold: #c9a84c;
  --gold-text: #8a6a22;
  --gold-soft: #f6eed8;
  --accent-bg: #0a0a0a;
  --accent-fg: #e2c47a;
  --red: #b42318;
  --red-soft: #fdecea;
  --amber: #a15c07;
  --amber-soft: #fef3dc;
  --blue: #1f5fa8;
  --blue-soft: #e7effa;
  --green: #1e7a46;
  --green-soft: #e3f4ea;
  --grey: #5f6773;
  --grey-soft: #eceef1;
  --purple: #6941c6;
  --purple-soft: #f0eafd;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 16, 8, 0.05), 0 4px 16px rgba(20, 16, 8, 0.04);
  --top-h: 56px;
  --nav-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0c0c;
    --surface: #161616;
    --surface-2: #202020;
    --text: #f2eee6;
    --muted: #a39d91;
    --border: #2d2b27;
    --ink: #000000;
    --gold-text: #d9b95e;
    --gold-soft: #2a2415;
    --accent-bg: #c9a84c;
    --accent-fg: #0a0a0a;
    --red: #f97066;
    --red-soft: #3a1714;
    --amber: #f5b64a;
    --amber-soft: #33260e;
    --blue: #7cb4f5;
    --blue-soft: #14263d;
    --green: #5fd28f;
    --green-soft: #12301f;
    --grey: #a3a9b3;
    --grey-soft: #25282c;
    --purple: #b69cf7;
    --purple-soft: #261d3d;
    --shadow: none;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
.ic { flex: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.mt { margin-top: 12px; }
.block { display: block; }
.pre { white-space: pre-wrap; }
.alert-text { color: var(--red); }
.warn-text { color: var(--amber); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.narrow { max-width: 560px; }
.loading { padding: 48px 16px; text-align: center; color: var(--muted); }
.empty { padding: 24px 16px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
.empty a { color: var(--gold-text); font-weight: 600; }
.hint { font-size: 14px; color: var(--muted); margin: -4px 0 14px; }
.error-box { padding: 32px 16px; text-align: center; display: grid; gap: 12px; justify-items: center; }

/* ---------- Structure : barre du haut, menu, contenu ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: calc(var(--top-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  background: var(--ink);
  color: var(--on-ink);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--gold);
  border-radius: 6px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.brand-name { font-size: 12px; font-weight: 600; letter-spacing: 0.22em; text-transform: uppercase; white-space: nowrap; }
.brand-name b { color: var(--gold); font-weight: 600; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(245, 240, 232, 0.2);
  border-radius: 999px;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}

.view { max-width: 1120px; margin: 0 auto; padding: 16px 16px calc(var(--nav-h) + 40px + env(safe-area-inset-bottom)); }
.is-driver .view { max-width: 640px; padding-bottom: calc(32px + env(safe-area-inset-bottom)); }

.nav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
}
.nav a.active { color: var(--text); }
.nav a.active .nav-ic { color: var(--gold-text); }
.nav .nav-new .nav-ic {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-top: -20px;
  border-radius: 50%;
  background: var(--accent-bg);
  color: var(--accent-fg) !important;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

@media (min-width: 960px) {
  .is-staff { display: grid; grid-template-columns: 220px minmax(0, 1fr); }
  .is-staff .topbar { grid-column: 1 / -1; }
  .nav {
    position: sticky;
    top: var(--top-h);
    display: flex;
    flex-direction: column;
    gap: 2px;
    height: calc(100vh - var(--top-h));
    padding: 16px 12px;
    border-top: 0;
    border-right: 1px solid var(--border);
  }
  .nav a { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px; font-size: 14px; }
  .nav a.active { background: var(--surface-2); }
  .nav .nav-new { order: -1; margin-bottom: 14px; background: var(--accent-bg); color: var(--accent-fg); }
  .nav .nav-new.active { background: var(--accent-bg); color: var(--accent-fg); }
  .nav .nav-new .nav-ic { width: auto; height: auto; margin: 0; background: none; box-shadow: none; }
  .view { width: 100%; padding: 24px 32px 48px; }
}

/* ---------- Titres et sections ---------- */

.page-head { display: flex; align-items: center; gap: 10px; margin: 2px 0 16px; }
.page-head.wrap { flex-wrap: wrap; }
.page-head .muted { font-size: 14px; margin-top: 2px; }
.page-head .back { margin-left: -10px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.section { margin-top: 22px; }
.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-title .more { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; font-size: 13px; text-transform: none; letter-spacing: 0; color: var(--gold-text); text-decoration: none; }
.count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}
.count-red { background: var(--red); color: #fff; }
.count-amber { background: var(--amber); color: #fff; }
.day { margin-bottom: 18px; }
.day-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; margin: 18px 0 8px; font-size: 16px; font-weight: 700; }
.day-title .muted { font-size: 14px; font-weight: 500; }
.day-title .count { align-self: center; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 16px; }
.card-title { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 15px; font-weight: 700; }
.notice { margin-bottom: 12px; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; }
.notice-red { background: var(--red-soft); color: var(--red); }
.notice-amber { background: var(--amber-soft); color: var(--amber); }
.allgood { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: var(--radius); background: var(--green-soft); color: var(--green); font-weight: 600; font-size: 14px; }

/* ---------- Boutons, puces, badges ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--gold); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--accent-bg); border-color: var(--accent-bg); color: var(--accent-fg); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #0a0a0a; }
.btn-accept { background: var(--green); border-color: var(--green); color: #fff; }
.btn-refuse { background: var(--surface); border: 2px solid var(--red); color: var(--red); }
.btn-danger { color: var(--red); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-lg { min-height: 56px; border-radius: var(--radius); font-size: 17px; }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: 14px; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
}
.icon-btn:hover { background: var(--surface-2); }
.actions-row { display: flex; flex-wrap: wrap; gap: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.chip:hover { border-color: var(--gold); }
.chip.active { background: var(--accent-bg); border-color: var(--accent-bg); color: var(--accent-fg); font-weight: 600; }
.chip small { color: var(--muted); font-weight: 400; font-size: 12px; }
.chip.active small { color: inherit; opacity: 0.8; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  text-transform: none;
  letter-spacing: 0;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tone-red { background: var(--red-soft); color: var(--red); }
.tone-amber { background: var(--amber-soft); color: var(--amber); }
.tone-blue { background: var(--blue-soft); color: var(--blue); }
.tone-green { background: var(--green-soft); color: var(--green); }
.tone-grey { background: var(--grey-soft); color: var(--grey); }
.tone-purple { background: var(--purple-soft); color: var(--purple); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); font-size: 12px; font-weight: 700; }
.tag-gold { background: var(--gold-soft); color: var(--gold-text); }

/* ---------- Champs ---------- */

.lbl { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.lbl.mt { margin-top: 14px; }
.field { display: block; margin-bottom: 14px; }
.field-hint { display: block; margin-top: 4px; font-size: 13px; color: var(--muted); }
.input {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 16px; /* 16 px minimum : évite le zoom automatique sur iPhone */
  appearance: none;
}
.input:focus { outline: 2px solid var(--gold); outline-offset: -1px; border-color: transparent; }
.input::placeholder { color: var(--muted); opacity: 0.8; }
.input.invalid { border-color: var(--red); background: var(--red-soft); }
.input-sm { min-height: 42px; padding: 8px 10px; }
select.input {
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
textarea.input { min-height: 64px; resize: vertical; line-height: 1.4; }
input[type="date"].input, input[type="time"].input { min-width: 0; }
.check { width: 22px; height: 22px; flex: none; accent-color: var(--gold-text); cursor: pointer; }
.check-field { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.check-field .field-hint { font-weight: 400; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.toolbar { display: flex; gap: 8px; margin-bottom: 14px; }
.toolbar .input { flex: 1; }

.search { position: relative; flex: 1 1 260px; max-width: 360px; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { min-height: 42px; padding-left: 38px; }

/* ---------- Tableau de bord ---------- */

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 720px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
}
.kpi:hover { border-color: var(--gold); }
.kpi-n { font-size: 28px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-l { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi-sub { font-size: 14px; font-weight: 700; }
.kpi.zero .kpi-n { color: var(--muted); }
.kpi.alert { background: var(--red-soft); border-color: transparent; }
.kpi.alert .kpi-n, .kpi.alert .kpi-l { color: var(--red); }
.kpi.warn { background: var(--amber-soft); border-color: transparent; }
.kpi.warn .kpi-n, .kpi.warn .kpi-l { color: var(--amber); }
.kpi.ok .kpi-n { color: var(--green); }
.kpi.gold { background: var(--gold-soft); border-color: transparent; }
.kpi.gold .kpi-n, .kpi.gold .kpi-sub { color: var(--gold-text); }

.todo { display: grid; gap: 10px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--red); border-radius: var(--radius); }
.todo-main { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: start; text-decoration: none; }
@media (min-width: 720px) {
  .todo { grid-template-columns: minmax(0, 1fr) 220px; align-items: center; }
}

/* ---------- Lignes de course ---------- */

.list { display: flex; flex-direction: column; gap: 8px; }
.list-head { display: none; }
.row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: start;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
}
.row:hover { border-color: var(--gold); }
.row.st-a_affecter, .row.st-refusee { border-left: 4px solid var(--red); }
.row.st-en_attente { border-left: 4px solid var(--amber); }
.row.st-annulee { opacity: 0.6; }
.row-time { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
.row-time small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); }
.row-main { min-width: 0; }
.row-client { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Trajet sur deux lignes max : la destination reste visible sur téléphone. */
.row-route { font-size: 14px; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; }
.row-meta { font-size: 13px; color: var(--muted); }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.row-driver { font-size: 13px; font-weight: 600; white-space: nowrap; }
.row-driver.none { color: var(--red); }

@media (min-width: 960px) {
  .row { grid-template-columns: 64px minmax(0, 1fr) 260px; align-items: center; }
  .row-main { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); column-gap: 16px; }
  .row-meta { grid-column: 2; }
  .row-side { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
  .row-side .badge { min-width: 104px; justify-content: center; }
  .planning-list .list-head {
    display: grid;
    grid-template-columns: 64px minmax(0, 0.8fr) minmax(0, 1.2fr) 260px;
    column-gap: 16px;
    padding: 0 18px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
  }
}

/* ---------- Planning ---------- */

.daynav { display: flex; align-items: center; gap: 4px; padding: 6px; margin-bottom: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.daynav-label { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; cursor: pointer; padding: 4px 0; }
.daynav-label strong { font-size: 17px; }
.daynav-label span { font-size: 13px; color: var(--muted); }
.daynav-label input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.planning-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.planning-bar p { flex: 1 1 200px; font-size: 14px; }

/* ---------- Formulaire de course ---------- */

.cform { max-width: 720px; }
.fs { padding: 16px; margin-bottom: 12px; }
.ac { position: relative; }
.ac-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 40;
  max-height: 320px;
  overflow: auto;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}
.ac-item { display: block; width: 100%; padding: 10px 12px; border: 0; border-radius: 8px; background: none; text-align: left; font-weight: 600; cursor: pointer; }
.ac-item small { display: block; font-size: 13px; font-weight: 400; color: var(--muted); }
.ac-item:hover, .ac-item.active { background: var(--surface-2); }
.ac-item.create { color: var(--gold-text); }
.client-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; font-size: 14px; }
.routes { display: grid; gap: 8px; }
@media (min-width: 560px) { .routes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.route-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--gold-soft);
  text-align: left;
  font-weight: 600;
  cursor: pointer;
}
.route-chip span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.route-chip small { font-weight: 500; color: var(--muted); }
.route-chip:hover { border-color: var(--gold); }
.swap-row { display: flex; justify-content: flex-end; margin: 4px 0 2px; }
.stepper { display: flex; align-items: center; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.stepper button { width: 48px; height: 46px; flex: none; border: 0; background: var(--surface-2); font-size: 22px; cursor: pointer; }
.stepper input { flex: 1; min-width: 0; height: 46px; border: 0; background: transparent; text-align: center; font-size: 17px; font-weight: 700; }
.stepper input:focus { outline: none; }
.lines { margin: 12px 0 4px; }
.line { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px dashed var(--border); }
.line:first-child { border-top: 0; }
.line-name { flex: 1; min-width: 0; }
.line-name small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.line-name select { max-width: 100%; }
.qty, .money { position: relative; flex: none; }
.qty { width: 78px; }
.money { width: 116px; }
.qty input, .money input { padding-right: 26px; text-align: right; font-variant-numeric: tabular-nums; }
.qty span, .money span { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 14px; pointer-events: none; }
.lines-total { display: flex; justify-content: space-between; padding-top: 10px; border-top: 1px solid var(--border); font-size: 16px; }
.sticky-actions { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px); z-index: 20; margin-top: 16px; }
.sticky-actions .btn { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); }
@media (min-width: 960px) { .sticky-actions { bottom: 16px; } }

/* ---------- Fiche course ---------- */

.detail-grid { display: grid; gap: 12px; }
@media (min-width: 960px) { .detail-grid { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: start; } }
.kv { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px 12px; margin: 0; }
.kv dt { padding-top: 1px; font-size: 13px; font-weight: 600; color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.kv a { color: var(--gold-text); text-decoration: none; font-weight: 600; }
.lines-table { width: 100%; border-collapse: collapse; }
.lines-table td { padding: 8px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.lines-table small { display: block; font-size: 12px; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.totals { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; padding-top: 10px; font-size: 14px; }
.totals strong { font-size: 18px; }
.timeline { margin: 0; padding: 0; list-style: none; font-size: 14px; }
.timeline li { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline time { flex: none; min-width: 88px; font-size: 12px; color: var(--muted); padding-top: 2px; font-variant-numeric: tabular-nums; }

/* ---------- Facturation ---------- */

.tabs { display: flex; gap: 4px; margin-bottom: 14px; padding: 4px; overflow-x: auto; border-radius: 12px; background: var(--surface-2); }
.tab { flex: 1; display: grid; place-items: center; min-height: 40px; padding: 0 14px; border-radius: 9px; color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.bsummary { margin-bottom: 12px; font-size: 15px; }
.bgroup { margin-bottom: 12px; overflow: hidden; }
.bgroup-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface-2); cursor: pointer; }
.brow { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--border); cursor: pointer; }
.brow-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.brow-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.brow-amount { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.brow-amount a { color: var(--gold-text); text-decoration: none; font-weight: 600; }
.selbar {
  position: sticky;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px);
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--on-ink);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}
.selbar .btn { background: #1d1d1d; border-color: #333; color: var(--on-ink); }
.selbar .btn-gold { background: var(--gold); border-color: var(--gold); color: #0a0a0a; }
@media (min-width: 960px) { .selbar { bottom: 16px; } }

/* ---------- Gestion ---------- */

.mlist { overflow: hidden; }
.mrow { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 0; border-top: 1px solid var(--border); background: none; text-align: left; cursor: pointer; }
.mrow:first-child { border-top: 0; }
.mrow:hover { background: var(--surface-2); }
.mrow.inactive { opacity: 0.55; }
.mrow-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mrow-title { font-weight: 700; }
.mrow-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--muted); }
.mrow .ic { color: var(--muted); }
.mlist .empty { border: 0; }
.prices { margin: 4px 0 14px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.prices legend { padding: 0 4px; margin: 0; }
.price-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 14px; }
.price-row > span:first-child { flex: 1; min-width: 0; }

/* ---------- Fenêtres modales ---------- */

dialog.sheet {
  width: min(560px, calc(100% - 32px));
  max-height: 90vh;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
}
dialog.sheet::backdrop { background: rgba(10, 10, 10, 0.55); }
.sheet-form { display: flex; flex-direction: column; max-height: 90vh; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 8px 10px 18px; border-bottom: 1px solid var(--border); }
.sheet-head h2 { font-size: 17px; }
.sheet-body { padding: 16px 18px 4px; overflow-y: auto; }
.sheet-foot { display: flex; align-items: center; gap: 8px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
@media (max-width: 600px) {
  dialog.sheet { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 18px 18px 0 0; }
  .sheet-form { max-height: 92vh; }
}

/* ---------- Écran chauffeur ---------- */

.dcard { padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.dcard.pending { border: 2px solid var(--amber); }
.dcard-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dcard-time { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.dcard-day { font-size: 15px; font-weight: 600; color: var(--muted); }
.dcard-client { display: flex; align-items: center; gap: 10px; margin-top: 2px; font-size: 19px; font-weight: 700; }
.call { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--green-soft); color: var(--green); }
.stops { position: relative; margin: 14px 0; padding-left: 24px; }
.stops::before { content: ""; position: absolute; left: 7px; top: 14px; bottom: 36px; width: 2px; background: var(--border); }
.stop { position: relative; padding: 4px 0 8px; }
.stop::before { content: ""; position: absolute; left: -23px; top: 8px; width: 12px; height: 12px; border: 3px solid var(--green); border-radius: 50%; background: var(--surface); }
.stop.to::before { border-color: var(--red); background: var(--red); }
.stop-label { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.stop-addr { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.stop-links { display: flex; gap: 16px; margin-top: 2px; }
.stop-links a { color: var(--gold-text); font-size: 14px; font-weight: 600; text-decoration: none; padding: 4px 0; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; }
.fact { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; background: var(--surface-2); font-size: 14px; font-weight: 600; text-decoration: none; }
.note { margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--gold-soft); font-size: 15px; white-space: pre-wrap; }
.collect { margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--amber-soft); color: var(--amber); font-size: 15px; }
.dactions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.dactions .full { grid-column: 1 / -1; }
.dcard > .btn-ghost { margin-top: 10px; min-height: 40px; }
.drow { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 14px; }
.drow:first-child { border-top: 0; }
.drow-when { flex: none; width: 96px; font-size: 13px; color: var(--muted); }
.drow-main { flex: 1; min-width: 0; display: flex; flex-direction: column; font-weight: 600; }
.drow-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; }

/* ---------- Connexion ---------- */

.login { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding: 24px 16px; background: var(--ink); color: var(--on-ink); }
.login-box { width: min(360px, 100%); }
.login-brand { display: grid; justify-items: center; gap: 12px; margin-bottom: 32px; text-align: center; }
.login-brand p { color: #a39d91; font-size: 14px; }
.brand-mark.big { width: 56px; height: 56px; font-size: 18px; border-radius: 10px; }
.login .brand-name { font-size: 14px; }
.login .lbl { color: #a39d91; }
.login .input { background: #161616; border-color: #2d2b27; color: #f5f0e8; }
.login .btn-primary { background: var(--gold); border-color: var(--gold); color: #0a0a0a; margin-top: 8px; }
.login-error { margin-bottom: 8px; color: #f97066; font-size: 14px; font-weight: 600; }

/* ---------- Notification ---------- */

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom));
  z-index: 100;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translate(-50%, 16px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--red); color: #fff; }
@media (min-width: 960px) { #toast { bottom: 24px; } }

/* ---------- V2 : parties, adresses, véhicules, chauffeurs, factures ---------- */

.grid-zip { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px; }
.row-orderer { font-weight: 500; color: var(--muted); }
.link-strong { color: var(--gold-text); font-weight: 700; text-decoration: none; }

/* Écran chauffeur */
.dcard-orderer { margin-top: 2px; font-size: 14px; color: var(--muted); }
.stop-city { font-size: 15px; font-weight: 700; }
.fact-strong { background: var(--gold-soft); color: var(--gold-text); }
/* Vol arrivant à Nice : lien vers le site de l'aéroport (retard, terminal). */
.fact-link { background: var(--gold-soft); color: var(--gold-text); text-decoration: underline; text-underline-offset: 3px; }
.mt-xs { margin-top: 6px; }
.flight-check { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 14px; font-weight: 600; color: var(--gold-text); }
.flight-check[hidden] { display: none; }

/* Journée par chauffeur */
.driver-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.driver-tile { display: flex; flex-direction: column; gap: 2px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); text-decoration: none; }
.driver-tile:hover { border-color: var(--gold); }
.driver-tile-n { font-size: 20px; font-weight: 800; }
.driver-tile.is-alert { background: var(--red-soft); border-color: transparent; color: var(--red); }
.driver-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.driver-col-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 4px 4px 10px; border-bottom: 2px solid var(--gold); margin-bottom: 10px; }
.driver-col-head strong { font-size: 16px; }
.driver-col.is-alert .driver-col-head { border-color: var(--red); }
.driver-col.is-alert .driver-col-head strong { color: var(--red); }
.driver-col .row { grid-template-columns: 56px minmax(0, 1fr) auto; align-items: start; }
.driver-col .row-main { display: block; }
.driver-col .row-side { flex-direction: column; align-items: flex-end; }
.driver-col .row-side .badge { min-width: 0; }
.driver-col .row-driver { display: none; }
.driver-col .empty { padding: 14px; }
.tabs-inline { flex: 0 0 auto; margin: 0; }

/* Facturation */
.bgroup-foot { display: flex; justify-content: flex-end; padding: 12px 14px; border-top: 1px solid var(--border); }
.bgroup-head .tag { margin-right: 4px; }
.row.inv-row { grid-template-columns: minmax(0, 1fr) auto; }
.lines-table .num small { display: block; }

/* Formulaires de gestion */
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 12px; }
.form-grid > .field { grid-column: 1 / -1; }
.form-grid > .field.half { grid-column: auto; }
.price-grid { display: grid; grid-template-columns: minmax(0, 1fr) repeat(var(--cols, 2), minmax(84px, 120px)); gap: 6px 8px; align-items: center; }
.price-grid-head { font-size: 12px; font-weight: 700; color: var(--muted); text-align: right; }
.price-grid-name { min-width: 0; font-size: 13px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; hyphens: auto; }
.price-grid .money { width: auto; }
.type-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.type-row .input { flex: 1; }

/* Menu à 6 entrées (patron qui conduit) */
.nav.nav-6 { grid-template-columns: repeat(6, 1fr); }
.nav.nav-6 a { font-size: 10px; }
.nav.nav-7 { grid-template-columns: repeat(7, 1fr); }
.nav.nav-7 a { font-size: 9px; }
.nav.nav-8 { grid-template-columns: repeat(8, 1fr); }
.nav.nav-8 a { font-size: 9px; }
.nav-short { display: inline; }
.nav-long { display: none; }
@media (min-width: 960px) { .nav.nav-8 a { font-size: 14px; } .nav-short { display: none; } .nav-long { display: inline; } }
@media (min-width: 960px) { .nav.nav-7 a { font-size: 14px; } }
@media (min-width: 960px) { .nav.nav-6 a { font-size: 14px; } }

/* ---------- V3 : flotte ---------- */
.fleet { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.fleet-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.fleet-card.inactive { opacity: 0.6; }
.fleet-head { display: flex; align-items: flex-start; gap: 8px; }
.fleet-head strong { font-size: 17px; }
.plate { display: inline-block; margin-left: 6px; padding: 2px 8px; border: 2px solid var(--text); border-radius: 6px; font-size: 13px; font-weight: 800; letter-spacing: 0.06em; font-variant-numeric: tabular-nums; }
.fleet-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 0; }
.fleet-stats dt { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.fleet-stats dd { margin: 2px 0 0; font-size: 16px; font-weight: 700; }
.fleet-stats dd small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.fleet-history { border-top: 1px solid var(--border); padding-top: 4px; }
.fleet-history .icon-btn { width: 32px; height: 32px; color: var(--muted); }
.toolbar .hint { margin: 0; align-self: center; }

.update-banner { position: fixed; top: calc(var(--top-h) + env(safe-area-inset-top) + 8px); left: 50%; transform: translateX(-50%); z-index: 90; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: var(--ink); color: var(--on-ink); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); font-size: 14px; font-weight: 600; width: max-content; max-width: calc(100% - 32px); }
.phone-url { margin: 6px 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--gold-soft); color: var(--gold-text); font-size: 20px; font-weight: 800; letter-spacing: 0.02em; text-align: center; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

/* ---------- V4 : pointage ---------- */
.punch-banner { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); text-decoration: none; font-size: 15px; font-weight: 600; }
.punch-banner span { flex: 1; }
.punch-banner strong { color: var(--gold-text); }
.punch-banner.is-todo { background: var(--amber-soft); border-color: transparent; color: var(--amber); }
.punch-banner.is-todo strong { color: inherit; text-decoration: underline; }
.punch-card { display: flex; flex-direction: column; gap: 12px; }
.punch-status { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; }
.punch-times { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0; }
.punch-times dt { font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.punch-times dd { margin: 2px 0 0; font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.punch-card .dactions { margin-top: 0; }
.ts-row { width: 100%; border: 0; border-top: 1px solid var(--border); background: none; text-align: left; cursor: pointer; }
.ts-row:first-child { border-top: 0; }
.ts-row:hover { background: var(--surface-2); }
.ts-weeknav { margin: 0; padding: 2px 4px; gap: 8px; }
.ts-table-wrap { overflow-x: auto; }
.ts-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 760px; }
.ts-table th, .ts-table td { padding: 6px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.ts-table thead th { font-size: 12px; color: var(--muted); font-weight: 700; white-space: nowrap; }
.ts-table thead th.is-today { color: var(--gold-text); }
.ts-table tbody th { font-size: 14px; white-space: nowrap; }
.ts-cell { display: flex; flex-direction: column; gap: 1px; width: 100%; min-height: 44px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); text-align: left; cursor: pointer; font-variant-numeric: tabular-nums; }
.ts-cell:hover { border-color: var(--gold); }
.ts-cell small { color: var(--muted); }
.ts-cell.is-missing { background: var(--red-soft); border-color: transparent; color: var(--red); font-weight: 600; }
.ts-cell.is-open { background: var(--amber-soft); border-color: transparent; }
.ts-total { font-weight: 800; white-space: nowrap; }
.dactions .btn { min-width: 0; white-space: normal; line-height: 1.2; text-align: center; padding: 0 10px; }

/* ---------- V6 : heure 24 h, plages, planning semaine/mois, fiche Dext ---------- */
.capitalize { text-transform: capitalize; }
.timefield { display: flex; align-items: center; gap: 4px; }
.timefield select.input { width: auto; min-width: 72px; padding-right: 30px; }
.timefield-sep { font-weight: 700; color: var(--muted); }
.timefield.invalid select { border-color: var(--red); background-color: var(--red-soft); }

.punch-periods { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.week-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.week-head strong { flex: 1; text-align: center; }
.ts-row.is-today { background: var(--gold-soft); }
.period-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.period-arrow { color: var(--muted); font-weight: 700; }
.ts-cell span { display: block; }
.ts-cell.is-off { background: var(--grey-soft); border-color: transparent; color: var(--grey); font-weight: 700; }

.week-grid { display: grid; gap: 10px; }
@media (min-width: 960px) { .week-grid { grid-template-columns: repeat(7, minmax(130px, 1fr)); overflow-x: auto; } }
.week-day { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.week-day.is-today { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.week-day-head { display: flex; align-items: center; justify-content: space-between; text-decoration: none; text-transform: capitalize; }
.week-item { display: flex; flex-direction: column; gap: 1px; padding: 6px 8px; border-radius: 8px; background: var(--surface-2); text-decoration: none; font-size: 13px; border-left: 3px solid var(--blue); }
.week-item small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.week-item.st-a_affecter, .week-item.st-refusee { border-left-color: var(--red); }
.week-item.st-en_attente { border-left-color: var(--amber); }
.week-item.st-effectuee, .week-item.st-no_show { border-left-color: var(--green); opacity: 0.75; }
.week-empty { margin: 2px 0; }
.week-add { font-size: 12px; font-weight: 600; color: var(--gold-text); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }

.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.month-dow { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.month-cell { display: flex; flex-direction: column; gap: 2px; min-height: 72px; padding: 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); text-decoration: none; overflow: hidden; }
.month-cell.is-other { opacity: 0.4; }
.month-cell.is-today { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.month-cell.has-courses { background: var(--gold-soft); }
.month-num { font-weight: 800; font-size: 13px; }
.month-count { font-size: 16px; font-weight: 800; color: var(--gold-text); line-height: 1.1; }
.month-count small { font-size: 11px; font-weight: 600; }
.month-flag { font-size: 10px; font-weight: 700; line-height: 1.2; }
.month-flag.alert { color: var(--red); }
.month-flag.warn { color: var(--amber); }
@media (max-width: 600px) { .month-count small, .month-flag { display: none; } .month-cell { min-height: 52px; } }

.bgroup-foot { gap: 8px; }
.brow { text-decoration: none; }
.dext-sheet { padding: 24px; max-width: 900px; }
.dext-head { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 2px solid var(--gold); }
.dext-period { font-weight: 700; }
.dext-client { display: flex; flex-direction: column; gap: 2px; margin: 16px 0; }
.dext-client strong { font-size: 18px; }
.dext-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.dext-table th { text-align: left; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border); padding: 6px 4px; }
.dext-table td { padding: 8px 4px; border-bottom: 1px solid var(--border); vertical-align: top; }
.dext-table small { color: var(--muted); }
.dext-table th.num { text-align: right; }
.dext-course-head td { padding-top: 14px; border-bottom: 0; }
.dext-guest { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; font-size: 15px; }
.dext-guest strong { font-size: 16px; }
.dext-guest .missing, .dext-guest.missing { color: var(--red); font-weight: 700; }
.dext-guest a { font-size: 13px; font-weight: 700; }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); font-weight: 700; }

/* Fiche client : coordonnées, totaux et toutes ses courses. */
/* Le nom du client garde toute la largeur sur téléphone ; les boutons passent dessous. */
.client-head h1 { flex: 1 1 60%; }
@media (max-width: 600px) { .client-head h1 { flex-basis: calc(100% - 56px); } }
.client-card { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; margin-bottom: 14px; }
.client-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.client-contact { display: flex; flex-wrap: wrap; gap: 4px 16px; font-weight: 600; }
.client-contact a { display: inline-flex; align-items: center; gap: 6px; }
.client-kpis { margin-bottom: 12px; }
.client-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.client-actions:empty { display: none; }
.crow-room { padding: 1px 8px; border-radius: 999px; background: var(--gold-soft); color: var(--gold-text); font-size: 13px; font-weight: 700; white-space: nowrap; }
.crow-amount { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.crow .row-client { white-space: normal; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; }
.crow .nowrap { white-space: nowrap; }
.strong-link { font-weight: 700; }
.dext-route { font-size: 13px; color: var(--muted); margin-top: 2px; }
.dext-course tr:last-child td { border-bottom: 1px solid var(--border); }
.dext-course tr:not(.dext-course-head) td { border-bottom: 0; padding-top: 4px; }
.dext-course tr:not(.dext-course-head):last-child td { border-bottom: 1px solid var(--border); padding-bottom: 12px; }
@media screen and (max-width: 600px) { .dext-sheet { padding: 16px; } .dext-table .opt { display: none; } }
.dext-totals { margin: 14px 0 8px auto; max-width: 340px; display: flex; flex-direction: column; gap: 4px; }
.dext-totals div { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }
.dext-grand { font-size: 18px; font-weight: 800; border-top: 1px solid var(--border); padding-top: 6px; }

/* Impression de la fiche Dext : uniquement la fiche, sur fond blanc. */
@media print {
  .topbar, .nav, .no-print, #toast, .update-banner { display: none !important; }
  body, .view { background: #fff !important; color: #000 !important; padding: 0 !important; }
  .is-staff { display: block !important; }
  .dext-sheet { border: 0; box-shadow: none; max-width: none; padding: 0; }
  .dext-table small, .dext-sheet .muted, .dext-route { color: #444 !important; }
  .dext-guest, .dext-guest strong { color: #000 !important; }
  .dext-course { break-inside: avoid; }
}
/* Pas d'en-tête ni de pied de page du navigateur (date, titre, adresse de l'appli, n° de page) : il les imprime
   dans la marge de la page, donc marge à 0, recréée à l'intérieur (répétée sur chaque page). */
@page { margin: 0; }
@media print {
  .view { padding: 12mm 12mm !important; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
  .view:has(.day-sheet) { padding: 7mm 5mm !important; }
}
.period-row { display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 12px; margin-bottom: 8px; border: 1px solid var(--border); border-radius: 10px; flex-wrap: nowrap; }
.period-times { flex: 1; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 6px 10px; }
.period-lbl { font-size: 13px; font-weight: 700; color: var(--muted); }

/* Noms de clients et de passagers : saisis et affichés en majuscules. */
.upper { text-transform: uppercase; }
.upper::placeholder { text-transform: none; }
.tone-gold { background: var(--gold-soft); color: var(--gold-text); }
.toolbar { flex-wrap: wrap; }
.toolbar .input { min-width: 180px; }
.bgroup-note { padding: 8px 14px; font-size: 13px; background: var(--gold-soft); color: var(--gold-text); }
.bgroup-note a { font-weight: 700; }

/* Sous-traitance à une société partenaire et relevés mensuels. */
.notice-green { background: var(--green-soft); color: var(--green); }
.notice-blue { background: var(--blue-soft); color: var(--blue); }
.row-driver.partner { color: var(--blue); }
.releve-section { margin-top: 18px; }
.releve-section h2 { font-size: 16px; margin: 0 0 4px; }
.releve-section .hint { margin: 0 0 8px; }
.releve-sum { margin: 18px 0 8px auto; max-width: 420px; display: flex; flex-direction: column; gap: 4px; }
.releve-sum div { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }
.releve-sum .dext-grand { font-size: 17px; }
.releve-list .row { grid-template-columns: minmax(0, 1fr) auto; }
@media print { .releve-section { break-inside: auto; } .dext-table tr { break-inside: avoid; } }
.client-pax { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin-top: 4px; font-size: 14px; }
.client-pax .lbl { width: 100%; margin: 0; }

/* Paiement prévu → règlement final */
.pay { font-weight: 500; }
.pay-ok { color: var(--green); }
.pay-diff { color: var(--amber); font-weight: 700; }
.pay-missing { color: var(--red); font-weight: 700; }
.pay-planned { margin-top: 10px; font-size: 15px; }
.pay-chips .chip small { opacity: .75; font-weight: 500; }
.brow .pay { display: block; font-size: 13px; }
.ts-days .drow { width: 100%; }

/* Récap stand-by (Gestion › Pointages) */
button.tab { border: 0; background: none; font: inherit; font-weight: 600; cursor: pointer; }
button.tab.active { background: var(--surface); }
.rc-driver { margin-bottom: 16px; overflow: hidden; }
.rc-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
.rc-head > strong.grow { font-size: 17px; }
.rc-standby, .rc-standby strong { color: var(--amber); }
.rc-row { display: grid; grid-template-columns: 1.3fr repeat(6, 1fr); gap: 8px; align-items: center; padding: 10px 16px; font-size: 14px; }
.rc-cols { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.rc-day { border-top: 1px solid var(--border); }
.rc-day > summary { cursor: pointer; list-style: none; }
.rc-day > summary::-webkit-details-marker { display: none; }
.rc-day[open] > summary { background: var(--surface-2); }
.rc-alert { box-shadow: inset 3px 0 0 var(--red); }
.rc-date { font-weight: 600; }
.rc-courses { padding: 6px 16px 12px; }
.rc-course { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 8px 0; border-bottom: 1px dashed var(--border); color: inherit; text-decoration: none; font-size: 14px; }
.rc-course:last-child { border-bottom: 0; }
.rc-kind { min-width: 92px; font-weight: 600; font-size: 13px; }
@media (max-width: 700px) {
  .rc-cols { display: none; }
  .rc-row { grid-template-columns: 1fr 1fr; gap: 4px 12px; }
  .rc-row .rc-date { grid-column: 1 / -1; }
  .rc-row [data-l]::before { content: attr(data-l) " : "; color: var(--muted); font-size: 12px; }
}

/* Mode de règlement sur la fiche Dext (et son PDF) : bien visible. */
.dext-pay { margin-top: 4px; font-size: 14px; font-weight: 700; color: var(--text); }
.dext-client .dext-pay { font-size: 15px; }
.dext-pay.is-todo { color: var(--red); }
@media print { .dext-pay, .dext-pay.is-todo { color: #000 !important; } }
.icon-btn-sm { width: 26px; height: 26px; min-height: 0; vertical-align: middle; }
.client-pax .btn { margin-left: auto; }
/* Relance du bureau (écran chauffeur) */
.remind-banner { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--red-soft); color: var(--red); font-size: 15px; }
.remind-banner span { flex: 1; }
.remind-banner .btn { flex: 0 0 auto; }
.remind-banner.push-banner { background: var(--gold-soft); color: var(--text); text-decoration: none; }
.remind-status { font-size: 13px; }
.ts-remind { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.ts-table th .remind-status { display: block; margin-top: 4px; font-weight: 500; }

/* Récapitulatif pour facturation (écran et PDF) : sobre, lisible, sans jargon interne. */
.recap-sheet { max-width: 860px; margin: 0 auto; padding: 28px 32px; }
.recap-sheet.is-wide { max-width: 1040px; }
.recap-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 14px; border-bottom: 2px solid var(--gold); }
.recap-brand { font-size: 18px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.recap-title { text-align: right; }
.recap-title h2 { margin: 0; font-size: 22px; letter-spacing: .04em; text-transform: uppercase; }
.recap-title div { color: var(--muted); font-size: 14px; }
.recap-title .recap-period { color: var(--text); font-weight: 600; margin-top: 4px; }
.recap-client { display: flex; flex-direction: column; gap: 2px; margin: 18px 0; font-size: 14px; }
.recap-client strong { font-size: 17px; }
.recap-pay { margin-top: 6px; font-weight: 700; }
.recap-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.recap-table th { padding: 8px 8px; border-bottom: 1.5px solid var(--text); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; text-align: left; }
.recap-table td { padding: 9px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.recap-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.recap-table tfoot th { border-top: 1.5px solid var(--text); border-bottom: 0; font-size: 14px; text-transform: none; }
.recap-when { width: 92px; white-space: nowrap; font-weight: 600; }
.recap-when span { font-weight: 400; color: var(--muted); }
.recap-guest { font-weight: 700; }
.recap-guest.missing, .recap-table .missing { color: var(--red); }
.recap-route { font-size: 12px; color: var(--muted); }
.recap-obs { font-size: 12px; font-style: italic; margin-top: 2px; }
.recap-mode { font-weight: 600; white-space: nowrap; }
.recap-totals { margin: 16px 0 0 auto; max-width: 360px; display: flex; flex-direction: column; gap: 4px; font-variant-numeric: tabular-nums; }
.recap-totals div { display: flex; justify-content: space-between; gap: 12px; }
.recap-grand { font-size: 17px; font-weight: 800; border-top: 1.5px solid var(--text); padding-top: 6px; }
.releve-section h3 { font-size: 15px; margin: 20px 0 6px; }
@media screen and (max-width: 700px) {
  .recap-sheet { padding: 16px; }
  .recap-table-wrap, .recap-sheet { overflow-x: auto; }
  .recap-hotel { font-size: 12px; }
}
@media print {
  .recap-sheet { border: 0; box-shadow: none; max-width: none; padding: 0; color: #000; }
  .recap-title div, .recap-when span, .recap-route { color: #333 !important; }
  .recap-head { border-bottom-color: #000; }
  .recap-table tr { break-inside: avoid; }
  .recap-hotel { font-size: 12px; }
}
@media print {
  .recap-table th, .recap-table td, .recap-grand { border-color: #000 !important; color: #000 !important; }
  .recap-table td { border-bottom-color: #bbb !important; }
}
.recap-sep { border-top: 1px solid var(--border); padding-top: 6px; margin-top: 4px; }
/* Récap : corriger / supprimer une course à l'écran (boutons absents du PDF). */
.recap-actions { width: 1%; white-space: nowrap; text-align: right; padding-left: 0 !important; padding-right: 0 !important; }
.recap-actions .icon-btn { margin-left: 2px; }
.recap-hotel td.recap-actions { min-width: 0; }
.recap-hotel .recap-actions .icon-btn { display: flex; margin: 0 0 2px auto; }
.recap-price { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; white-space: nowrap;
  text-decoration: underline dotted; text-underline-offset: 3px; }
.recap-price:hover { color: var(--gold-text); }
@media print { .recap-price { text-decoration: none; } }
.sub-actions { display: flex; align-items: center; gap: 4px; }
@media print { .recap-sep { border-top-color: #000 !important; } }
/* Espèces à déposer au bureau (chauffeur) */
.cash-box { margin-bottom: 14px; padding: 12px 14px; border-radius: var(--radius); background: var(--amber-soft); color: var(--amber); }
.cash-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.cash-head strong { font-size: 20px; }
.cash-line { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 3px 0; color: var(--text); }
.cash-ok { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; padding: 10px 14px; border-radius: var(--radius); background: var(--green-soft); color: var(--green); font-size: 14px; }
.cash-driver { margin-bottom: 14px; }
.cash-driver .cash-line { padding: 6px 0; border-bottom: 1px solid var(--border); }
.cash-driver label.cash-line { cursor: pointer; }
.cash-office .cash-line { text-decoration: none; }
.cash-office .cash-line:hover span:first-child { text-decoration: underline; }
.cash-inline { display: block; font-size: 14px; }
.cash-receipt { align-items: center; }

/* E-mails aux hôtels qui commandent par e-mail : confirmation, bon de transport. */
.mail-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.mail-row .actions-row { margin: 0; }
.mail-todo { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--amber-soft); color: var(--amber); font-weight: 700; font-size: 12px; }
.mail-box { border-color: var(--amber); }
.btn-danger-outline { color: var(--red); border-color: var(--red); }
.bon-kv { display: grid; grid-template-columns: 190px 1fr; gap: 8px 16px; margin: 18px 0; font-size: 15px; }
.bon-kv dt { color: var(--muted); font-weight: 600; }
.bon-kv dd { margin: 0; }
.bon-sign { display: flex; justify-content: space-between; gap: 24px; margin-top: 36px; font-size: 13px; color: var(--muted); }
.bon-sign div { flex: 1; border-top: 1px solid var(--border); padding-top: 6px; }
@media (max-width: 600px) { .bon-kv { grid-template-columns: 1fr; gap: 2px; } .bon-kv dd { margin-bottom: 8px; } }

/* Facturation › Sous-traitance */
.sub-group { margin-bottom: 14px; }
.sub-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--border); }
.sub-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; text-decoration: none; color: inherit; }
.sub-when { font-size: 13px; color: var(--muted); }
.sub-when b { color: var(--text); font-size: 15px; }
.sub-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) { .sub-row { flex-direction: column; } .sub-side { align-items: flex-start; flex-direction: row; flex-wrap: wrap; } }

/* Récap au fil de l'eau : course pas encore effectuée. */
.recap-planned { display: inline-block; margin-left: 4px; padding: 0 5px; border: 1px solid var(--border); border-radius: 4px; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }

/* PDF du planning de la journée : une page A4 paysage, une ligne par course. */
@page jour { size: A4 landscape; margin: 0; }
.day-sheet { page: jour; max-width: 1100px; margin: 0 auto; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); font-size: 12px; }
.day-head { display: flex; align-items: baseline; gap: 16px; padding-bottom: 6px; margin-bottom: 6px; border-bottom: 2px solid var(--gold); }
.day-brand { font-weight: 800; letter-spacing: .06em; text-transform: uppercase; font-size: 14px; }
.day-title { flex: 1; font-weight: 700; font-size: 14px; }
.day-count { color: var(--muted); }
.day-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.day-table th { padding: 4px 5px; border-bottom: 1.5px solid var(--text); font-size: 10px; text-transform: uppercase; letter-spacing: .03em; text-align: left; }
.day-table td { padding: 4px 5px; border-bottom: 1px solid var(--border); vertical-align: top; line-height: 1.25; overflow-wrap: anywhere; }
.day-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.day-table .w-time { width: 7%; } .day-table .w-client { width: 15%; } .day-table .w-pax { width: 14%; }
.day-table .w-service { width: 18%; } .day-table .w-route { width: 20%; } .day-table .w-driver { width: 10%; }
.day-table .w-pay { width: 9%; } .day-table .w-ttc { width: 8%; }
.day-time { font-size: 13px; font-weight: 800; white-space: nowrap; }
/* De l'air entre l'heure et le client. */
.day-table td.day-time, .day-table th:first-child { padding-right: 14px; }
.day-table td:nth-child(2), .day-table th:nth-child(2) { padding-left: 10px; }
.day-strong { font-weight: 700; }
.day-sub { font-size: 10.5px; color: var(--muted); font-weight: 400; }
.day-foot { margin-top: 12px; font-variant-numeric: tabular-nums; }
.day-total { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 22px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.day-total strong { font-size: 1.1em; }
/* Chauffeurs, puis sociétés partenaires : un par ligne, côte à côte. */
.day-lists { display: flex; flex-wrap: wrap; gap: 8px 48px; margin-top: 12px; }
.day-lists section { min-width: 220px; }
.day-lists h3 { margin: 0 0 4px; font-size: .85em; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.day-lists div { display: flex; justify-content: space-between; gap: 24px; padding: 1px 0; }
.day-sheet.is-roomy { font-size: 13.5px; } .day-sheet.is-roomy .day-table td { padding: 7px 6px; } .day-sheet.is-roomy .day-time { font-size: 15px; } .day-sheet.is-roomy .day-sub { font-size: 11.5px; }
.day-sheet.is-dense { font-size: 11px; } .day-sheet.is-dense .day-table td { padding: 3px 4px; } .day-sheet.is-dense .day-time { font-size: 12px; }
.day-sheet.is-tiny { font-size: 10px; } .day-sheet.is-tiny .day-table td { padding: 2px 4px; } .day-sheet.is-tiny .day-sub { font-size: 9px; }
@media print {
  .day-sheet { border: 0; padding: 0; max-width: none; }
  .day-table .day-sub { color: #444 !important; }
  .day-table tr { break-inside: avoid; }
}

/* Téléphones : appel normal + WhatsApp (conversation, d'où l'on peut aussi appeler). */
.phone-links { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.wa-link { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; background: #e7f8ee; color: #128c4a; font-size: 12px; font-weight: 700; text-decoration: none; }
.call-group { display: inline-flex; gap: 8px; }
.call-wa { background: #25d366; color: #fff; }

/* Police des drapeaux (Twemoji Country Flags, licence libre, fournie dans public/fonts) : Windows n'affiche pas
   les drapeaux-émojis ; cette police ne contient que les drapeaux (le reste du texte garde la police habituelle). */
@font-face {
  font-family: 'Drapeaux';
  src: url('/fonts/TwemojiCountryFlags.woff2') format('woff2');
  unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E0063, U+E0065, U+E0067, U+E006C, U+E006E, U+E0073-E0074, U+E0077, U+E007F;
  font-display: swap;
}
/* Téléphone : indicatif (drapeau) + numéro. */
.phonefield { display: flex; gap: 6px; width: 100%; }
.phonefield { position: relative; }
.phone-cc { flex: 0 0 96px; width: 96px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; white-space: nowrap; }
.phone-flag { font-family: 'Drapeaux', system-ui, sans-serif; font-size: 1.15em; line-height: 1; }
.cc-pop { position: fixed; z-index: 1000; width: 290px; max-width: calc(100vw - 16px); padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .18); }
.cc-list { list-style: none; margin: 6px 0 0; padding: 0; max-height: 260px; overflow-y: auto; }
.cc-list li { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.cc-list li.active, .cc-list li:hover { background: var(--surface-2); }
.cc-list li.current .cc-name { font-weight: 700; }
.cc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-dial { color: var(--muted); font-variant-numeric: tabular-nums; }
.cc-empty { color: var(--muted); cursor: default !important; }
.phone-local { flex: 1 1 auto; min-width: 0; }

/* Adresse d'envoi des ventes à Dext (Facturation › Transmis à Dext). */
.dext-mail { margin-bottom: 14px; }
.dext-mail-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 6px; word-break: break-all; }
/* Sous-traitance : qui a encaissé, et ce que chacun facture à l'autre. */
.sub-title { margin: 0; padding: 8px 14px 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-top: 1px solid var(--border); }
.sub-title + .sub-row { border-top: 0; }
.sub-collect { font-weight: 600; }
.sub-result { white-space: normal; text-align: right; max-width: 340px; font-size: 14px; }
.sub-result.is-in { color: var(--green); }
.sub-result.is-out { color: var(--amber); }
.sub-foot { align-items: center; gap: 10px; }
.radio-line { display: flex; align-items: center; gap: 8px; padding: 6px 0; cursor: pointer; }
.recap-settle { font-size: 12px; }
@media (max-width: 600px) { .sub-result { text-align: left; max-width: none; } }
@media print { .sub-result.is-in, .sub-result.is-out { color: #000 !important; } }
/* Récap d'un partenaire : colonnes « qui facture quoi », texte replié plutôt que tableau trop large. */
.recap-partner .recap-mode { white-space: normal; }
.recap-partner .recap-settle { text-align: left; white-space: normal; }
.recap-partner th.num, .recap-partner .recap-when { width: 1%; }
.recap-partner th.num { white-space: normal; min-width: 90px; }
/* ---------- Facture / avoir (A4 portrait) : colonnes à largeur fixe, texte replié, rien ne dépasse du cadre. ---------- */
.inv-sheet { max-width: 820px; margin: 0 auto; padding: 28px 32px; color: var(--text); font-size: 13px; line-height: 1.45; }
.inv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding-bottom: 14px; border-bottom: 2px solid var(--gold); }
.inv-seller { min-width: 0; overflow-wrap: anywhere; }
.inv-brand { font-size: 20px; font-weight: 800; letter-spacing: .06em; margin-bottom: 4px; }
.inv-title { text-align: right; flex-shrink: 0; }
.inv-title h2 { margin: 0 0 4px; font-size: 24px; letter-spacing: .08em; text-transform: uppercase; }
.inv-number { font-size: 15px; font-weight: 700; }
.inv-parties { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin: 18px 0; }
.inv-period { font-weight: 600; padding-top: 18px; }
.inv-buyer { width: 46%; min-width: 0; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; overflow-wrap: anywhere; }
.inv-buyer strong { display: block; font-size: 15px; }
.inv-lbl { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 2px; }
.inv-table { width: 100%; table-layout: fixed; border-collapse: collapse; }
.inv-table .c-date { width: 78px; }
.inv-table .c-vat { width: 52px; }
.inv-table .c-num { width: 92px; }
.inv-table th { padding: 7px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; text-align: left; border-bottom: 1.5px solid var(--text); }
.inv-table td { padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
.inv-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.inv-table tr { break-inside: avoid; }
.inv-label { font-weight: 700; }
.inv-detail { font-size: 12px; color: var(--muted); }
.inv-paid { font-size: 12px; font-weight: 600; }
.inv-totals { margin: 14px 0 0 auto; width: 300px; max-width: 100%; display: flex; flex-direction: column; gap: 3px; font-variant-numeric: tabular-nums; break-inside: avoid; }
.inv-totals div { display: flex; justify-content: space-between; gap: 12px; }
.inv-sep { border-top: 1px solid var(--border); padding-top: 4px; margin-top: 2px; }
.inv-grand { font-size: 16px; font-weight: 800; border-top: 1.5px solid var(--text); padding-top: 4px; margin-top: 2px; }
.inv-mentions { margin-top: 22px; font-size: 11px; color: var(--muted); break-inside: avoid; }
.inv-mentions p { margin: 0 0 3px; }
.inv-legal { margin-top: 16px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 10.5px; text-align: center; color: var(--muted); overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .inv-sheet { padding: 16px; }
  .inv-head, .inv-parties { flex-direction: column; }
  .inv-title { text-align: left; }
  .inv-buyer { width: 100%; }
  .inv-table .c-date { width: 64px; }
  .inv-table .c-vat { width: 0; }
  .inv-table th:nth-child(3), .inv-table td:nth-child(3), .inv-table th:nth-child(4), .inv-table td:nth-child(4) { display: none; }
}
@media print {
  .inv-sheet { border: 0; box-shadow: none; max-width: none; padding: 0; color: #000; font-size: 12px; }
  .inv-head { border-bottom-color: #000; }
  .inv-detail, .inv-mentions, .inv-legal, .inv-lbl { color: #333 !important; }
  .inv-table th, .inv-table td, .inv-grand { border-color: #000 !important; color: #000 !important; }
  .inv-table td { border-bottom-color: #bbb !important; }
  /* Récap d'un partenaire : colonnes figées pour tenir dans la page. */
  .recap-partner { table-layout: fixed; }
  .recap-partner td, .recap-partner th { overflow-wrap: anywhere; }
}
.company-form { max-width: 760px; }
.check-line { display: flex; align-items: center; gap: 8px; }
.inv-course { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border); }
.inv-course a.grow { text-decoration: none; color: inherit; }
/* Facture, version 2 (29/09 soir) : date entière, TVA par ligne + détail par taux, identité de la société en bas de page. */
.inv-table .c-date { width: 84px; }
.inv-table .c-rate { width: 54px; }
.inv-table .c-num { width: 80px; }
.inv-table td.nowrap { white-space: nowrap; overflow-wrap: normal; }
.inv-table th.num { white-space: normal; overflow-wrap: normal; }
.inv-bottom { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-top: 16px; break-inside: avoid; }
.inv-bottom .inv-totals { margin: 0; width: 260px; }
.inv-vat { width: 330px; max-width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.inv-vat caption { text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.inv-vat th, .inv-vat td { padding: 4px 6px; border-bottom: 1px solid var(--border); text-align: left; }
.inv-vat th { font-size: 11px; }
.inv-vat .num { text-align: right; white-space: nowrap; }
.inv-vat tfoot th { border-top: 1.5px solid var(--text); border-bottom: 0; }
.inv-legal { margin-top: 24px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 10.5px; line-height: 1.5; text-align: center; color: var(--muted); }
.inv-legal strong { color: var(--text); font-weight: 600; }
@media (max-width: 600px) {
  .inv-bottom { flex-direction: column; }
  .inv-bottom .inv-totals, .inv-vat { width: 100%; }
  .inv-table .c-rate { width: 0; }
  .inv-table th:nth-child(5), .inv-table td:nth-child(5) { display: none; }
}
@media print {
  /* Identité de la société collée en bas de chaque page ; la place est réservée sous le contenu. */
  .inv-sheet { padding-bottom: 22mm; }
  .inv-legal { position: fixed; left: 12mm; right: 12mm; bottom: 8mm; margin: 0; background: #fff; color: #333 !important; border-top-color: #000; }
  .inv-legal strong { color: #000; }
  .inv-vat th, .inv-vat td { border-color: #999 !important; color: #000 !important; }
  .inv-vat tfoot th { border-top-color: #000 !important; }
}
/* Facture : format d'une page A4, pied de page (identité de la société) toujours collé en bas de la page,
   à l'écran comme sur le PDF. (Remplace la position « fixed » à l'impression, pas fiable selon les navigateurs.) */
.inv-sheet { display: flex; flex-direction: column; min-height: 1130px; }
.inv-sheet > .inv-legal { margin-top: auto; }
.inv-mentions { margin-bottom: 24px; }
@media (max-width: 600px) { .inv-sheet { min-height: 0; } }
@media print {
  .inv-sheet { min-height: 271mm; padding-bottom: 0; }
  .inv-legal { position: static; background: none; }
}
.inv-search { margin-bottom: 10px; }
/* Sans la ligne « Prestations du… » : le bloc du client reste à droite. */
.inv-parties { justify-content: flex-end; }
/* Accueil, e-mails à envoyer : ligne cliquable + petite croix pour la retirer sans envoyer. */
.mail-line { align-items: center; }
.mail-line a { flex: 1; display: flex; justify-content: space-between; gap: 10px; color: inherit; text-decoration: none; }
/* Argent versé : frais payés par le chauffeur (une ligne par frais) et récapitulatif du versement. */
.exp-lines { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.exp-line { display: grid; grid-template-columns: minmax(0, 1fr) 110px auto; gap: 6px; align-items: center; }
.deposit-sum { display: flex; flex-direction: column; gap: 3px; margin: 4px 0 12px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2, rgba(0,0,0,.04)); font-variant-numeric: tabular-nums; }
.deposit-sum div { display: flex; justify-content: space-between; gap: 10px; }
.deposit-got { font-weight: 700; border-top: 1px solid var(--border); padding-top: 3px; }
.deposit-sum p { margin: 4px 0 0; font-size: 13px; }
/* Règles du mot de passe : cochées en vert au fur et à mesure de la saisie. */
.pw-rules { list-style: none; margin: -6px 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }
.pw-rules li::before { content: '○ '; }
.pw-rules li.ok { color: var(--green); font-weight: 600; }
.pw-rules li.ok::before { content: '✓ '; }
/* Multi-course : étapes entre la prise en charge et la dépose. */
.course-stops { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 4px; padding: 10px 12px; border-left: 3px solid var(--gold); background: var(--surface-2, rgba(0,0,0,.03)); border-radius: 0 8px 8px 0; }
.cstop { padding-top: 8px; border-top: 1px dashed var(--border); }
.cstop-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.cstop-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; align-items: center; }
.cstop-start { margin-bottom: 0; }
.line-detail { margin-top: 6px; width: 100%; }
/* Itinéraire (fiche course, chauffeur, PDF) */
.itinerary { list-style: none; margin: 6px 0; padding: 0; }
.itinerary li { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--border); }
.itinerary li:last-child { border-bottom: 0; }
.itinerary time { font-weight: 700; font-variant-numeric: tabular-nums; }
.itinerary small { display: block; color: var(--muted); }
.stop.mid::before { border-color: var(--gold); }
.stop-note { font-size: 14px; color: var(--muted); }
/* Programme d'une course en plusieurs étapes : « 12h00  HÔTEL CAP ESTEL  RÉCUPÉRATION BAGAGES ». */
.prog { list-style: none; margin: 10px 0; padding: 0; border-left: 3px solid var(--gold); }
.prog li { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 8px; padding: 7px 0 7px 10px; border-bottom: 1px dashed var(--border); }
.prog li:last-child { border-bottom: 0; }
.prog-time { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.prog-place { font-size: 16px; font-weight: 800; text-transform: uppercase; overflow-wrap: anywhere; }
.prog-act { display: inline-block; font-size: 14px; font-weight: 700; text-transform: uppercase; color: var(--gold-text, var(--text)); }
.prog-note { display: block; color: var(--muted); font-size: 13px; }
.prog .stop-links { display: flex; gap: 16px; margin-top: 2px; }
.prog-info { margin: 8px 0; padding: 8px 10px; border-radius: 8px; background: var(--amber-soft); color: var(--amber); font-weight: 700; text-transform: uppercase; }
@media print { .prog { border-left-color: #000; } .prog-act { color: #000 !important; } .prog-info { background: none; color: #000 !important; border: 1px solid #000; } }
.line-move { display: flex; flex-direction: column; gap: 2px; }
.line-move .icon-btn:disabled { opacity: .25; }
.mb { margin-bottom: 12px; }
.proposal-box { border-color: var(--blue, #2563eb); }
.proposal-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 0; border-top: 1px solid var(--border); }
.proposal-line a.grow { color: inherit; text-decoration: none; }
/* Dates à la française : champ JJ/MM/AAAA + calendrier (lundi en premier). */
.datefield { display: flex; align-items: center; gap: 4px; }
.datefield .input { flex: 1; min-width: 0; }
.frcal { position: absolute; z-index: 1000; width: 280px; padding: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.frcal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.frcal-head strong { text-transform: capitalize; }
.frcal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.frcal-dow { font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.frcal-day { border: 0; background: none; padding: 7px 0; border-radius: 8px; cursor: pointer; font: inherit; color: var(--text); }
.frcal-day:hover { background: var(--surface-2, rgba(0,0,0,.06)); }
.frcal-day.today { font-weight: 800; color: var(--gold-text, var(--text)); }
.frcal-day.on { background: var(--gold); color: #000; font-weight: 800; }
.frcal-foot { display: flex; justify-content: center; margin-top: 6px; }
.daynav-label { cursor: pointer; }

/* Facture v3 (30/09) : format A4 imposé (sinon « Letter » sur un navigateur en anglais : pied de page en page 2) ;
   pied de page de la société fixé en bas de chaque page, place réservée par le pied (vide) du tableau inv-page. */
@page { size: A4; margin: 0; }
.inv-page { width: 100%; border-collapse: collapse; }
.inv-page > tbody > tr > td, .inv-page > tfoot > tr > td { padding: 0; vertical-align: top; }
.inv-foot-space { height: 0; }
@media print {
  .inv-sheet { min-height: 0 !important; display: block; padding-bottom: 0 !important; }
  .inv-foot-space { height: 20mm; }
  .inv-legal { position: fixed; left: 12mm; right: 12mm; bottom: 7mm; margin: 0; padding-top: 6px; background: #fff; }
}

/* Facture v4 (30/09) : lignes « date à heure / prestation / passager », mentions et pied de page en bas de page. */
.inv-table td { padding-top: 10px; padding-bottom: 10px; }
.inv-when { font-size: 12px; font-weight: 700; color: var(--muted); }
.inv-pax { font-size: 12.5px; }
.inv-sheet > .inv-foot { margin-top: auto; }
.inv-foot .inv-mentions { margin: 18px 0 0; }
.inv-foot .inv-legal { margin-top: 10px; }
@media print {
  .inv-when { color: #333 !important; }
  .inv-foot-space { height: 44mm; }
  .inv-legal { position: static; background: none; padding-top: 6px; }
  .inv-foot { position: fixed; left: 12mm; right: 12mm; bottom: 7mm; background: #fff; }
  .inv-foot .inv-mentions { margin-top: 0; }
}
@media (max-width: 600px) {
  .inv-table { table-layout: auto; }
  .inv-table th:nth-child(5), .inv-table td:nth-child(5) { display: table-cell; }
  .inv-table th:nth-child(2), .inv-table td:nth-child(2) { display: none; }
}

/* Facture v5 : colonne Date (date puis heure) à gauche, puis la désignation et le passager. */
.inv-table td.inv-date { white-space: nowrap; font-variant-numeric: tabular-nums; }
.inv-hour { font-weight: 700; }
@media (max-width: 600px) {
  .inv-table th:nth-child(2), .inv-table td:nth-child(2) { display: table-cell; }
  .inv-table th:nth-child(3), .inv-table td:nth-child(3), .inv-table th:nth-child(4), .inv-table td:nth-child(4), .inv-table th:nth-child(5), .inv-table td:nth-child(5) { display: none; }
  .inv-table th:nth-child(6), .inv-table td:nth-child(6) { display: table-cell; }
}
/* Facture en pages A4 fixes (invoice-layout.js) : même rendu à l'écran et à l'impression. */
.invd { display: flex; flex-direction: column; align-items: center; gap: 18px; margin: 8px 0; }
.inv-pg { --text: #111; --muted: #555; --border: #d9d6cc; --surface: #fff; width: 210mm; height: 297mm; box-sizing: border-box; padding: 14mm 14mm 9mm;
  background: #fff; color: #111; box-shadow: 0 2px 14px rgba(0,0,0,.18); display: flex; flex-direction: column; overflow: hidden; font-size: 12.5px; line-height: 1.45; }
.inv-measure { position: absolute; left: -10000px; top: 0; visibility: hidden; }
.inv-pg .inv-head { border-bottom-color: #111; }
.inv-pg .inv-parties { margin: 12mm 0 9mm; }
.inv-next { margin: 5mm 0 4mm; font-weight: 700; }
.inv-fill { flex: 1; }
.inv-pg .inv-bottom { margin-top: 6mm; }
.inv-pg .inv-mentions { margin: 7mm 0 0; font-size: 10.5px; color: #333; }
.inv-pg .inv-legal { margin-top: 5mm; padding-top: 6px; border-top: 1px solid #111; font-size: 10px; color: #333; text-align: center; }
.inv-pageno { text-align: right; margin-top: 2px; }
.inv-carry td { font-style: italic; font-weight: 600; background: #f5f2e8; }
.inv-pg .inv-date { white-space: nowrap; }
@media print {
  .view:has(.invd) { padding: 0 !important; }
  .invd { gap: 0; margin: 0; zoom: 1 !important; }
  .inv-pg { box-shadow: none; break-after: page; page-break-after: always; }
  .inv-pg:last-child { break-after: auto; page-break-after: auto; }
  .inv-carry td { background: none; }
}
/* Pages A4 : toujours toutes les colonnes (sur téléphone, la page entière est réduite, pas découpée). */
.inv-pg .inv-table { table-layout: fixed !important; }
.inv-pg .inv-table th, .inv-pg .inv-table td { display: table-cell !important; }
.inv-pg .inv-head { flex-direction: row !important; }
.inv-pg .inv-title { text-align: right !important; }
.inv-pg .inv-parties { flex-direction: row !important; }
.inv-pg .inv-buyer { width: 46% !important; }
.inv-pg .inv-bottom { flex-direction: row !important; }
.inv-pg .inv-bottom .inv-totals { width: 260px !important; }
.inv-pg .inv-vat { width: 330px !important; }

/* Saisie rapide de courses depuis un récapitulatif (views/quick-add.js) : une carte par course, champs sur une grille. */
dialog.sheet.sheet-wide { width: min(980px, calc(100% - 24px)); }
.qa-row { position: relative; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px 10px; margin: 0 0 12px; padding: 10px 12px 12px; border: 1px solid var(--border); border-radius: 12px; min-width: 0; }
.qa-row legend { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 0 6px; }
.qa-del { position: absolute; top: -6px; right: 6px; background: var(--surface); }
.qa-retbox { grid-column: 1 / -1; }
.qa-f { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.qa-f > span { font-size: 12px; color: var(--muted); }
.qa-f .input { min-width: 0; width: 100%; }
.qa-f .input.num { text-align: right; }
.qa-f .input.invalid { border-color: var(--danger, #b3261e); }
.qa-f { grid-column: span var(--span, 4); }
@media (max-width: 700px) {
  .qa-f { grid-column: span 6; }
  .qa-f:has([name="passenger_name"], [name="service_id"], [name="pickup"], [name="dropoff"], [name="misc_label"]) { grid-column: span 12; }
}

/* Récaps : comme la facture — date puis heure en dessous ; prestation en gras, puis « Passager : NOM — Chambre ». */
.recap-label { font-weight: 700; }
.recap-pax { font-size: 13px; }
.recap-pax.missing { color: var(--red); }
.recap-hotel td:nth-child(n+3) { min-width: 84px; }
.recap-hotel td.recap-actions { min-width: 0; }
.qa-sum { grid-column: 1 / -1; margin: 0; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.qa-sum:empty { display: none; }

/* Récap v2 : tableau aéré avec HT / TVA / TTC, étiquettes de règlement, bas de page en trois cadres
   (par règlement, détail de la TVA, totaux et commission). Même esprit que la facture. */
.recap-sheet { padding: 36px 40px 40px; }
.recap-head { padding-bottom: 18px; }
.recap-client { margin: 22px 0 26px; }
.recap-billed { font-size: 14px; }
.recap-billed thead th { padding: 10px 10px; background: var(--surface-2, #f6f4ee); border-bottom: 1.5px solid var(--text); }
.recap-billed td { padding: 13px 10px; }
.recap-billed tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--border) 18%, transparent); }
.recap-billed .recap-when { width: 96px; line-height: 1.5; }
.recap-label { font-weight: 700; line-height: 1.35; }
.recap-qty { font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.recap-pax { margin-top: 3px; font-size: 13px; color: var(--text); }
.recap-billed .recap-route { margin-top: 2px; }
.recap-rate { font-size: 11px; color: var(--muted); margin-top: 2px; }
.recap-ttc { font-weight: 700; }
.recap-paytag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap;
  border: 1px solid var(--border); background: var(--surface); }
.recap-paytag.pay-note { border-color: color-mix(in srgb, var(--gold) 55%, transparent); background: color-mix(in srgb, var(--gold) 12%, transparent); }
.recap-paytag.pay-cb { border-color: color-mix(in srgb, #2f6fb3 45%, transparent); background: color-mix(in srgb, #2f6fb3 10%, transparent); }
.recap-paytag.pay-especes { border-color: color-mix(in srgb, #2d7a4c 45%, transparent); background: color-mix(in srgb, #2d7a4c 10%, transparent); }

.recap-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 28px; align-items: start; }
.recap-box { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; break-inside: avoid; }
.recap-box h4 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.recap-mini { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.recap-mini th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); text-align: left; padding: 0 0 6px; border-bottom: 1px solid var(--border); }
.recap-mini td { padding: 7px 0; border-bottom: 1px solid var(--border); }
.recap-mini tr:last-child td { border-bottom: 0; }
.recap-mini .num { text-align: right; white-space: nowrap; padding-left: 10px; }
.recap-box-totals { display: flex; flex-direction: column; gap: 6px; font-variant-numeric: tabular-nums; }
.recap-box-totals > div { display: flex; justify-content: space-between; gap: 12px; }
.recap-box-totals .recap-grand { margin-top: 2px; }
@media (max-width: 700px) {
  .recap-sheet { padding: 18px 14px; }
  .recap-billed { font-size: 12.5px; }
  .recap-billed td { padding: 10px 6px; }
}
@media print {
  .recap-sheet { padding: 0; }
  .recap-billed thead th { background: none !important; }
  .recap-billed tbody tr:nth-child(even) td { background: none !important; }
  .recap-paytag { border-color: #999 !important; background: none !important; color: #000 !important; }
  .recap-box { border-color: #999 !important; }
  .recap-summary { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
  .recap-rate, .recap-qty, .recap-box h4, .recap-mini th { color: #333 !important; }
}
.recap-box-totals > div > span:last-child { white-space: nowrap; text-align: right; }
.recap-summary { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

/* Récapitulatif en pages A4 fixes (paged.js + views/releve.js) : même trame que la facture. */
.recap-pgtable .c-date { width: 80px; }
.recap-pgtable .c-pay { width: 74px; }
.recap-pgtable .c-num { width: 78px; }
.recap-pgtable .c-act { width: 30px; }
.recap-pgtable th { padding: 8px 6px; background: #f3f0e8; }
.recap-pgtable td { padding: 9px 6px; }
.recap-pgtable tbody tr:not(.inv-carry):nth-child(even) td { background: #faf8f3; }
.recap-pgtable .recap-when { width: auto; font-weight: 600; line-height: 1.45; }
.recap-pgtable .recap-pax { font-size: 11.5px; }
.recap-pgtable .recap-qty { font-size: 11.5px; }
.recap-pgtable .recap-paytag { font-size: 10.5px; padding: 1px 7px; }
.recap-pgtable td.recap-actions { padding: 6px 0 !important; }
.recap-pgtable .recap-actions .icon-btn { display: flex; margin: 0 0 2px auto; }
.inv-pg .recap-period-box { width: 40%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; line-height: 1.6; }
.inv-pg .recap-account { color: var(--muted); margin-top: 2px; }
.inv-pg .pg-last { margin-top: 6mm; }
.inv-pg .recap-summary { display: grid; grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px; margin: 0; font-size: 12px; }
.inv-pg .recap-box { padding: 10px 12px; border-radius: 8px; }
.inv-pg .recap-mini { font-size: 12px; }
.inv-pg .recap-mini td { padding: 5px 0; }
.inv-pg .recap-box-totals .recap-grand { font-size: 15px; }
@media print {
  .inv-pg .inv-table .no-print { display: none !important; }
  .recap-pgtable .c-act { width: 0; }
  .recap-pgtable th, .recap-pgtable tbody tr td { background: none !important; }
}
/* Boutons modifier / annuler / supprimer côte à côte (la ligne garde sa hauteur imprimée). */
.recap-pgtable .c-act { width: 74px; }
.recap-pgtable td.recap-actions { white-space: nowrap; text-align: right; }
.recap-pgtable .recap-actions .icon-btn { display: inline-flex; width: 22px; height: 22px; margin: 0 0 0 1px; }
.inv-pg .inv-parties:has(.recap-period-box) { justify-content: space-between; }
.inv-pg .recap-summary { grid-auto-flow: row; grid-template-columns: 1fr 1.35fr 1fr; }
.inv-pg .recap-summary:not(:has(> :nth-child(3))) { grid-template-columns: 1.35fr 1fr; }

/* Nouvelle course : prestations en colonnes (arrivées, départs, mise à disposition, autres), une par ligne avec son prix. */
.svc-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 6px 0 12px; align-items: start; }
.svc-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.svc-group h4 { margin: 0 0 2px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.svc-opt { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.svc-opt span { min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.svc-opt small { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.svc-opt:hover { border-color: var(--gold); }
.svc-opt.active { border-color: var(--gold); background: var(--gold-soft); box-shadow: inset 0 0 0 1px var(--gold); }
.svc-opt.active small { color: var(--gold-text); }
@media (max-width: 600px) { .svc-groups { grid-template-columns: 1fr; } }

/* Tarifs (fiche client, partenaire) et liste des prestations rangés par type, comme dans Nouvelle course. */
.price-grid-group { grid-column: 1 / -1; margin-top: 10px; padding-bottom: 4px; border-bottom: 1px solid var(--border);
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--gold-text); }
.price-grid > .price-grid-group:first-child { margin-top: 0; }
.mlist-group { padding: 12px 16px 6px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--gold-text);
  background: var(--surface-2); border-bottom: 1px solid var(--border); }

/* Véhicule d'une prestation : sur le récap (étiquette) et dans Nouvelle course (choix pour une prestation ajoutée). */
.recap-car { display: inline-block; margin-left: 4px; padding: 0 6px; border: 1px solid var(--border); border-radius: 4px;
  font-size: 10.5px; font-weight: 600; color: var(--muted); white-space: nowrap; vertical-align: 1px; }
.line-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.line-pick select[data-f="service"] { flex: 1 1 200px; min-width: 0; }
.line-pick select[data-f="vtype"] { flex: 0 1 130px; }
@media print { .recap-car { border-color: #999; color: #000 !important; } }

/* Devis : objet sous l'encadré du destinataire, bloc « Bon pour accord » en bas du dernier feuillet. */
.inv-pg .inv-subject { margin: -4mm 0 5mm; font-size: 12.5px; }
.inv-pg .inv-accept { display: flex; flex-direction: column; gap: 2px; margin: 6mm 0 0; padding: 8px 12px; min-height: 22mm; border: 1px solid #111; border-radius: 6px; font-size: 11px; color: #333; }
.inv-pg .inv-accept strong { color: #111; font-size: 12px; }
.ask-text { white-space: pre-line; margin: 0; line-height: 1.5; }

/* Fiche client : prestations propres, saisies directement dans un tableau (nom, prix par voiture, TVA). */
.own-wrap { overflow-x: auto; }
.own-grid { display: grid; grid-template-columns: minmax(180px, 1.8fr) repeat(var(--cols), minmax(78px, 1fr)) 84px 92px 36px; gap: 6px 8px; align-items: center; min-width: 520px; }
.own-row { display: contents; }
.own-h { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.own-h.num { text-align: right; }
.own-grid input.num { text-align: right; }

/* Règlement groupé : cases à cocher devant chaque facture à régler */
.batch-list { max-height: 38vh; overflow: auto; margin: 10px 0; }
.batch-row { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.batch-row[hidden] { display: none; }
.batch-row input[type="checkbox"] { width: 22px; height: 22px; flex: none; accent-color: var(--accent-bg, #111); }
.batch-row .row-main { flex: 1; min-width: 0; }
.batch-row .row-side { flex: none; }

/* ---------- Clients : liste et fiche (téléphone d'abord) ---------- */
button.kpi { border: 0; font: inherit; text-align: left; cursor: pointer; color: inherit; }
.kpi.bad { background: var(--red-soft, #fbe4e1); color: var(--red); }
.client-row { min-height: 68px; }
.client-row .row-side { align-items: flex-end; gap: 6px; text-align: right; }
.chips-scroll { display: flex; flex-wrap: nowrap; gap: 8px; margin: 10px 0 14px; padding-bottom: 4px; overflow-x: auto; }
.chips-scroll .chip { flex: none; min-height: 40px; white-space: nowrap; }
.chip small { margin-left: 4px; opacity: 0.7; }
.idfacts { display: grid; gap: 10px; margin-top: 12px; }
@media (min-width: 560px) { .idfacts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.idfact { min-width: 0; }
.idfact .lbl { margin-bottom: 2px; }
.idfact a, .idfact span.val { overflow-wrap: anywhere; font-size: 15px; }
.idfact .idtodo { color: var(--amber); font-weight: 600; }
.status-card { padding: 14px 16px; margin-bottom: 12px; border-left: 6px solid var(--border); }
.status-card.late { border-left-color: var(--red); background: var(--red-soft, #fbe4e1); }
.status-card.due { border-left-color: var(--amber); background: var(--amber-soft); }
.status-card.ok { border-left-color: var(--green); background: var(--green-soft); }
.status-title { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 800; }
.status-card.late .status-title { color: var(--red); }
.status-card.due .status-title { color: var(--amber); }
.status-card.ok .status-title { color: var(--green); }
.status-sub { margin-top: 4px; font-size: 14px; }
.status-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
@media (min-width: 720px) { .status-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.status-tile { padding: 8px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); }
.status-tile b { display: block; font-size: 17px; }
.status-tile span { font-size: 12px; color: var(--muted); }
.inv-cards { display: grid; gap: 10px; margin-top: 10px; }
.inv-card { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); border-left: 6px solid var(--border); }
.inv-card.late { border-left-color: var(--red); }
.inv-card.due { border-left-color: var(--amber); }
.inv-card.paid { border-left-color: var(--green); }
.inv-card.off { opacity: 0.65; }
.inv-card a.inv-card-main { display: block; color: inherit; text-decoration: none; }
.inv-top { display: flex; justify-content: space-between; gap: 10px; font-size: 16px; }
.inv-sub { margin-top: 2px; font-size: 13px; color: var(--muted); }
.inv-state { margin-top: 6px; font-size: 14px; font-weight: 600; }
.inv-state.late { color: var(--red); }
.inv-state.due { color: var(--amber); }
.inv-state.paid { color: var(--green); }
.inv-card .btn { align-self: flex-start; min-height: 44px; }
.client-tabs .tab { flex: 1; text-align: center; min-height: 44px; display: grid; place-items: center; }

.kpis.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.kpis-3 .kpi { padding: 10px 10px; }
.kpis-3 .kpi-sub { font-size: 15px; white-space: nowrap; }
.kpis-3 .kpi-l { font-size: 12px; }
.client-row .row-main { flex: 1; min-width: 0; }
.client-row .row-client { white-space: normal; overflow: visible; text-overflow: clip; font-size: 16px; }
.client-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.client-row .row-side { align-self: center; flex: none; }
.client-row { grid-template-columns: minmax(0, 1fr) auto; }
.client-row .row-meta { white-space: normal; }
.client-block { margin-bottom: 18px; }
.client-block .section-title { margin: 14px 0 8px; }
/* Chauffeur : alerte de plusieurs jours sans pointage ; observation facultative sur une course */
.punch-banner.is-late { background: var(--red-soft); color: var(--red); border-color: var(--red); }
.dnote { margin: 8px 0; }
.dnote .btn { min-height: 44px; }
.punch-banner.is-late strong { color: var(--red); }
/* Société partenaire : case « il nous a facturé » (grande zone à toucher) */
.pbill { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-top: 6px; font-size: 14px; font-weight: 600; color: var(--amber); cursor: pointer; }
.pbill input { width: 24px; height: 24px; flex: none; accent-color: var(--green); }
.pbill.is-done { color: var(--green); }
td.num .pbill { justify-content: flex-end; text-align: right; }
/* Sous-traitance sur téléphone : en-tête de société, lignes de course et pied de bloc sur toute la largeur, sans débordement */
@media (max-width: 720px) {
  .sub-group .bgroup-head { flex-wrap: wrap; }
  .sub-group .bgroup-head .grow { flex: 1 1 100%; }
  .sub-group .brow-amount { align-items: flex-start; white-space: normal; flex: 1 1 100%; }
  .sub-row { flex-direction: column; align-items: stretch; }
  .sub-side { align-items: flex-start; white-space: normal; }
  .sub-result { text-align: left; max-width: none; }
  .sub-collect { white-space: normal; text-align: left; height: auto; min-height: 44px; }
  .sub-foot { flex-wrap: wrap; justify-content: flex-start; }
  .sub-foot .grow { flex: 1 1 100%; }
  .sub-foot .btn { min-height: 44px; }
}

/* Case « En attente d'info » sous un champ heure */
.timefield { flex-wrap: wrap; }
.timena { display: flex; align-items: center; gap: 8px; flex: 1 0 100%; min-height: 36px; margin-top: 4px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.timena input { width: 20px; height: 20px; accent-color: var(--amber); }
.timefield.is-na select { opacity: 0.45; }
.timefield.is-na .timena { color: var(--amber); }
.qa-na { margin-top: 2px; }
input.is-na { background: var(--amber-soft); }
/* Date et heure l'une sous l'autre sur petit écran : les listes heures / minutes restent sur une seule ligne */
@media (max-width: 460px) { .grid2:has([data-timefield]) { grid-template-columns: minmax(0, 1fr); } }
/* Pointage du mois : une ligne par jour (lisible sur téléphone), totaux en haut et en bas */
.ts-month { padding: 0; margin-bottom: 18px; overflow: hidden; }
.ts-month-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; background: var(--surface-2); }
.ts-sum { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px 14px; }
@media (min-width: 720px) { .ts-sum { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.ts-lines { display: grid; }
.ts-cell.ts-line { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto 64px; align-items: center; gap: 8px; width: 100%; min-height: 48px;
  padding: 6px 14px; border: 0; border-top: 1px solid var(--border); border-radius: 0; background: transparent; color: inherit; font: inherit; text-align: left; }
.ts-cell.ts-line.is-weekend { background: var(--surface-2); }
.ts-cell.ts-line.is-today { box-shadow: inset 4px 0 0 var(--gold); }
.ts-cell.ts-line.is-future { opacity: 0.6; }
.ts-cell.ts-line.is-off { background: var(--grey-soft); color: var(--grey); font-weight: 600; }
.ts-cell.ts-line.is-missing { background: var(--red-soft); color: var(--red); }
.ts-cell.ts-line.is-open { background: var(--amber-soft); }
.ts-line .ts-d { font-weight: 700; font-size: 14px; }
.ts-line .ts-p small { display: block; }
.ts-line .ts-h { text-align: right; font-variant-numeric: tabular-nums; }
.ts-line .ts-m { text-align: right; }
.ts-month-foot { border-top: 2px solid var(--border); background: var(--surface-2); }
.meal-toggle { margin: 10px 0 4px; min-height: 44px; }

/* Une ligne qui commence par son contenu (sans colonne d'heure) ne doit pas être coincée dans la colonne étroite de l'heure */
.row:has(> .row-main:first-child) { grid-template-columns: minmax(0, 1fr) auto; }
[data-billing-tabs] { scroll-snap-type: x proximity; }
[data-billing-tabs] .tab { flex: none; scroll-snap-align: center; }
.row:has(> .row-main:first-child) .row-client,
.row:has(> .row-main:first-child) .row-route,
.row:has(> .row-main:first-child) .row-meta { white-space: normal; overflow: visible; text-overflow: clip; }
.row:has(> .row-main:first-child) .row-route { display: block; -webkit-line-clamp: unset; line-clamp: unset; max-height: none; }
/* Tickets et frais des chauffeurs : photo du ticket */
.ticket-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; min-height: 76px; cursor: pointer; }
.ticket-row .row-main { display: grid; gap: 2px; min-width: 0; }
.ticket-row .row-client { white-space: normal; }
.ticket-row .row-meta { white-space: normal; }
.ticket-thumb { flex: none; width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); }
.ticket-none { display: grid; place-items: center; color: var(--muted); font-size: 10px; text-align: center; }
.ticket-big { display: block; width: 100%; max-height: 60vh; object-fit: contain; margin: 0 0 12px; border-radius: 12px; border: 1px solid var(--border); background: #000; }
.ticket-photo-btn { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 12px; min-height: 56px; cursor: pointer; }
.input-lg { font-size: 22px; min-height: 52px; font-weight: 700; }
.btn-lg { min-height: 52px; }
.chip-select { width: auto; flex: none; min-width: 160px; }
/* Téléphone : plus aucun texte coupé par « … » — noms, trajets, paiements passent à la ligne pour tout afficher */
@media (max-width: 720px) {
  .row-client, .row-meta, .route-chip span, .brow-main small, .mrow-sub, .drow-main small, .week-item small, .cc-name {
    white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere;
  }
  .row-route { display: block; overflow: visible; -webkit-line-clamp: unset; line-clamp: unset; max-height: none; }
}

/* Récap sur téléphone : cartes lisibles à l'écran, pages A4 pour l'impression / le PDF */
.recap-phone { display: none; }
@media (max-width: 720px) {
  .recap-phone { display: grid; gap: 10px; margin: 8px 0 16px; }
  [data-recapdoc] { height: 0; overflow: hidden; }
}
@media print { .recap-phone { display: none !important; } [data-recapdoc] { height: auto !important; overflow: visible !important; } }
.rc-card { padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--border); }
.rc-card.is-planned { border-left-color: var(--blue); }
.rc-top { display: flex; align-items: baseline; gap: 8px; font-size: 16px; }
.rc-ttc { font-size: 17px; }
.rc-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; }
.rc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.rc-actions .btn { min-height: 44px; }
.rc-summary { padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
/* Téléphone : boutons assez grands pour le pouce (≥ 40 px), pieds de blocs qui passent à la ligne au lieu de sortir de l'écran */
@media (max-width: 720px) {
  .icon-btn.icon-btn-sm { min-width: 40px; min-height: 40px; }
  .recap-price { min-height: 40px; display: inline-flex; align-items: center; gap: 4px; }
  .bgroup-foot { flex-wrap: wrap; justify-content: flex-start; }
  .bgroup-foot .btn, .bgroup-foot a.btn { min-height: 44px; }
  .sub-actions { flex-wrap: wrap; }
}
/* Fenêtres de saisie : les boutons passent à la ligne au lieu de sortir de l'écran (Enregistrer toujours visible) */
.sheet-foot { flex-wrap: wrap; }
@media (max-width: 720px) {
  .sheet-foot .btn { min-height: 46px; flex: 1 1 auto; }
  .sheet-foot .spacer { display: none; }
  .sheet-foot .btn-primary { flex: 1 1 100%; order: 10; }
}

/* Aperçu modifiable d'un e-mail avant l'envoi */
.mail-edit { min-height: 220px; max-height: 50vh; overflow: auto; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; color: #222; }
.mail-edit:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.mail-edit table { max-width: 100%; }

/* Aperçu d'un e-mail (fiche client, Gestion › Société) */
.mail-preview { margin: 12px 0 18px; }
.mail-paper { margin-top: 6px; padding: 14px 8px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; color: #222; overflow-x: auto; }

.mail-preview-head { display: flex; align-items: center; gap: 10px; }
