/* =========================================================
   DED STORE ANC — Design system
   Couleurs de marque injectées depuis la table `theme`
   (--primary, --secondary, --bg, --bg-2, --text).
   ========================================================= */
:root {
  --primary: #0057ff;
  --secondary: #4da3ff;
  --bg: #ffffff;
  --bg-2: #eef4ff;
  --text: #0d1321;

  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --surface-3: #eef2f9;
  --border: #e5eaf3;
  --border-strong: #d5dceb;
  --muted: #5f6b82;
  --muted-2: #8b95a9;

  --success: #12a150;
  --success-bg: #e8f8ef;
  --warning: #c27803;
  --warning-bg: #fff6e0;
  --danger: #e5383b;
  --danger-bg: #fdecec;
  --info-bg: color-mix(in srgb, var(--primary) 9%, #fff);

  --primary-soft: color-mix(in srgb, var(--primary) 10%, #fff);
  --primary-ring: color-mix(in srgb, var(--primary) 22%, transparent);
  --grad: linear-gradient(120deg, var(--primary), var(--secondary));

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 2px 8px -2px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow: 0 12px 32px -12px rgba(16, 24, 40, .18), 0 2px 6px -2px rgba(16, 24, 40, .06);
  --shadow-primary: 0 12px 28px -10px color-mix(in srgb, var(--primary) 60%, transparent);

  --sidebar-w: 272px;
  --topbar-h: 68px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 100% -10%, color-mix(in srgb, var(--secondary) 14%, transparent), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, color-mix(in srgb, var(--primary) 9%, transparent), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
  background-attachment: fixed;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
img, video { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.015em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 20px; height: 20px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 26px; height: 26px; }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100dvh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { flex: 1; padding: 28px 32px 48px; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; }
.container.narrow { max-width: 760px; }
.container.mid { max-width: 940px; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky; top: 0; height: 100dvh; width: var(--sidebar-w); flex-shrink: 0;
  display: flex; flex-direction: column; gap: 6px;
  padding: 20px 16px 16px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-right: 1px solid var(--border);
  z-index: 60;
  overflow-y: auto;
  scrollbar-width: thin;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 16px; color: var(--text); }
.brand-logo {
  width: 46px; height: 46px; border-radius: 14px; object-fit: cover; background: #fff;
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--border);
}
.brand-name { font-weight: 800; font-size: 15px; letter-spacing: .02em; line-height: 1.1; }
.brand-name small { display: block; font-size: 11px; font-weight: 600; color: var(--muted-2); letter-spacing: .08em; text-transform: uppercase; margin-top: 3px; }
.nav-section { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2); padding: 14px 12px 6px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px;
  color: var(--muted); font-weight: 600; font-size: 14px;
  transition: background .2s, color .2s, transform .2s var(--ease);
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
.nav a.active::before { content: ''; position: absolute; left: -16px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--grad); }
.nav .count { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--primary); color: #fff; border-radius: 999px; padding: 1px 8px; }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 14px; background: var(--surface-2); }
.avatar {
  width: 38px; height: 38px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 800; font-size: 14px; color: #fff; background: var(--grad);
  text-transform: uppercase;
}
.user-chip .meta { min-width: 0; }
.user-chip .meta b { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .meta span { display: block; font-size: 12px; color: var(--muted-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 12px;
  border: 0; background: transparent; color: var(--danger); font-weight: 700; font-size: 14px; cursor: pointer;
  transition: background .2s;
}
.logout-btn:hover { background: var(--danger-bg); }
.sidebar-backdrop { display: none; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50; height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px; padding: 0 32px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.topbar-title { font-weight: 800; font-size: 17px; }
.topbar .spacer { flex: 1; }
.topbar-brand { display: none; align-items: center; gap: 10px; font-weight: 800; color: var(--text); font-size: 14px; }
.topbar-brand img { width: 36px; height: 36px; border-radius: 11px; box-shadow: 0 0 0 1px var(--border); background: #fff; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 42px; height: 42px; flex-shrink: 0;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; box-shadow: var(--shadow-xs); transition: transform .15s, box-shadow .2s, border-color .2s;
}
.icon-btn:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.icon-btn:active { transform: scale(.94); }
.badge-dot {
  position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--grad); color: #fff; font-size: 11px; font-weight: 800;
  display: grid; place-items: center; border: 2px solid var(--surface);
}
.balance-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px 0 6px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 700; font-size: 14px; box-shadow: var(--shadow-xs); transition: box-shadow .2s, border-color .2s;
}
.balance-pill:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.balance-pill .ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.balance-pill small { color: var(--muted-2); font-weight: 600; font-size: 12px; margin-right: 2px; }
.menu-btn { display: none; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: 26px; font-weight: 800; }
.page-head p { color: var(--muted); margin-top: 4px; font-size: 14.5px; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; font-size: 13.5px; margin-bottom: 10px; }
.back-link:hover { color: var(--primary); }
.eyebrow { display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--primary); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { font-size: 16px; font-weight: 800; }
.card-body { padding: 20px 24px; }
.card-foot { padding: 16px 24px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.section-title { font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-2); margin: 0 0 12px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-lg { display: flex; flex-direction: column; gap: 24px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.layout-aside { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.sticky-aside { position: sticky; top: calc(var(--topbar-h) + 20px); }

/* ---------- Hero / stats ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: var(--radius-xl); padding: 28px;
  color: #fff; background: var(--grad); box-shadow: var(--shadow-primary);
}
.hero::before, .hero::after {
  content: ''; position: absolute; border-radius: 50%; background: rgba(255,255,255,.12); pointer-events: none;
}
.hero::before { width: 320px; height: 320px; right: -90px; top: -150px; }
.hero::after { width: 200px; height: 200px; right: 120px; bottom: -130px; background: rgba(255,255,255,.08); }
.hero > * { position: relative; z-index: 1; }
.hero .label { font-size: 13px; font-weight: 600; opacity: .85; }
.hero .amount { font-size: clamp(30px, 5vw, 42px); font-weight: 800; letter-spacing: -.03em; margin-top: 4px; line-height: 1.1; }
.hero .amount small { font-size: .5em; font-weight: 700; opacity: .85; margin-right: 6px; letter-spacing: 0; }
.hero .sub { font-size: 13px; opacity: .85; margin-top: 8px; }
.hero .actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.hero .btn-light { background: #fff; color: var(--primary); }
.hero .btn-glass { background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.3); }
.hero .btn-glass:hover { background: rgba(255,255,255,.24); }

.stat { padding: 18px 20px; display: flex; align-items: center; gap: 14px; }
.stat .ico { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex-shrink: 0; }
.stat .ico.green { background: var(--success-bg); color: var(--success); }
.stat .ico.amber { background: var(--warning-bg); color: var(--warning); }
.stat .ico.red { background: var(--danger-bg); color: var(--danger); }
.stat .v { font-size: 21px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.stat .l { font-size: 12.5px; color: var(--muted); font-weight: 600; }

.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.quick a {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); color: var(--text); font-weight: 700; font-size: 14px;
  transition: transform .25s var(--ease), box-shadow .25s, border-color .2s;
}
.quick a:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: transparent; }
.quick a .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.quick a small { color: var(--muted-2); font-weight: 600; font-size: 12px; }

/* ---------- Buttons ---------- */
.btn {
  --h: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 700; font-size: 14px; white-space: nowrap; cursor: pointer; user-select: none;
  transition: transform .15s, box-shadow .25s, background .2s, border-color .2s, opacity .2s;
  text-decoration: none;
}
.btn:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: var(--shadow-primary); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 16px 34px -12px color-mix(in srgb, var(--primary) 70%, transparent); filter: brightness(1.04); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn-secondary:hover:not(:disabled) { border-color: var(--muted-2); }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-soft:hover:not(:disabled) { background: color-mix(in srgb, var(--primary) 16%, #fff); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { filter: brightness(1.06); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; }
.btn-whatsapp { background: #25d366; color: #fff; }
.btn-sm { --h: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-xs { --h: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 9px; gap: 6px; }
.btn-lg { --h: 52px; padding: 0 24px; font-size: 15px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn .spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.label { font-size: 13.5px; font-weight: 700; color: var(--text); }
.label .req { color: var(--danger); }
.label .opt { color: var(--muted-2); font-weight: 500; }
.help { font-size: 12.5px; color: var(--muted-2); }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 11px 14px; border-radius: 12px;
  border: 1.5px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 14.5px;
  transition: border-color .2s, box-shadow .2s, background .2s;
  appearance: none; -webkit-appearance: none;
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b95a9' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 38px; }
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px var(--primary-ring); }
.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; transition: color .2s; }
.input-icon .input { padding-left: 44px; }
.input-icon:focus-within > .icon { color: var(--primary); }
.input-icon .toggle-pw { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted-2); cursor: pointer; padding: 6px; border-radius: 8px; display: grid; place-items: center; }
.input-icon .toggle-pw:hover { color: var(--text); background: var(--surface-3); }
.input-icon.has-toggle .input { padding-right: 44px; }
.input-lg { min-height: 54px; font-size: 18px; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 11px;
  border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 13.5px;
  transition: border-color .2s, background .2s, color .2s;
}
.check input { accent-color: var(--primary); width: 16px; height: 16px; margin: 0; }
.check:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 14px; }
.switch input { appearance: none; -webkit-appearance: none; width: 42px; height: 24px; border-radius: 999px; background: var(--border-strong); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-xs); transition: transform .25s var(--ease); }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(18px); }
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
  padding: 26px 16px; border-radius: var(--radius); border: 2px dashed var(--border-strong); background: var(--surface-2);
  color: var(--muted); cursor: pointer; transition: border-color .2s, background .2s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.dropzone b { color: var(--text); font-size: 14px; }
.dropzone .file-name { font-weight: 700; color: var(--primary); font-size: 13px; word-break: break-all; }
.preview-img { max-height: 220px; border-radius: 12px; border: 1px solid var(--border); margin-top: 10px; object-fit: contain; }
.color-field { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 12px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.color-field input[type=color] { width: 44px; height: 34px; border: 0; padding: 0; background: none; cursor: pointer; border-radius: 8px; }
.color-field .mono { flex: 1; font-size: 13px; color: var(--muted); }

/* ---------- Alerts / toasts ---------- */
.alert {
  display: flex; align-items: flex-start; gap: 10px; padding: 13px 16px; border-radius: 13px;
  font-size: 14px; font-weight: 600; margin-bottom: 18px; border: 1px solid transparent;
  animation: slideDown .45s var(--ease);
}
.alert .icon { margin-top: 1px; }
.alert-success { background: var(--success-bg); color: #0b7a3b; border-color: color-mix(in srgb, var(--success) 22%, transparent); }
.alert-error { background: var(--danger-bg); color: #b4232a; border-color: color-mix(in srgb, var(--danger) 22%, transparent); }
.alert-info { background: var(--info-bg); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 18%, transparent); }
.alert-warning { background: var(--warning-bg); color: #8a5300; border-color: color-mix(in srgb, var(--warning) 25%, transparent); }
.alert .close { margin-left: auto; border: 0; background: transparent; color: inherit; opacity: .6; cursor: pointer; padding: 0 2px; }
.alert .close:hover { opacity: 1; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.toasts { position: fixed; z-index: 200; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 10px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-radius: 14px; background: #0f172a; color: #fff;
  font-weight: 600; font-size: 14px; box-shadow: 0 18px 40px -12px rgba(15, 23, 42, .45); pointer-events: auto;
  animation: toastIn .4s var(--ease);
}
.toast.success .icon { color: #4ade80; }
.toast.error .icon { color: #f87171; }
.toast.out { animation: toastOut .3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }

/* ---------- Badges / chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--surface-3); color: var(--muted);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.no-dot::before { display: none; }
.badge-success, .badge-completed, .badge-approved, .badge-available, .badge-active { background: var(--success-bg); color: var(--success); }
.badge-warning, .badge-pending, .badge-paid { background: var(--warning-bg); color: var(--warning); }
.badge-danger, .badge-cancelled, .badge-rejected, .badge-used, .badge-inactive { background: var(--danger-bg); color: var(--danger); }
.badge-primary, .badge-admin { background: var(--primary-soft); color: var(--primary); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; font-weight: 600; color: var(--muted); max-width: 100%; overflow-wrap: anywhere; }
.chip b { color: var(--text); font-weight: 700; }
.chip.key { background: var(--primary-soft); color: var(--primary); border-color: transparent; font-family: var(--mono); }

/* ---------- Tabs / segmented ---------- */
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-3); }
.segmented button, .segmented a {
  border: 0; background: transparent; padding: 10px 12px; border-radius: 11px; font-weight: 700; font-size: 13.5px;
  color: var(--muted); cursor: pointer; transition: background .2s, color .2s, box-shadow .2s; text-align: center;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.segmented .active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.panel { display: none; animation: fadeIn .35s var(--ease); }
.panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 700;
  color: var(--muted); background: var(--surface); border: 1px solid var(--border); transition: all .2s;
}
.filter-pill:hover { color: var(--text); border-color: var(--border-strong); }
.filter-pill.active { background: var(--text); color: #fff; border-color: var(--text); }
.filter-pill .n { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--surface-3); color: var(--muted); }
.filter-pill.active .n { background: rgba(255,255,255,.18); color: #fff; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--muted-2);
  padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: color-mix(in srgb, var(--primary) 3%, transparent); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.cell-user { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-user .avatar { width: 36px; height: 36px; font-size: 13px; border-radius: 11px; }
.cell-user b { display: block; font-size: 14px; }
.cell-user span { display: block; font-size: 12.5px; color: var(--muted-2); }
.thumb { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; background: var(--surface-3); border: 1px solid var(--border); flex-shrink: 0; }
.thumb-ph { display: grid; place-items: center; color: var(--muted-2); }

/* ---------- Product catalogue ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.toolbar .input-icon { flex: 1; min-width: 220px; }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; }
.product-card {
  position: relative; display: flex; flex-direction: column; overflow: hidden; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow-xs);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .2s;
}
.product-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); border-color: transparent; }
.product-card .media { position: relative; aspect-ratio: 1 / 1; background: linear-gradient(135deg, var(--primary-soft), var(--surface-3)); overflow: hidden; }
.product-card .media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.product-card:hover .media img { transform: scale(1.06); }
.product-card .media .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--primary); opacity: .5; }
.product-card .tag { position: absolute; top: 12px; left: 12px; padding: 5px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; background: rgba(255,255,255,.92); color: var(--text); backdrop-filter: blur(6px); letter-spacing: .02em; }
.product-card .info { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card .name { font-weight: 800; font-size: 15px; line-height: 1.3; }
.product-card .price { margin-top: auto; display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--muted); font-weight: 600; }
.product-card .price b { color: var(--primary); font-size: 15px; font-weight: 800; }
.product-card .go { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); transition: background .2s, color .2s; }
.product-card:hover .go { background: var(--primary); color: #fff; }

.product-hero { display: flex; gap: 20px; align-items: center; padding: 22px; }
.product-hero .cover { width: 112px; height: 112px; border-radius: 22px; object-fit: cover; flex-shrink: 0; background: var(--surface-3); box-shadow: var(--shadow-sm); }
.product-hero h1 { font-size: 24px; font-weight: 800; margin-top: 6px; }
.product-hero p { color: var(--muted); margin-top: 6px; font-size: 14px; white-space: pre-line; }

.tier-group + .tier-group { margin-top: 20px; }
.tier-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tier {
  position: relative; display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 14px; border-radius: 16px;
  border: 1.5px solid var(--border); background: var(--surface); cursor: pointer;
  transition: border-color .2s, box-shadow .25s, transform .25s var(--ease), background .2s;
}
.tier:hover:not(:disabled) { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.tier.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 4px var(--primary-ring); }
.tier .check-ico { position: absolute; top: 10px; right: 10px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: #fff; transform: scale(0); transition: transform .3s var(--ease); }
.tier.selected .check-ico { transform: scale(1); }
.tier img { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; }
.tier .t-label { font-weight: 700; font-size: 14px; line-height: 1.3; padding-right: 20px; }
.tier .t-price { font-weight: 800; font-size: 16px; color: var(--primary); }
.tier .t-stock { font-size: 11.5px; font-weight: 700; color: var(--muted-2); }
.tier .t-stock.low { color: var(--warning); }
.tier:disabled { cursor: not-allowed; opacity: .55; background: var(--surface-2); }
.tier:disabled .t-stock { color: var(--danger); }

.summary { display: flex; flex-direction: column; gap: 10px; }
.summary .line { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--muted); }
.summary .line b { color: var(--text); }
.summary .total { padding-top: 12px; margin-top: 4px; border-top: 1px dashed var(--border-strong); font-size: 16px; font-weight: 800; color: var(--text); }
.summary .total b { color: var(--primary); font-size: 20px; }

/* ---------- Cart / list items ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 14px; align-items: flex-start; padding: 16px 0; border-bottom: 1px solid var(--border); }
.list-item:first-child { padding-top: 0; }
.list-item:last-child { border-bottom: 0; padding-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 800; font-size: 14.5px; }
.list-item .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.list-item .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.list-item .price { font-weight: 800; color: var(--text); white-space: nowrap; text-align: right; }
.list-item .price small { display: block; font-weight: 600; color: var(--muted-2); font-size: 12px; }
.link-danger { border: 0; background: none; color: var(--danger); font-weight: 700; font-size: 12.5px; cursor: pointer; padding: 6px 0 0; display: inline-flex; align-items: center; gap: 4px; }
.link-danger:hover { text-decoration: underline; }

/* ---------- Orders ---------- */
.order { overflow: hidden; }
.order-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; background: var(--surface-2); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.order-head .num { font-weight: 800; font-family: var(--mono); font-size: 13.5px; }
.order-head .date { font-size: 12.5px; color: var(--muted-2); margin-top: 2px; }
.order-head .right { display: flex; align-items: center; gap: 12px; }
.order-head .amt { font-weight: 800; font-size: 16px; }
.order-body { padding: 16px 20px; }
.order-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.key-box { margin-top: 12px; padding: 14px; border-radius: 14px; background: linear-gradient(135deg, var(--primary-soft), color-mix(in srgb, var(--secondary) 10%, #fff)); border: 1px solid color-mix(in srgb, var(--primary) 16%, transparent); }
.key-box .k-label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--primary); }
.key-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.key-value { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px dashed color-mix(in srgb, var(--primary) 40%, transparent); font-family: var(--mono); font-weight: 600; font-size: 14px; overflow-wrap: anywhere; user-select: all; }
.key-box .ext { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12.5px; font-weight: 700; }
.copied { background: var(--success) !important; color: #fff !important; }

/* ---------- Empty states ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .ico { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 20px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.empty h3 { color: var(--text); font-size: 17px; font-weight: 800; margin-bottom: 6px; }
.empty p { font-size: 14px; max-width: 360px; margin: 0 auto; }
.empty .btn { margin-top: 18px; }

/* ---------- Pay box / info rows ---------- */
.pay-box { position: relative; overflow: hidden; padding: 20px; border-radius: var(--radius-lg); background: linear-gradient(135deg, #0f172a, #1e293b); color: #fff; }
.pay-box::after { content: ''; position: absolute; width: 220px; height: 220px; border-radius: 50%; right: -80px; top: -110px; background: radial-gradient(circle, color-mix(in srgb, var(--secondary) 55%, transparent), transparent 70%); }
.pay-box > * { position: relative; z-index: 1; }
.pay-box .lbl { font-size: 12.5px; opacity: .7; font-weight: 600; }
.pay-box .num { font-family: var(--mono); font-size: 26px; font-weight: 700; letter-spacing: .04em; margin: 6px 0 2px; }
.pay-box .owner { font-weight: 700; opacity: .9; }
.pay-box .note { margin-top: 12px; font-size: 13px; opacity: .75; }
.info-rows { display: flex; flex-direction: column; }
.info-rows .r { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.info-rows .r:last-child { border-bottom: 0; }
.info-rows .r span:first-child { color: var(--muted); }
.info-rows .r span:last-child { font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.steps { counter-reset: s; display: flex; flex-direction: column; gap: 12px; }
.steps li { list-style: none; display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--muted); }
.steps li::before { counter-increment: s; content: counter(s); width: 26px; height: 26px; border-radius: 9px; flex-shrink: 0; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: 13px; }
.steps { padding: 0; margin: 0; }
.result-box { margin-top: 14px; padding: 16px; border-radius: 14px; background: var(--success-bg); border: 1px solid color-mix(in srgb, var(--success) 25%, transparent); }
.result-box .big { font-size: 22px; font-weight: 800; color: #0b7a3b; }

/* ---------- Tutorials ---------- */
.tutos { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.tuto { overflow: hidden; display: flex; flex-direction: column; }
.tuto video { width: 100%; aspect-ratio: 16 / 9; background: #0b1220; object-fit: contain; }
.tuto .body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.tuto .title { font-weight: 800; font-size: 15.5px; }
.tuto .desc { font-size: 13.5px; color: var(--muted); white-space: pre-line; }
.tuto .meta { margin-top: auto; padding-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted-2); }

/* ---------- Stock ---------- */
.meter { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--success); transition: width .6s var(--ease); }
.meter.low > span { background: var(--warning); }
.meter.out > span { background: var(--danger); }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 20px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 38px; height: 38px; padding: 0 12px; border-radius: 11px; display: inline-grid; place-items: center; font-weight: 700; font-size: 13.5px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .current { background: var(--text); color: #fff; border-color: var(--text); }
.pagination .disabled { opacity: .4; }

/* ---------- Drawer (panier) ---------- */
.overlay { position: fixed; inset: 0; z-index: 90; background: rgba(15, 23, 42, .42); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .3s ease; }
.overlay.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 100; width: min(420px, 100vw);
  display: flex; flex-direction: column; background: var(--surface); box-shadow: -24px 0 60px -20px rgba(15, 23, 42, .35);
  transform: translateX(105%); transition: transform .45s var(--ease);
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { font-size: 17px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px; }
.drawer-foot { padding: 18px 20px calc(18px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--surface-2); display: flex; flex-direction: column; gap: 10px; }
.drawer-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); animation: fadeIn .35s var(--ease) both; }
.drawer-item:last-child { border-bottom: 0; }
.drawer-total { display: flex; justify-content: space-between; align-items: baseline; font-weight: 800; font-size: 15px; }
.drawer-total b { font-size: 20px; color: var(--primary); }
.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- FAB / bottom nav ---------- */
.fab-whatsapp {
  position: fixed; right: 22px; bottom: 24px; z-index: 70; width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center; background: #25d366; color: #fff; box-shadow: 0 14px 30px -10px rgba(37, 211, 102, .7);
  transition: transform .25s var(--ease);
}
.fab-whatsapp:hover { transform: translateY(-3px) scale(1.04); }
.fab-whatsapp svg { width: 28px; height: 28px; fill: #fff; }
.bottom-nav { display: none; }

/* ---------- Auth ---------- */
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-aside {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 48px;
  background: var(--grad); color: #fff;
}
.auth-aside::before { content: ''; position: absolute; inset: 0; background: radial-gradient(600px 400px at 80% 10%, rgba(255,255,255,.22), transparent 60%), radial-gradient(500px 400px at 0% 100%, rgba(0,0,0,.18), transparent 60%); }
.auth-aside > * { position: relative; }
.auth-aside .logo-tile { width: 132px; height: 132px; border-radius: 32px; background: #fff; padding: 6px; box-shadow: 0 24px 50px -16px rgba(0,0,0,.35); animation: float 6s ease-in-out infinite; }
.auth-aside .logo-tile img { width: 100%; height: 100%; border-radius: 26px; object-fit: cover; }
.auth-aside h2 { font-size: clamp(28px, 3.2vw, 40px); font-weight: 800; letter-spacing: -.03em; margin-top: 28px; line-height: 1.12; }
.auth-aside p { opacity: .9; margin-top: 12px; font-size: 15.5px; max-width: 420px; }
.auth-aside ul { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-direction: column; gap: 12px; }
.auth-aside li { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.auth-aside li .ico { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: rgba(255,255,255,.18); }
.auth-aside .foot { font-size: 13px; opacity: .75; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 410px; animation: fadeUp .7s var(--ease); }
.auth-card .mobile-logo { display: none; width: 84px; height: 84px; border-radius: 24px; margin: 0 auto 18px; box-shadow: var(--shadow), 0 0 0 1px var(--border); }
.auth-card h1 { font-size: 28px; font-weight: 800; }
.auth-card .lead { color: var(--muted); margin: 6px 0 26px; }
.divider { display: flex; align-items: center; gap: 12px; margin: 22px 0; font-size: 12.5px; color: var(--muted-2); font-weight: 600; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.btn-google { background: var(--surface); color: var(--text); border-color: var(--border-strong); width: 100%; }
.btn-google:hover { border-color: var(--muted-2); box-shadow: var(--shadow-sm); }
.auth-switch { text-align: center; margin-top: 24px; font-size: 14px; color: var(--muted); }
.auth-switch a { font-weight: 700; }
.pw-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 2px; }
.pw-meter span { height: 4px; border-radius: 4px; background: var(--surface-3); transition: background .3s; }

/* ---------- Status page ---------- */
.status-page { min-height: 60vh; display: grid; place-items: center; text-align: center; }
.status-page .code { font-size: 72px; font-weight: 800; letter-spacing: -.04em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1; }

/* ---------- Admin product form ---------- */
.tier-editor { display: flex; flex-direction: column; gap: 12px; }
.tier-row { position: relative; padding: 16px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface-2); animation: fadeIn .3s var(--ease); }
.tier-row .tier-fields { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 12px; }
.tier-row .tier-fields.no-delivery { grid-template-columns: 1.6fr 1fr 1fr; }
.tier-row .tier-media { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.tier-row .tier-media .thumb { width: 48px; height: 48px; }
.tier-row .tier-media input[type=file] { font-size: 13px; max-width: 100%; }
.tier-row .tier-tools { display: flex; gap: 6px; margin-left: auto; }
.tier-row .idx { position: absolute; top: -9px; left: 14px; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--text); color: #fff; }
.type-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.type-card { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; transition: all .2s; }
.type-card input { position: absolute; opacity: 0; pointer-events: none; }
.type-card .ico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); transition: all .2s; }
.type-card b { font-size: 14px; }
.type-card small { font-size: 12px; color: var(--muted-2); }
.type-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 4px var(--primary-ring); }
.type-card:has(input:checked) .ico { background: var(--primary); color: #fff; }

/* ---------- Animations ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.reveal { animation: fadeUp .6s var(--ease) both; }
.reveal-1 { animation-delay: .05s; } .reveal-2 { animation-delay: .1s; } .reveal-3 { animation-delay: .15s; } .reveal-4 { animation-delay: .2s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layout-aside { grid-template-columns: 1fr; }
  .sticky-aside { position: static; }
  .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1023px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-102%);
    transition: transform .4s var(--ease); background: var(--surface); box-shadow: 24px 0 60px -20px rgba(15, 23, 42, .35);
  }
  .sidebar.open { transform: none; }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(15, 23, 42, .42); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .3s; }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 20px; }
  .topbar-title { display: none; }
  .topbar-brand { display: inline-flex; }
  .content { padding: 22px 20px 40px; }
}

@media (max-width: 767px) {
  body { font-size: 14.5px; }
  .topbar { padding: 0 14px; gap: 10px; height: 62px; }
  .topbar-brand span { display: none; }
  .balance-pill { padding: 0 12px 0 5px; font-size: 13px; }
  .balance-pill small { display: none; }
  .content { padding: 18px 14px calc(96px + env(safe-area-inset-bottom)); }
  .page-head { margin-bottom: 18px; }
  .page-head h1 { font-size: 22px; }
  .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .card-pad, .card-body { padding: 18px; }
  .card-head { padding: 16px 18px; }
  .hero { padding: 22px; border-radius: 22px; }
  .stat { padding: 14px; gap: 10px; }
  .stat .ico { width: 38px; height: 38px; border-radius: 11px; }
  .stat .v { font-size: 17px; }
  .products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .product-card .info { padding: 12px; }
  .product-card .name { font-size: 13.5px; }
  .product-hero { flex-direction: column; text-align: center; padding: 20px; }
  .product-hero .cover { width: 96px; height: 96px; }
  .tier-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .type-cards { grid-template-columns: 1fr; }
  .tier-row .tier-fields, .tier-row .tier-fields.no-delivery { grid-template-columns: 1fr 1fr; }
  .tier-row .tier-fields > :first-child { grid-column: 1 / -1; }
  .fab-whatsapp { bottom: calc(84px + env(safe-area-inset-bottom)); right: 16px; width: 50px; height: 50px; }
  .toasts { bottom: calc(88px + env(safe-area-inset-bottom)); }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 65; left: 10px; right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom)); padding: 6px; border-radius: 20px;
    background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(16px) saturate(1.5); -webkit-backdrop-filter: blur(16px) saturate(1.5);
    border: 1px solid var(--border); box-shadow: 0 16px 40px -14px rgba(15, 23, 42, .35);
  }
  .bottom-nav a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 2px; border-radius: 14px; color: var(--muted-2); font-size: 10.5px; font-weight: 700; }
  .bottom-nav a.active { color: var(--primary); background: var(--primary-soft); }
  .bottom-nav .badge-dot { top: 0; right: calc(50% - 22px); min-width: 18px; height: 18px; font-size: 10px; }

  /* Tableaux → cartes empilées */
  .table.stack-sm thead { display: none; }
  .table.stack-sm, .table.stack-sm tbody, .table.stack-sm tr, .table.stack-sm td { display: block; width: 100%; }
  .table.stack-sm tr { padding: 14px 16px; border-bottom: 1px solid var(--border); }
  .table.stack-sm tbody tr:last-child { border-bottom: 0; }
  .table.stack-sm td { padding: 5px 0; border: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: right; }
  .table.stack-sm td[data-label]::before { content: attr(data-label); font-size: 12px; font-weight: 700; color: var(--muted-2); text-align: left; flex-shrink: 0; }
  .table.stack-sm td.cell-main { display: block; text-align: left; padding-bottom: 8px; }
  .table.stack-sm td.cell-main::before { display: none; }
  .table.stack-sm .actions { justify-content: flex-start; width: 100%; }
  .table.stack-sm td.cell-actions { display: block; padding-top: 10px; }
  .table.stack-sm td.cell-actions::before { display: none; }

  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-card .mobile-logo { display: block; }
  .auth-card h1, .auth-card .lead { text-align: center; }
  .order-head, .order-body, .order-foot { padding-left: 16px; padding-right: 16px; }
}

@media (max-width: 380px) {
  .products, .tier-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .quick { grid-template-columns: 1fr 1fr; }
}
