:root {
  --bg: #f4f1ea; --card: #fffdf8; --ink: #1f2a24; --muted: #6b726c; --line: #e3ddd0;
  --brand: #1f5c4a; --brand-ink: #fff; --accent: #c8741f;
  --ok: #2f7d4f; --warn: #b7791f; --bad: #b3362b; --info: #2c5f8a;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121714; --card: #1a211d; --ink: #e8ebe6; --muted: #98a19a; --line: #2b342f;
    --brand: #3f9b7c; --brand-ink: #0d1411; --accent: #e09a4f;
    --ok: #5cbf86; --warn: #e0aa4f; --bad: #e77066; --info: #6fa8dc;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.45 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px 96px; }
header.top {
  position: sticky; top: 0; z-index: 5; background: var(--brand); color: var(--brand-ink);
  padding: 12px 16px; display: flex; align-items: center; justify-content: space-between;
}
header.top b { letter-spacing: .04em; font-size: 15px; }
header.top button { background: transparent; color: inherit; border: 1px solid currentColor; opacity: .85; padding: 6px 10px; font-size: 13px; }
nav.tabs { display: flex; gap: 8px; margin: 16px 0; }
nav.tabs button { flex: 1; background: var(--card); color: var(--ink); border: 1px solid var(--line); }
nav.tabs button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; box-shadow: var(--shadow); }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 12px; font-weight: 600; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
button {
  font: inherit; font-weight: 600; border: 0; border-radius: 10px; padding: 12px 14px; cursor: pointer;
  background: var(--brand); color: var(--brand-ink);
}
button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button.wa { background: #1f9d55; color: #fff; }
button.danger { background: transparent; color: var(--bad); border: 1px solid var(--bad); }
button:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.row > button { flex: 1 1 140px; }
.price { font-size: 34px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.price small { font-size: 15px; font-weight: 500; color: var(--muted); }
.kv { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 13px; margin-top: 4px; }
.kv b { color: var(--ink); font-weight: 600; }
.alert { border-left: 3px solid var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent); padding: 8px 10px; border-radius: 6px; margin: 6px 0; font-size: 13px; }
.alert.bad { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, transparent); }
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { display: grid; grid-template-columns: 74px 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.tl li:last-child { border-bottom: 0; }
.tl .h { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.tl .pause { color: var(--warn); }
.tl .arret { color: var(--info); }
.tl .vide { color: var(--muted); font-style: italic; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; border: 1px solid currentColor; }
.s-devis { color: var(--muted); } .s-confirme { color: var(--info); } .s-acompte_recu { color: var(--ok); }
.s-realise { color: var(--ink); } .s-annule { color: var(--bad); }
details summary { cursor: pointer; color: var(--muted); font-size: 13px; margin-top: 10px; }
table.lines { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
table.lines td { padding: 5px 0; border-bottom: 1px solid var(--line); }
table.lines td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.day { font-weight: 700; margin: 20px 0 4px; font-size: 14px; }
.mission { cursor: pointer; }
.mission .t { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.mission .t b { font-size: 15px; }
.muted { color: var(--muted); font-size: 13px; }
.empty { text-align: center; color: var(--muted); padding: 32px 0; }
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); max-width: calc(100% - 32px);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 20;
}
.toast.bad { background: var(--bad); color: #fff; }
dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(560px, calc(100% - 24px)); background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog .in { padding: 16px; }
.hide { display: none !important; }
.login { max-width: 380px; margin: 12vh auto 0; padding: 0 16px; }
.login .brand { text-align: center; margin-bottom: 20px; }
.login .brand b { display: block; font-size: 20px; letter-spacing: .05em; color: var(--brand); }
nav.seg { display: flex; gap: 4px; overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
nav.seg button { flex: 1 0 auto; background: transparent; color: var(--muted); padding: 9px 12px; font-size: 14px; white-space: nowrap; }
nav.seg button.on { background: var(--bg); color: var(--ink); box-shadow: var(--shadow); }
.field { display: grid; grid-template-columns: 1fr 120px; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.field:last-child { border-bottom: 0; }
.field .lbl { font-size: 14px; }
.field .lbl small { display: block; color: var(--muted); font-size: 12px; }
.field input { padding: 8px 10px; text-align: right; }
.leg { padding: 12px 0; border-bottom: 1px solid var(--line); }
.leg:last-child { border-bottom: 0; }
.leg .t { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.leg .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 8px; }
.leg input, .leg select { padding: 8px 10px; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 14px; color: var(--ink); }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.chips { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.ok { color: var(--ok); } .ko { color: var(--bad); }
.note { font-size: 12px; color: var(--muted); margin-top: 8px; }
