/* WOEZONGAZ — couleurs de la marque */
:root {
  --blue: #0B5EA8; --blue-d: #08458A; --blue-t: #EAF3FB; --blue-l: #CFE2F6;
  --orange: #F36F21; --orange-btn: #E85A0C; --orange-d: #A3360A; --orange-t: #FFF1E8; --orange-b: #F8CBAA;
  --green: #1E7A34; --green-t: #E6F4EA; --red: #B42318; --red-t: #FDECEA;
  --ink: #14213D; --muted: #52607A; --line: #DCE4EE; --line-2: #EEF2F7; --bg: #F3F6FA; --card: #FFFFFF;
  --radius: 16px; --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.4; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); }
a:hover { color: var(--blue-d); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.4px; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }
.splash { min-height: 100vh; display: grid; place-items: center; }
.splash img { max-width: 70vw; height: auto; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

/* ---------- structure ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { background: #fff; border-right: 1px solid var(--line); padding: 22px 14px; display: flex; flex-direction: column; gap: 3px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .logo { width: 196px; height: auto; margin: 0 8px 22px; }
.side a.nav { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px; text-decoration: none; color: #2A3A57; font-weight: 500; }
.side a.nav::before { content: ''; width: 8px; height: 8px; border-radius: 4px; background: #C5D3E3; flex-shrink: 0; }
.side a.nav:hover { background: var(--blue-t); }
.side a.nav.active { background: var(--blue); color: #fff; font-weight: 700; }
.side a.nav.active::before { background: var(--orange); }
.side .who { margin-top: auto; padding: 12px; border-radius: 12px; background: var(--blue-t); font-size: 13px; }
.side .who b { color: var(--blue); display: block; }
.main { min-width: 0; padding: 26px 34px 48px; display: flex; flex-direction: column; gap: 18px; }
.topbar { display: none; }
.bottomnav { display: none; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.pagehead .sub { color: var(--muted); font-size: 14px; margin-bottom: 4px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.sync { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: 999px; background: var(--green-t); color: var(--green); }
.sync.off { background: var(--orange-t); color: var(--orange-d); }
.sync::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* ---------- cartes ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card .cardhead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card.warn { background: var(--orange-t); border-color: var(--orange-b); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.kpi .label { font-size: 14px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.kpi .label i { width: 10px; height: 10px; border-radius: 5px; background: var(--blue); display: inline-block; }
.kpi .value { font-size: 26px; font-weight: 800; margin-top: 6px; }
.kpi .hint { font-size: 13px; color: var(--muted); margin-top: 2px; }
.kpi.dark { background: var(--blue); border-color: var(--blue); color: #fff; }
.kpi.dark .label, .kpi.dark .hint { color: var(--blue-l); }
.hero { background: var(--blue); color: #fff; border-radius: 20px; padding: 26px 30px; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 22px; align-items: center; }
.hero .sub { color: var(--blue-l); }
.hero h1 { margin: 6px 0 16px; }
.hero .big { background: #fff; color: var(--ink); border-radius: 16px; padding: 18px 20px; display: flex; gap: 16px; align-items: center; }
.hero .big img { width: 40px; height: auto; }
.hero .big .v { font-size: 32px; font-weight: 900; color: var(--blue); letter-spacing: -0.5px; }
.orange { color: #C2410C; }
.green { color: var(--green); }
.red { color: var(--red); }

/* ---------- boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 12px; border: 1px solid #C9D6E5; background: #fff; color: var(--blue); font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--blue-t); color: var(--blue-d); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-d); }
.btn.cta { background: var(--orange-btn); border-color: var(--orange-btn); color: #fff; font-size: 19px; font-weight: 800; min-height: 52px; }
.btn.cta:hover { background: #C94B08; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { color: var(--red); border-color: #F1B8B2; }
.btn.white { background: #fff; color: var(--blue); border-color: #fff; }
.btn.small { min-height: 38px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.iconbtn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid #C9D6E5; background: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--blue); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid #C9D6E5; background: #fff; cursor: pointer; font-weight: 500; }
.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 700; }
.chip[disabled] { opacity: .45; cursor: not-allowed; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--blue-t); color: var(--blue); white-space: nowrap; }
.badge.o { background: var(--orange-t); color: var(--orange-d); }
.badge.g { background: var(--green-t); color: var(--green); }
.badge.r { background: var(--red-t); color: var(--red); }
.badge.grey { background: #EEF1F5; color: var(--muted); }

/* ---------- formulaires ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .lbl { font-size: 13px; font-weight: 700; color: var(--muted); }
.input, select.input, textarea.input { min-height: 48px; border-radius: 12px; border: 1px solid #C9D6E5; padding: 0 14px; background: #fff; width: 100%; }
textarea.input { padding: 10px 14px; min-height: 70px; }
.input:focus { border-color: var(--blue); outline: 2px solid var(--blue-l); }
.input.big { font-size: 18px; font-weight: 700; border: 2px solid var(--blue); }
.form { display: grid; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--blue); }
.error { background: var(--red-t); color: var(--red); border-radius: 10px; padding: 10px 14px; font-weight: 600; }

/* ---------- tableaux ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 700; color: #2A3A57; text-transform: uppercase; letter-spacing: .4px; padding: 12px 14px; background: var(--blue-t); }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: #F6FAFE; }
.table tr.cancel td { color: #98A2B3; text-decoration: line-through; }
.table .right, .table th.right { text-align: right; }
.list .item { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); align-items: center; text-decoration: none; color: inherit; }
.list .item:last-child { border-bottom: none; }
.empty { padding: 30px; text-align: center; color: var(--muted); }

/* ---------- graphiques ---------- */
.bars { display: flex; align-items: flex-end; gap: 12px; height: 210px; border-bottom: 2px solid var(--line); padding: 0 4px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; min-width: 0; }
.bars .b i { display: block; width: 100%; max-width: 56px; background: var(--blue); border-radius: 8px 8px 0 0; min-height: 2px; }
.bars .b.cur i { background: var(--orange); }
.bars .b span { font-size: 12px; font-weight: 700; white-space: nowrap; }
.bars button.b { border: none; background: none; padding: 0; cursor: pointer; font: inherit; color: inherit; }
.bars button.b:hover i, .bars button.b:focus-visible i { background: var(--blue-d); }
.bars button.b.cur:hover i { background: #C94B08; }
.seg { display: inline-flex; background: var(--blue-t); border-radius: 12px; padding: 4px; gap: 2px; }
.seg button { border: none; background: none; min-height: 38px; padding: 0 14px; border-radius: 9px; font-weight: 600; color: #2A3A57; cursor: pointer; }
.seg button.on { background: var(--blue); color: #fff; }
.cafilters .input { min-height: 42px; }
.barlabels span { white-space: nowrap; overflow: visible; }
.barlabels { display: flex; gap: 12px; padding: 6px 4px 0; }
.barlabels span { flex: 1; text-align: center; font-size: 12px; color: var(--muted); min-width: 0; }
.hbar { display: grid; grid-template-columns: 64px minmax(0, 1fr) 46px; gap: 10px; align-items: center; font-size: 14px; margin-bottom: 12px; }
.hbar .track { height: 14px; background: var(--orange-t); border-radius: 7px; overflow: hidden; }
.hbar .track i { display: block; height: 100%; background: var(--orange); border-radius: 7px; }
.split { display: flex; height: 16px; border-radius: 8px; overflow: hidden; gap: 2px; background: var(--line-2); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; }
.alert { display: flex; gap: 10px; padding: 10px 0; text-decoration: none; color: inherit; }
.alert svg { flex-shrink: 0; margin-top: 1px; }

/* ---------- vente ---------- */
.sale { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.prod { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.prod:last-child { border-bottom: none; }
.prod .tag { width: 46px; height: 46px; border-radius: 12px; background: var(--orange-t); color: #C2410C; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; flex-shrink: 0; }
.prod .info { flex: 1; min-width: 0; }
.prod .info b { font-size: 16px; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { width: 44px; height: 44px; border-radius: 12px; border: 1px solid #C9D6E5; background: #fff; color: var(--blue); font-size: 22px; font-weight: 700; cursor: pointer; }
.stepper button.plus { background: var(--blue); border-color: var(--blue); color: #fff; }
.stepper input { width: 52px; height: 44px; text-align: center; border: 1px solid transparent; border-radius: 10px; font-weight: 800; font-size: 17px; background: transparent; }
.stepper input:focus { border-color: var(--blue); background: #fff; }
.prod .amt { width: 92px; text-align: right; font-weight: 700; }
.toggle { font-size: 12px; font-weight: 700; border: 1px solid #C9D6E5; background: #fff; border-radius: 999px; padding: 4px 10px; cursor: pointer; color: var(--muted); min-height: 30px; }
.toggle.on { background: var(--orange-t); border-color: var(--orange-b); color: var(--orange-d); }
.combo { position: relative; }
.combo .menu { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(20,33,61,.15); max-height: 320px; overflow-y: auto; }
.combo .menu button { display: flex; justify-content: space-between; width: 100%; text-align: left; padding: 12px 14px; border: none; background: none; cursor: pointer; border-bottom: 1px solid var(--line-2); min-height: 46px; gap: 8px; }
.combo .menu button:hover, .combo .menu button.hl { background: var(--blue-t); }
.total { display: flex; justify-content: space-between; align-items: baseline; }
.total .v { font-size: 32px; font-weight: 900; color: var(--blue); }
.sticky { position: sticky; top: 20px; }

/* ---------- facture ---------- */
.invoice { background: #fff; max-width: 760px; width: 100%; margin: 0 auto; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; }
.invoice .stripe { height: 8px; display: flex; }
.invoice .stripe i:first-child { flex: 3; background: var(--orange); }
.invoice .stripe i:last-child { flex: 2; background: var(--blue); }
.invoice .pad { padding: 26px 34px; }
.invoice .head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.invoice .head img { width: 220px; height: auto; }
.invoice .co { text-align: right; font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.invoice .title { font-size: 30px; font-weight: 900; color: var(--blue); letter-spacing: .5px; }
.invoice .client { background: var(--blue-t); border-radius: 10px; padding: 10px 14px; min-width: 200px; }
.invoice table { width: 100%; border-collapse: collapse; font-size: 14px; }
.invoice th { background: var(--blue); color: #fff; text-align: left; padding: 9px 12px; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.invoice td { padding: 11px 12px; border-bottom: 1px solid var(--line); }
.invoice .tot { background: var(--orange-t); border-radius: 10px; padding: 12px 16px; text-align: right; min-width: 220px; }
.invoice .tot b { font-size: 26px; font-weight: 900; color: var(--orange-d); display: block; }
.invoice .sigs { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 46px; }
.invoice .sigs div { border-top: 1px solid #9DB3CB; padding-top: 8px; font-size: 12px; color: var(--muted); }
.invoice .foot { background: var(--blue); color: #fff; padding: 12px 34px; display: flex; justify-content: space-between; font-size: 12px; }
.stamp { display: inline-block; border: 3px solid var(--red); color: var(--red); font-weight: 900; padding: 4px 12px; border-radius: 8px; transform: rotate(-6deg); letter-spacing: 1px; }

/* ---------- connexion ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(var(--bg), var(--bg)) , var(--bg); }
.login .box { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 30px 26px; display: grid; gap: 16px; }
.login .box img { width: 240px; max-width: 100%; height: auto; margin: 0 auto 6px; display: block; }
.login .band { height: 6px; border-radius: 3px; display: flex; overflow: hidden; }
.login .band i:first-child { flex: 3; background: var(--orange); }
.login .band i:last-child { flex: 2; background: var(--blue); }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(30px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; opacity: 0; pointer-events: none; transition: .25s; z-index: 100; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--red); }
dialog { border: none; border-radius: 18px; padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(20,33,61,.3); }
dialog::backdrop { background: rgba(20,33,61,.45); }
dialog .dlg { padding: 22px; display: grid; gap: 14px; }

/* ---------- téléphone ---------- */
@media (max-width: 900px) {
  body { font-size: 15px; }
  .shell { display: block; }
  .side { display: none; }
  .topbar { display: flex; align-items: center; gap: 10px; background: var(--blue); color: #fff; padding: 12px 14px; position: sticky; top: 0; z-index: 10; padding-top: max(12px, env(safe-area-inset-top)); }
  .topbar .t { flex: 1; min-width: 0; }
  .topbar .t b { font-size: 19px; font-weight: 800; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .t span { font-size: 12px; color: var(--blue-l); }
  .topbar .flame { width: 40px; height: 40px; border-radius: 11px; background: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
  .topbar .flame img { height: 28px; width: auto; }
  .topbar a.back { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; color: #fff; border-radius: 11px; background: rgba(255,255,255,.12); }
  .topbar .sync { background: rgba(255,255,255,.15); color: #fff; }
  .topbar .sync.off { background: var(--orange-btn); }
  .main { padding: 14px 14px 100px; gap: 14px; }
  .pagehead h1, .pagehead .sub, .pagehead .sync { display: none; }
  .pagehead.noact { display: none; }
  .topbar .t span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .prod { flex-wrap: wrap; gap: 8px 10px; }
  .prod .tag { display: none; }
  .prod .info { flex: 1 1 140px; }
  .prod .info b { white-space: nowrap; }
  .prod .info .small { white-space: nowrap; }
  .prod .amt { flex-basis: 100%; width: auto; margin-top: -4px; }
  .prod .amt:empty { display: none; }
  .bottomnav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 4px 4px max(8px, env(safe-area-inset-bottom)); z-index: 10; }
  .bottomnav a { min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 600; }
  .bottomnav a svg { width: 22px; height: 22px; }
  .bottomnav a.active { color: var(--blue); font-weight: 800; }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .g4.keep2, .g2.keep2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span2 { grid-column: auto; }
  .hero { grid-template-columns: minmax(0, 1fr); padding: 20px; }
  .hero h1 { display: block; font-size: 24px; }
  .sale { grid-template-columns: minmax(0, 1fr); }
  .sticky { position: static; }
  .salefoot { position: fixed; left: 0; right: 0; bottom: 64px; background: #fff; border-top: 1px solid var(--line); padding: 12px 14px; z-index: 9; box-shadow: 0 -6px 20px rgba(20,33,61,.08); }
  .salefoot .total .v { font-size: 26px; }
  .card { padding: 16px; }
  .kpi .value { font-size: 22px; }
  .table.resp thead { display: none; }
  .table.resp tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
  .table.resp td { padding: 0; border: none; }
  .table.resp td.hm { display: none; }
  .invoice .pad { padding: 20px 18px; }
  .invoice .head { flex-direction: column; }
  .invoice .co { text-align: left; }
  .invoice .foot { padding: 12px 18px; }
  .prod .amt { width: 74px; font-size: 14px; }
  .stepper button { width: 40px; height: 40px; }
  .stepper input { width: 40px; }
  #toast { bottom: 140px; }
}

/* ---------- impression ---------- */
@media print {
  body { background: #fff; }
  .side, .topbar, .bottomnav, .noprint, .pagehead, #toast { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .invoice { border: none; max-width: none; }
  .invoice .stripe, .invoice th, .invoice .foot, .invoice .client, .invoice .tot { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { size: A4; margin: 12mm; }
}
