/* ═══════════ Kaddu — Design professionnel ═══════════ */
:root {
  --brand: #0d5c46;      /* vert profond — identité */
  --brand-2: #10735597;
  --brand-solid: #0e7a5c;
  --brand-tint: #e3f0eb;
  --accent: #f0b429;     /* doré — signature */
  --ink: #16232e;
  --muted: #64757f;
  --bg: #f4f6f7;
  --card: #ffffff;
  --line: #e4e9eb;
  --ok: #148f66;
  --cyan: #0e7490;
  --warn: #b45309;
  --danger: #d64545;
  --r: 14px;
  --shadow: 0 1px 3px rgba(22, 35, 46, .07);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { font-size: 16px; scroll-behavior: smooth; }
html, body { overflow-x: hidden; overflow-x: clip; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg); color: var(--ink);
  padding-bottom: 92px; -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
.desktop-only { display: none; }
.muted { color: var(--muted); }

/* ── Logo : pastille squircle + point doré ── */
.logo-badge {
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: 40px; height: 40px; border-radius: 13px;
  background: var(--brand); color: #fff;
  font-weight: 800; font-size: 1.25rem; letter-spacing: -.03em;
  box-shadow: 0 2px 6px rgba(13, 92, 70, .3);
}
.logo-badge::after {
  content: ""; position: absolute; top: 4px; right: 4px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); border: 1.5px solid rgba(255,255,255,.85);
}
.logo-badge.sm { width: 30px; height: 30px; border-radius: 9px; font-size: .95rem; }
.logo-badge.sm::after { width: 6px; height: 6px; top: 3px; right: 3px; }
.logo-badge.xl { width: 72px; height: 72px; border-radius: 21px; font-size: 2.2rem; }
.logo-badge.xl::after { width: 13px; height: 13px; top: 7px; right: 7px; }

/* ── Splash / loader ── */
#splash {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-content: center; gap: 16px; text-align: center;
  background: var(--brand); color: #fff;
  transition: opacity .4s ease, visibility .4s;
}
#splash.hide { opacity: 0; visibility: hidden; }
.splash-name { font-size: 1.6rem; font-weight: 800; letter-spacing: .02em; }
.loader-line { width: 150px; height: 3px; margin: 0 auto; border-radius: 99px; background: rgba(255,255,255,.22); overflow: hidden; }
.loader-line::after { content: ""; display: block; width: 40%; height: 100%; border-radius: inherit; background: var(--accent); animation: load .9s ease-in-out infinite; }
@keyframes load { 0% { transform: translateX(-110%); } 100% { transform: translateX(270%); } }

/* ── Drawer ── */
#drawer-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(10, 20, 26, .45); }
#drawer {
  position: fixed; z-index: 61; top: 0; bottom: 0; left: 0;
  width: min(84vw, 310px); display: flex; flex-direction: column;
  background: #fff; box-shadow: 24px 0 60px rgba(10,20,26,.25);
  animation: slideIn .25s ease;
}
@keyframes slideIn { from { transform: translateX(-102%); } to { transform: none; } }
.drawer-head {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 18px; border-bottom: 1px solid var(--line);
}
.drawer-head strong { display: block; font-size: 1.15rem; }
.drawer-head small { color: var(--muted); font-size: .76rem; }
.drawer-x { margin-left: auto; width: 34px; height: 34px; border: 0; border-radius: 10px; background: var(--bg); color: var(--muted); font-size: 1.3rem; line-height: 1; }
.drawer-nav { padding: 12px; flex: 1; }
.drawer-link {
  width: 100%; display: flex; align-items: center; gap: 13px;
  border: 0; background: none; padding: 13px 14px; margin-bottom: 2px;
  border-radius: 11px; color: var(--ink); font-weight: 600; font-size: .95rem; text-align: left;
}
.drawer-link .ic { width: 19px; height: 19px; color: var(--muted); }
.drawer-link:hover { background: var(--bg); }
.drawer-link.active { background: var(--brand-tint); color: var(--brand); font-weight: 700; }
.drawer-link.active .ic { color: var(--brand); }
.drawer-link.danger { color: var(--danger); margin: 12px; border-top: 1px solid var(--line); border-radius: 0; padding-top: 16px; }
.drawer-link.danger .ic { color: var(--danger); }

/* ── Header ── */
#appbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  background: var(--brand); color: #fff;
  padding: 11px 14px;
  box-shadow: 0 2px 10px rgba(13, 92, 70, .28);
}
.brand { display: flex; align-items: center; gap: 9px; font-size: 1.2rem; font-weight: 800; letter-spacing: -.02em; flex: 1; }
.menu-btn {
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
  width: 40px; height: 40px; border: 0; border-radius: 11px;
  background: rgba(255,255,255,.12); padding: 0 11px; cursor: pointer;
}
.menu-btn span { display: block; height: 2px; border-radius: 2px; background: #fff; }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 11px; background: rgba(255,255,255,.12); color: #fff; }
.icon-btn .ic { width: 18px; height: 18px; }
.install-pill {
  border: 1px solid rgba(255,255,255,.45); border-radius: 999px;
  background: rgba(255,255,255,.16); color: #fff; font-weight: 800;
  padding: 9px 13px; box-shadow: inset 0 1px rgba(255,255,255,.2);
}
.install-link { color: var(--brand); background: #eaf6f1; }
.sync-pill {
  display: flex; align-items: center; gap: 7px;
  background: rgba(0,0,0,.18); border: 0; border-radius: 999px;
  color: #fff; font-size: .72rem; font-weight: 700; padding: 8px 11px;
}
.sync-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #7be0ae; }
.sync-pill.wait .dot { background: var(--accent); }
.sync-pill.off .dot { background: #ff8f8a; }

/* ── Vues ── */
.view { padding: 18px 16px; max-width: 1080px; margin: 0 auto; animation: viewIn .3s ease both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.view h2 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; margin-bottom: 14px; }
.view h3 {
  display: flex; align-items: center; gap: 8px;
  font-size: .72rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); margin: 26px 0 10px;
}
.view h3 .ic { width: 15px; height: 15px; }
label { display: block; font-size: .78rem; font-weight: 700; color: var(--muted); margin: 14px 0 6px; }
input, select {
  width: 100%; padding: 14px 15px; font-size: 1rem; color: var(--ink);
  background: #fff; border: 1.5px solid var(--line); border-radius: 12px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14,122,92,.14); }

/* ── Boutons ── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 15px 18px; margin-top: 14px;
  border: 0; border-radius: 12px; font-size: 1rem; font-weight: 700; cursor: pointer;
  transition: transform .1s, filter .15s;
}
.btn:active { transform: scale(.985); }
.btn .ic { width: 18px; height: 18px; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(13,92,70,.28); }
.btn-primary:hover { filter: brightness(1.07); }
.btn-big { padding: 17px; font-size: 1.1rem; }
.btn-ghost { background: #fff; color: var(--ink); border: 1.5px solid var(--line); }
.btn-ghost .ic { color: var(--muted); }
.btn-danger { background: #fdf0ef; color: var(--danger); border: 1px solid #f3c9c6; }
.mini-btn {
  display: grid; place-items: center; min-width: 42px; height: 42px;
  border: 0; border-radius: 11px; background: var(--brand); color: #fff;
  font-weight: 700; font-size: .85rem; padding: 0 12px;
}
.mini-btn .ic { width: 17px; height: 17px; }
.mini-btn.danger { background: var(--danger); color: #fff; border: 1px solid #c93a3a; }
.wa-btn { background: #e8f9f0; color: #128c5e; border: 1px solid #a9e5c8; }
.sms-btn { background: #eef2ff; color: #4a5fd0; border: 1px solid #c3cdf5; }
.mini-btn + .mini-btn, .wa-btn + .mini-btn, .wa-btn + .sms-btn { margin-left: 6px; }

/* ── Login ── */
body:has(> #view-login:not([hidden])) { padding-bottom: 0; }
@supports not (selector(body:has(> section))) {
  #view-login { height: calc(100vh - 92px); height: calc(100dvh - 92px); }
}
#view-login {
  display: flex; flex-direction: column; max-width: none;
  height: 100vh; height: 100dvh; overflow: hidden; padding: 0;
  background: linear-gradient(155deg, #0f6b52 0%, var(--brand) 55%, #0a4a38 100%);
}
.login-hero {
  flex: 1; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 20px 16px 16px; color: #fff; text-align: center;
  animation: viewIn .4s ease both;
}
@media (max-height: 560px) {
  .login-feats { display: none; }
  .login-hero .logo-badge.xl { width: 52px; height: 52px; border-radius: 15px; font-size: 1.6rem; }
  .login-brand { margin-top: 8px; }
}
.login-hero .logo-badge.xl { box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.login-brand { font-size: 2.1rem; font-weight: 800; letter-spacing: -.03em; margin-top: 14px; }
.login-tag { opacity: .82; font-size: .95rem; margin-top: 4px; }
/* Pastilles : slide auto, un item à la fois */
.login-feats { list-style: none; position: relative; height: 36px; margin-top: 18px; width: 100%; }
.login-feats li {
  position: absolute; left: 50%; top: 0;
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.16);
  border-radius: 99px; padding: 8px 16px;
  font-size: .78rem; font-weight: 700;
  opacity: 0; transform: translateX(-50%) translateY(10px);
  transition: opacity .45s ease, transform .45s ease;
}
.login-feats li.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.login-feats li.off-top { opacity: 0; transform: translateX(-50%) translateY(-12px); }
.login-feats .ic { width: 15px; height: 15px; color: var(--accent); flex: none; }
.login-card {
  width: 100%; max-width: 480px; margin: 0 auto; text-align: left;
  background: #fff; border-radius: 26px 26px 0 0; padding: 30px 24px 28px;
  box-shadow: 0 -10px 40px rgba(0,0,0,.22);
  animation: modalUp .4s cubic-bezier(.2,.9,.3,1) both;
}
@media (min-width: 768px) {
  /* Desktop / tablette : panneau marque à gauche, formulaire à droite, scroll libre */
  #view-login {
    flex-direction: row; height: auto; min-height: 100vh;
    overflow: visible; background: var(--bg);
  }
  .login-hero {
    flex: 1.15; min-height: 100vh; overflow: visible;
    background: linear-gradient(160deg, #0f6b52 0%, var(--brand) 60%, #0a4a38 100%);
    padding: 40px;
  }
  .login-feats { height: 40px; margin-top: 30px; }
  .login-card {
    flex: 1; max-width: none; margin: 0; min-height: 100vh;
    display: flex; flex-direction: column; justify-content: center;
    border-radius: 0; box-shadow: none; padding: 48px 56px;
    animation: none;
  }
  .login-card > * { max-width: 400px; width: 100%; margin-left: auto; margin-right: auto; }
  .login-card h1 { font-size: 1.65rem; }
}
.login-card h1 { font-size: 1.4rem; font-weight: 800; letter-spacing: -.02em; }
.login-card .muted { margin: 5px 0 20px; font-size: .9rem; }
.field-label { margin-top: 0; }
.field { position: relative; margin-bottom: 14px; }
.field .ic { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: #9aa8b0; }
.field input { padding-left: 46px; background: #f8f9fa; }
.err { color: var(--danger); font-weight: 700; font-size: .9rem; margin-top: 10px; min-height: 1.2em; }
.foot { display: flex; align-items: center; justify-content: center; gap: 7px; color: #9aa8b0; font-size: .76rem; font-weight: 600; margin-top: 20px; }
.foot .ic { width: 14px; height: 14px; }

/* ── Hero dashboard ── */
.hero-panel {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--brand); color: #fff;
  border-radius: var(--r); padding: 18px 20px; margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.hero-panel h2 { margin: 3px 0 3px; color: #fff; font-size: 1.25rem; }
.hero-panel p { color: rgba(255,255,255,.75); font-size: .82rem; font-weight: 600; }
.eyebrow { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .13em; color: var(--accent); }
.hero-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: rgba(255,255,255,.12); flex: none; }
.hero-icon .ic { width: 25px; height: 25px; }

/* ── Cards stats ── */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card, .chart-card, .fold { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.stat-card { padding: 15px; animation: rise .4s ease both; }
.rise-1 { animation-delay: .04s; } .rise-2 { animation-delay: .1s; } .rise-3 { animation-delay: .16s; } .rise-4 { animation-delay: .22s; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.card-label { font-size: .75rem; font-weight: 700; color: var(--muted); padding-top: 8px; }
.card-value { font-size: 1.45rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.card-value.green { color: var(--ok); }
.card-value.cyan { color: var(--cyan); }
.card-value.orange { color: var(--warn); }
.card-value.red { color: var(--danger); }
.card-sub { font-size: .76rem; color: var(--muted); margin-top: 4px; font-weight: 600; }
.chip { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; flex: none; }
.chip .ic { width: 19px; height: 19px; }
.chip.green { background: var(--brand-tint); color: var(--brand); }
.chip.cyan { background: #e0f2f6; color: var(--cyan); }
.chip.amber { background: #fdf2df; color: var(--warn); }
.chip.red { background: #fdeaea; color: var(--danger); }
.chip.big { width: 48px; height: 48px; } .chip.big .ic { width: 23px; height: 23px; }
.chip.xl { width: 62px; height: 62px; margin: 0 auto 12px; border-radius: 18px; } .chip.xl .ic { width: 30px; height: 30px; }

/* ── Rapports ── */
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.chart-card { padding: 16px; min-height: 185px; }
.chart-title { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin-bottom: 12px; }
.pie-chart {
  --cash: 70; --credit: 30;
  width: 124px; height: 124px; margin: 2px auto 10px; border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--ok) 0 calc(var(--cash)*1%), var(--accent) 0 calc((var(--cash) + var(--credit))*1%), var(--danger) 0);
  animation: fadeIn .5s ease both;
}
.pie-chart span { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: #fff; font-weight: 800; color: var(--ink); font-size: .85rem; text-align: center; }
.legend { display: flex; justify-content: center; gap: 12px; font-size: .72rem; color: var(--muted); font-weight: 700; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.bar-chart { display: flex; align-items: flex-end; gap: 9px; height: 130px; padding-top: 16px; }
.bar { flex: 1; min-width: 20px; border-radius: 8px 8px 4px 4px; background: var(--brand-solid); height: calc(var(--h)*1%); position: relative; animation: growBar .6s ease both; }
.bar span { position: absolute; left: 50%; bottom: -20px; transform: translateX(-50%); font-size: .62rem; color: var(--muted); font-weight: 700; }
.bar::before { content: attr(data-v); position: absolute; left: 50%; top: -20px; transform: translateX(-50%); font-size: .64rem; font-weight: 800; color: var(--ink); }
@keyframes growBar { from { height: 0; } }
@keyframes fadeIn { from { opacity: 0; } }
.insight-slider { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; margin-top: 14px; padding-bottom: 4px; scrollbar-width: none; }
.insight-slider::-webkit-scrollbar { display: none; }
.insight {
  min-width: 78%; scroll-snap-align: start; padding: 15px 17px;
  border-radius: var(--r); border-left: 4px solid var(--accent);
  background: #fff; box-shadow: var(--shadow);
  font-weight: 700; font-size: .92rem; color: var(--ink);
}
.insight:nth-child(2) { border-left-color: var(--brand-solid); }
.insight:nth-child(3) { border-left-color: var(--danger); }

/* ── Combobox : recherche dynamique ── */
.combo { position: relative; }
.combo-input { padding-left: 15px; }
.combo-list {
  position: absolute; z-index: 45; top: calc(100% + 6px); left: 0; right: 0;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 16px 44px rgba(10, 20, 26, .16);
  max-height: 264px; overflow-y: auto; padding: 6px;
  animation: comboIn .15s ease;
}
@keyframes comboIn { from { opacity: 0; transform: translateY(-6px); } }
.combo-item {
  width: 100%; display: flex; align-items: center; gap: 11px;
  border: 0; background: none; padding: 10px 11px; border-radius: 10px;
  text-align: left; font-weight: 650; color: var(--ink);
}
.combo-item:active, .combo-item:hover { background: var(--brand-tint); }
.combo-item small { display: block; color: var(--muted); font-size: .75rem; font-weight: 500; margin-top: 1px; }
.combo-item .montant { font-weight: 800; font-size: .88rem; white-space: nowrap; }
.combo-empty { padding: 16px; text-align: center; color: var(--muted); font-size: .85rem; font-weight: 600; }
.ci-av {
  display: grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 11px;
  background: var(--brand-tint); color: var(--brand); font-weight: 800; font-size: .95rem;
}

/* ── Chips (choix courts) ── */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip-btn {
  flex: none; border: 1.5px solid var(--line); background: #fff;
  border-radius: 12px; padding: 10px 15px; font-weight: 700; font-size: .9rem;
  color: var(--ink); text-align: center; cursor: pointer; transition: .15s;
}
.chip-btn small { display: block; font-size: .68rem; color: var(--muted); font-weight: 600; margin-top: 2px; }
.chip-btn.active { border-color: var(--brand); background: var(--brand-tint); color: var(--brand); }
.chip-btn.active small { color: var(--brand); opacity: .8; }

/* ── Stepper quantité ── */
.stepper { display: flex; gap: 8px; align-items: stretch; }
.stepper button {
  width: 50px; flex: none; border: 0; border-radius: 12px;
  background: var(--brand-tint); color: var(--brand);
  font-size: 1.45rem; font-weight: 800; line-height: 1;
}
.stepper button:active { transform: scale(.94); }
.stepper input { flex: 1; text-align: center; font-weight: 800; font-size: 1.1rem; }

/* ── Sections de formulaire ── */
.form-sec {
  display: flex; align-items: center; gap: 6px;
  font-size: .7rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--brand); margin: 18px 0 10px;
  padding-bottom: 7px; border-bottom: 1.5px solid var(--line);
}
.form-sec:first-of-type { margin-top: 4px; }

/* ── Forms / listes ── */
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.seg { display: flex; gap: 4px; background: #eceff1; border-radius: 12px; padding: 4px; }
.seg-btn { flex: 1; padding: 11px 4px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 700; font-size: .9rem; transition: .15s; }
.seg-btn.active { background: #fff; color: var(--brand); box-shadow: 0 1px 4px rgba(22,35,46,.14); }

/* ── Encaissement multi-modes ── */
.pay-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pay-cell { border: 1.5px solid var(--line); border-radius: 13px; padding: 9px 10px 10px; border-top: 3px solid var(--line); }
.pay-cell.cash { border-top-color: var(--brand-solid); }
.pay-cell.om { border-top-color: #f16e00; }
.pay-cell.mtn { border-top-color: #e8b500; }
.pay-cell label { display: flex; align-items: center; gap: 5px; font-size: .64rem; margin: 0 0 6px; letter-spacing: .02em; }
.pay-cell label .ic { width: 13px; height: 13px; }
.pay-cell input { padding: 9px 8px; border-radius: 9px; font-size: .95rem; font-weight: 700; }
.pay-recap { display: flex; gap: 18px; margin-top: 12px; font-size: .86rem; color: var(--muted); font-weight: 600; }
.pay-recap strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.pay-recap strong.neg { color: var(--danger); }
.montant.pos { color: var(--ok); }
.montant.neg { color: var(--danger); }
.ghost-btn { background: var(--bg); color: var(--muted); font-size: .72rem; }
/* ── Onglets dettes avec totaux ── */
.dette-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.dette-tab {
  border: 1.5px solid var(--line); background: #fff; border-radius: var(--r);
  padding: 12px 14px; text-align: left; cursor: pointer; transition: .15s;
}
.dette-tab span {
  display: flex; align-items: center; gap: 6px; font-size: .72rem;
  font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em;
}
.dette-tab .ic { width: 15px; height: 15px; }
.dette-tab strong { display: block; font-size: 1.1rem; font-weight: 800; margin-top: 5px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.dette-tab.in strong { color: var(--ok); }
.dette-tab.out strong { color: var(--danger); }
.dette-tab.active { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14,122,92,.12); }
.dette-tab.in.active span { color: var(--ok); }
.dette-tab.out.active span { color: var(--danger); }

.pm-stock {
  display: flex; justify-content: space-between; align-items: baseline;
  background: var(--brand-tint); border-radius: 12px;
  padding: 13px 15px; margin-bottom: 14px;
  font-weight: 700; color: var(--brand);
}
.pm-stock strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.prod-link { cursor: pointer; }

/* ─── Rapports : encaissements par mode + ticket ── */
.mode-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.mode-row .grow { font-weight: 700; font-size: .88rem; min-width: 110px; }
.mode-bar { flex: 1; height: 10px; border-radius: 6px; background: #edf1ef; overflow: hidden; }
.mode-bar div { height: 100%; border-radius: 6px; background: var(--brand-solid); animation: growBar .6s ease both; }
.mode-row .montant { text-align: right; }
.mode-row .montant small { display: block; color: var(--muted); }

.ticket { font-family: "Courier New", ui-monospace, monospace; color: var(--ink); }
.t-shop { text-align: center; font-weight: 900; font-size: 1.15rem; letter-spacing: .5px; }
.t-sub { text-align: center; font-size: .8rem; color: var(--muted); margin-top: 2px; }
.t-sep { text-align: center; color: #c9d4cf; margin: 10px 0; letter-spacing: -1px; white-space: nowrap; overflow: hidden; }
.t-line { display: flex; justify-content: space-between; gap: 10px; font-size: .85rem; padding: 3px 0; }
.t-line small { display: block; color: var(--muted); font-size: .72rem; }
.t-line .grow { flex: 1; }
.t-total { display: flex; justify-content: space-between; font-weight: 900; font-size: 1.15rem; padding: 4px 0; }
.t-reste { color: var(--danger); font-weight: 800; }
.t-thanks { text-align: center; font-weight: 800; margin-top: 4px; }

/* Rapports : espacement + animations */
#view-rapports .chart-card { margin-bottom: 14px; }
#view-rapports .cards { margin-bottom: 14px; }
#view-rapports .stat-card, #view-rapports .chart-card { animation: riseIn .45s cubic-bezier(.2,.7,.3,1) both; }
#view-rapports .stat-card:nth-child(2) { animation-delay: .07s; }
#view-rapports .stat-card:nth-child(3) { animation-delay: .14s; }
#view-rapports .chart-card:nth-of-type(2) { animation-delay: .1s; }
#view-rapports .chart-card:nth-of-type(3) { animation-delay: .18s; }
#view-rapports h3 { margin: 18px 2px 10px; }
@keyframes riseIn { from { opacity: 0; transform: translateY(16px); } }
.mode-bar div { animation: growW .7s cubic-bezier(.2,.7,.3,1) both; }
@keyframes growW { from { width: 0 !important; } }
#rep-ventes li { animation: riseIn .35s ease both; }
#rep-ventes li:nth-child(2) { animation-delay: .04s; }
#rep-ventes li:nth-child(3) { animation-delay: .08s; }
#rep-ventes li:nth-child(4) { animation-delay: .12s; }
#rep-ventes li:nth-child(5) { animation-delay: .16s; }
#rep-ventes li:nth-child(n+6) { animation-delay: .2s; }
#rep-insights { margin-bottom: 16px; }
#rep-insights .insight { min-width: 82%; }

.rep-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.rep-head h3 { margin: 0; }
.btn-sm { width: auto; padding: 9px 16px; font-size: .8rem; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 2px 4px; }
.pager .btn-sm:disabled { opacity: .4; }

/* Impression : seule la zone facture s'imprime */
#print-area { display: none; }
@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; padding: 14px; color: #000; }
  @page { margin: 10mm; }
}
}

.tag-type {
  display: inline-block; background: var(--bg); border-radius: 6px;
  padding: 1px 7px; font-size: .66rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
}
.total-line { display: flex; justify-content: space-between; align-items: baseline; margin-top: 20px; color: var(--muted); font-weight: 700; }
.total-line strong { color: var(--brand); font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.list { list-style: none; }
.list li {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 15px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 11px; box-shadow: var(--shadow);
}
.list .grow { flex: 1; min-width: 0; font-weight: 700; font-size: .93rem; }
.list small, .list .grow small { display: block; color: var(--muted); font-size: .75rem; font-weight: 600; margin-top: 2px; }
.list .montant { font-weight: 800; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.list .low { color: var(--danger); }
.list .unsynced { color: var(--warn); font-weight: 700; }

/* ── Blocs pliables ── */
.fold { margin-bottom: 16px; padding: 0 16px 2px; }
.fold summary {
  display: flex; align-items: center; gap: 10px; list-style: none; cursor: pointer;
  margin: 0 -16px; padding: 15px 16px; border-radius: var(--r);
  font-weight: 700; color: var(--brand);
}
.fold[open] summary { border-radius: var(--r) var(--r) 0 0; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary .ic { width: 17px; height: 17px; }
.fold .tag { margin-left: auto; background: var(--brand-tint); color: var(--brand); font-size: .64rem; font-weight: 800; padding: 4px 9px; border-radius: 99px; text-transform: uppercase; letter-spacing: .05em; }
.fold input, .fold select { width: 100%; }
.fold .btn:last-child { margin-bottom: 16px; }
.banner { background: #fdf6e4; border: 1px solid #eed9a4; color: var(--warn); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-weight: 700; font-size: .9rem; }
.profil { display: flex; align-items: center; gap: 13px; padding: 15px; margin-bottom: 4px; }
.profil .grow { flex: 1; }

/* ── Bloqué ── */
#view-bloque { display: flex; min-height: 80vh; align-items: center; }
.bloque-card { width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 32px 22px; text-align: center; box-shadow: var(--shadow); }
.pay-box { background: #fdf0ef; border: 1.5px dashed #efaba7; border-radius: 16px; padding: 20px; margin-top: 18px; }
.pay-num { font-size: 1.9rem; font-weight: 800; letter-spacing: 3px; margin: 12px 0; color: var(--danger); font-variant-numeric: tabular-nums; }

/* ── Nav bas ── */
#bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.nav-btn {
  flex: 1; border: 0; background: none; cursor: pointer; position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 0 10px; color: #93a1a9; transition: color .15s;
}
.nav-btn .ic { width: 21px; height: 21px; }
.nav-btn span { font-size: .63rem; font-weight: 700; }
.nav-btn.active { color: var(--brand); }
.nav-btn.active::before { content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 3px; border-radius: 0 0 4px 4px; background: var(--brand); }

/* ── Toast ── */
#toast {
  position: fixed; bottom: 86px; left: 50%; transform: translateX(-50%) translateY(14px);
  z-index: 80; display: flex; align-items: center; gap: 9px;
  background: var(--ink); color: #fff;
  padding: 13px 20px; border-radius: 14px; font-size: .9rem; font-weight: 600;
  opacity: 0; pointer-events: none; max-width: 88%;
  box-shadow: 0 12px 32px rgba(10,20,26,.3);
}
#toast .ic { width: 17px; height: 17px; }
#toast.t-ok .ic { color: #4ade80; }
#toast.t-err .ic { color: #f87171; }
#toast.t-info .ic { color: #7dd3fc; }
#toast.show { animation: toastIn 2.7s ease both; }
@keyframes toastIn {
  0% { opacity: 0; transform: translateX(-50%) translateY(14px); }
  10%, 88% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(10px); }
}

/* ── Modale (bottom-sheet mobile / centrée desktop) ── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(10, 20, 26, .5);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn .18s ease;
}
.modal {
  width: 100%; max-width: 460px; max-height: 88vh; overflow-y: auto;
  background: #fff; border-radius: 24px 24px 0 0;
  padding: 24px 20px 22px;
  animation: modalUp .28s cubic-bezier(.2, .9, .3, 1);
}
@media (min-width: 600px) {
  .modal-backdrop { align-items: center; padding: 20px; }
  .modal { border-radius: 22px; animation-name: modalZoom; }
}
@keyframes modalUp { from { transform: translateY(60px); opacity: .4; } }
@keyframes modalZoom { from { transform: scale(.94); opacity: 0; } }
.modal-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.modal-title { font-size: 1.15rem; font-weight: 800; letter-spacing: -.02em; flex: 1; padding-top: 4px; }
.modal-x { width: 38px; height: 38px; border: 0; border-radius: 12px; background: #f1f4f5; color: var(--muted); font-size: 1.45rem; line-height: 1; font-weight: 800; }
.modal .btn { margin-top: 0; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn-ghost { flex: 1; }
.modal-actions .btn-primary { flex: 1.4; }
.modal .muted { font-size: .83rem; margin-top: 10px; }
.price-editor { display: grid; gap: 14px; }
.price-editor .hint { margin: -2px 0 2px; color: var(--muted); line-height: 1.35; }
.price-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.price-grid .wide { grid-column: 1 / -1; }
.price-editor .list { margin-top: 2px; }
.price-editor .list li { align-items: center; gap: 8px; padding: 14px; }
.price-list li { display: grid; grid-template-columns: minmax(0,1fr) auto 88px; }
.price-name { min-width: 0; }
.price-amount { white-space: nowrap; }
.price-actions { display: grid; grid-template-columns: 40px 40px; gap: 8px; align-items: center; justify-content: end; flex: none; }
.price-actions .mini-btn { width: 40px; height: 40px; border-radius: 12px; font-weight: 800; }
.price-actions .mini-btn.danger { background: var(--danger); color: #fff; border: 1px solid #c93a3a; }
@media (max-width: 420px) { .modal { padding: 22px 24px 28px; } .price-grid { gap: 10px; } }

/* ── Responsive ── */
@media (min-width: 760px) {
  body { padding-bottom: 28px; }
  .desktop-only { display: grid; }
  .view { padding: 24px; }
  .cards { grid-template-columns: repeat(4, 1fr); }
  .insight { min-width: 32%; }
  #bottomnav { left: 50%; right: auto; transform: translateX(-50%); bottom: 14px; width: min(600px, 70vw); border: 1px solid var(--line); border-radius: 18px; }
  .nav-btn.active::before { display: none; }
  .report-grid { grid-template-columns: 320px 1fr; }
}
@media (max-width: 390px) {
  .view { padding: 14px 12px; }
  .cards { gap: 9px; }
  .stat-card { padding: 13px; }
  .card-value { font-size: 1.2rem; }
  #sync-text { display: none; }
  .nav-btn span { font-size: .58rem; }
  .insight { min-width: 88%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
