:root {
  --ink: #1b2430; --muted: #64748b; --line: #e2e8f0; --bg: #f5f7fa; --card: #fff;
  --brand: #14213d; --accent: #1f6feb; --ok: #15803d; --danger: #b42318; --warn: #b45309;
  --r: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 22px; margin: 6px 0 12px; line-height: 1.2; }
h2 { font-size: 17px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 16px 0 6px; }
main { max-width: 1040px; margin: 0 auto; padding: 14px 16px 40px; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--brand); color: #fff; }
.top .brand { color: #fff; font-weight: 700; letter-spacing: .2px; font-size: 17px; }
.top nav { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.top nav a { color: #cbd5e1; padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
.top nav a.on, .top nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.top .out .link { color: #cbd5e1; }
.asbar { background: #fff7e6; border-bottom: 1px solid #fde3b0; padding: 8px 16px; font-size: 14px; }
.asbar select { margin-left: 6px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 20px 16px 30px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin: 0 0 14px; }
.card.narrow { max-width: 440px; margin: 40px auto; }
.muted { color: var(--muted); }
.small, small { font-size: 13px; }
.danger { color: var(--danger) !important; }
.flash { padding: 10px 12px; border-radius: 10px; background: #e8f5ec; color: #14532d; margin: 0 0 12px; }
.flash.err { background: #fdecea; color: var(--danger); }
.dev { background: #fff7e6; padding: 8px; border-radius: 8px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 10px; }
label.inline { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; font: inherit; color: var(--ink); background: #fff; border: 1px solid #cbd5e1; border-radius: 10px; }
input[type=checkbox] { width: auto; margin: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bfd6ff; border-color: var(--accent); }
.btn { display: inline-block; border: 0; border-radius: 10px; padding: 11px 18px; font: inherit; font-weight: 600; background: var(--accent); color: #fff; cursor: pointer; text-align: center; }
.btn.sec { background: #eef2f7; color: var(--ink); }
.btn.ok { background: var(--ok); }
.btn.wide { width: 100%; padding: 14px; font-size: 16px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.search { display: flex; gap: 8px; margin: 0 0 10px; }
.search input, .search select { margin: 0; }
.search select { width: auto; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; scrollbar-width: none; }
.chips a { white-space: nowrap; padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--ink); font-size: 14px; }
.chips a.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.prod { background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; color: var(--ink); display: flex; flex-direction: column; }
.prod .ph { aspect-ratio: 1; background: #eef2f7; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; text-align: center; }
.prod .ph img { width: 100%; height: 100%; object-fit: cover; }
.prod .pi { padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.prod .pi b { font-size: 14px; line-height: 1.25; }
.prod .price { font-weight: 700; margin-top: 4px; }
.draftbar { display: block; background: var(--brand); color: #fff; padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; font-weight: 600; }
.crumb { margin: 0 0 6px; font-size: 14px; }
.product { display: grid; gap: 16px; }
.pimg img { width: 100%; border-radius: var(--r); background: #fff; border: 1px solid var(--line); }
.calc { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.prices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 8px; }
.prices > div { background: #f1f5fb; border-radius: 10px; padding: 10px; display: flex; flex-direction: column; }
.prices b { font-size: 20px; }
.prices small { color: var(--muted); }
.na { color: var(--warn); }
.desc, .special { margin-top: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.desc summary, .special summary, .newclient summary { cursor: pointer; font-weight: 600; }
.desc p { color: #334155; font-size: 14px; }
.special form { margin-top: 10px; }
.list { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--ink); }
.row small { display: block; }
.amt { text-align: right; font-weight: 700; white-space: nowrap; }
.amt small { display: block; font-weight: 400; }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #eef2f7; color: var(--ink); vertical-align: middle; font-weight: 600; }
.s-brouillon { background: #eef2f7; } .s-envoye { background: #e0ecff; color: #1d4ed8; } .s-accepte { background: #dcfce7; color: var(--ok); } .s-refuse { background: #fde8e8; color: var(--danger); }
.line { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line .ld { display: flex; flex-direction: column; }
.line .lp { min-width: 130px; text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.line .lp label { margin: 0; }
.line .lp input { text-align: right; width: 130px; }
.totals { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; padding: 10px 0; }
.actions form { margin: 8px 0; }
.actions .row2 { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions .row2 form { margin: 0; }
.newclient { margin-top: 10px; }
.newclient form { margin-top: 10px; }
.cols fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 0 0 12px; }
.cols legend { font-weight: 600; padding: 0 6px; }
img.logo { max-height: 50px; vertical-align: middle; border: 1px solid var(--line); border-radius: 6px; padding: 4px; background: #fff; }
.inline-form { display: flex; gap: 8px; margin-top: 10px; }
.inline-form input { margin: 0; }
.inviteform { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.fams { columns: 2; padding-left: 18px; }
@media (min-width: 760px) {
  h1 { font-size: 26px; }
  .product { grid-template-columns: 360px 1fr; align-items: start; }
  .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
  .cols > button { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 420px) {
  .two { grid-template-columns: 1fr; }
  .line { flex-direction: column; }
  .line .lp { align-items: stretch; text-align: left; }
  .line .lp input { width: 100%; }
}
