/* =====================================================================
   MIDA — design system (marketing site + dashboard)
   Warm paper, ink type, saffron accent, zellige star motif.
   ===================================================================== */
:root {
  --paper: #FAF7F2; --paper-2: #F3EEE5; --card: #FFFFFF; --ink: #17140F; --ink-2: #3A342C;
  --muted: #6E665B; --line: #E7E0D4; --line-2: #D9D0C1;
  --accent: #D9481F; --accent-2: #B93A15; --accent-soft: #FBE7DF; --on-accent: #FFFFFF;
  --olive: #22443A; --olive-soft: #E3ECE7; --gold: #C99A2E;
  --ok: #1F7A4D; --warn: #A86B00; --err: #B42318;
  --r-sm: 10px; --r: 14px; --r-lg: 22px;
  --shadow-1: 0 1px 2px rgba(23,20,15,.06), 0 1px 1px rgba(23,20,15,.04);
  --shadow-2: 0 12px 32px -12px rgba(23,20,15,.18), 0 2px 6px rgba(23,20,15,.05);
  --font-display: 'Bricolage Grotesque', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-ar: 'Noto Kufi Arabic', 'Geeza Pro', 'Tahoma', sans-serif;
  --ease: cubic-bezier(.2,.7,.2,1);
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.55 var(--font-body); -webkit-font-smoothing: antialiased; }
img, svg, canvas { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: clamp(2.2rem, 7vw, 4.1rem); letter-spacing: -0.035em; }
h2 { font-size: clamp(1.7rem, 4.6vw, 2.7rem); }
h3 { font-size: 1.2rem; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
[dir="rtl"], .ar { font-family: var(--font-ar); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }
.muted { color: var(--muted); }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font: 600 .78rem/1 var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--accent-2); }
.eyebrow::before { content: ''; width: 18px; height: 2px; background: currentColor; border-radius: 2px; }

/* ---------- Buttons ---------- */
.btn { --bg: var(--ink); --fg: var(--paper); display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent; background: var(--bg); color: var(--fg); font: 600 .97rem/1 var(--font-body); text-decoration: none; cursor: pointer; transition: transform .15s var(--ease), background .2s, box-shadow .2s; -webkit-tap-highlight-color: transparent; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
.btn:active { transform: translateY(0); }
.btn[disabled], .btn.loading { opacity: .6; pointer-events: none; }
.btn.loading::after { content: ''; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-accent { --bg: var(--accent); --fg: var(--on-accent); }
.btn-accent:hover { --bg: var(--accent-2); }
.btn-ghost { --bg: transparent; --fg: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { --bg: var(--card); box-shadow: var(--shadow-1); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: .88rem; }
.btn-block { width: 100%; }
.btn-danger { --bg: transparent; --fg: var(--err); border-color: color-mix(in srgb, var(--err) 30%, transparent); }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.icon-btn:hover { border-color: var(--line-2); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Header / nav ---------- */
.site-header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--paper) 86%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 12px; }
.logo { display: inline-flex; align-items: center; gap: 9px; font: 800 1.3rem/1 var(--font-display); letter-spacing: -0.03em; text-decoration: none; }
.logo svg { width: 28px; height: 28px; }
.site-nav { display: none; }
.site-nav a { text-decoration: none; color: var(--ink-2); font-weight: 500; padding: 8px 4px; }
.site-nav a:hover { color: var(--ink); }
.nav-toggle { display: inline-grid; }
.header-cta { display: none; }
.site-nav.open { display: flex; position: absolute; left: 0; right: 0; top: 64px; flex-direction: column; gap: 4px; background: var(--paper); padding: 12px 16px 20px; border-bottom: 1px solid var(--line); box-shadow: var(--shadow-2); animation: drop .2s var(--ease); }
.site-nav.open a { padding: 12px 4px; font-size: 1.05rem; border-bottom: 1px solid var(--line); }
.site-nav.open .btn { margin-top: 10px; }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }
@media (min-width: 860px) {
  .site-nav, .site-nav.open { display: flex; position: static; flex-direction: row; align-items: center; gap: 26px; background: none; padding: 0; border: 0; box-shadow: none; animation: none; }
  .site-nav.open a { border: 0; padding: 8px 4px; font-size: 1rem; }
  .site-nav .btn { display: none; }
  .nav-toggle { display: none; }
  .header-cta { display: flex; gap: 10px; }
}

/* ---------- Hero ---------- */
.hero { position: relative; padding: 48px 0 40px; overflow: hidden; }
.hero::before { content: ''; position: absolute; inset: -20% -10% auto auto; width: 520px; height: 520px; background: url("../img/zellige.svg") center/120px repeat; opacity: .5; -webkit-mask: radial-gradient(closest-side, #000 20%, transparent); mask: radial-gradient(closest-side, #000 20%, transparent); pointer-events: none; }
.hero-grid { display: grid; gap: 40px; align-items: center; position: relative; }
@media (min-width: 920px) { .hero { padding: 80px 0 72px; } .hero-grid { grid-template-columns: 1.1fr .9fr; gap: 56px; } }
.hero h1 em { font-style: normal; color: var(--accent); position: relative; white-space: nowrap; }
.hero h1 em::after { content: ''; position: absolute; left: 0; right: 0; bottom: .02em; height: .12em; background: var(--accent); opacity: .22; border-radius: 4px; }
.hero .lead { font-size: clamp(1.06rem, 2.6vw, 1.24rem); color: var(--ink-2); max-width: 34em; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 10px; margin: 26px 0 18px; }
.hero-proof { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: .9rem; color: var(--muted); padding: 0; margin: 0; list-style: none; }
.hero-proof li::before { content: '✓'; color: var(--ok); font-weight: 800; margin-right: 6px; }

/* Phone mockup with a real mini-menu inside */
.phone { position: relative; width: min(320px, 82vw); margin: 0 auto; aspect-ratio: 9 / 18.5; border-radius: 44px; background: #0f0d0a; padding: 11px; box-shadow: 0 40px 80px -30px rgba(23,20,15,.45), 0 0 0 1px rgba(255,255,255,.06) inset; transform: rotate(2.5deg); }
.phone::before { content: ''; position: absolute; top: 20px; left: 50%; width: 84px; height: 24px; margin-left: -42px; border-radius: 20px; background: #0f0d0a; z-index: 2; }
.phone-screen { height: 100%; border-radius: 34px; overflow: hidden; background: #FFFDF9; display: flex; flex-direction: column; font-size: 12.5px; }
.pm-cover { height: 118px; background: linear-gradient(160deg, #2a1f14, #6b3a1f 60%, #D9481F); position: relative; }
.pm-cover::after { content: ''; position: absolute; inset: 0; background: url("../img/zellige.svg") center/70px repeat; opacity: .18; }
.pm-head { padding: 0 16px; margin-top: -24px; position: relative; z-index: 1; }
.pm-logo { width: 48px; height: 48px; border-radius: 14px; background: #fff; display: grid; place-items: center; box-shadow: var(--shadow-2); font: 800 20px var(--font-display); color: var(--accent); }
.pm-name { font: 700 17px/1.2 var(--font-display); margin: 8px 0 2px; }
.pm-tabs { display: flex; gap: 6px; padding: 10px 16px; overflow: hidden; }
.pm-tabs span { padding: 6px 11px; border-radius: 99px; background: #F3EEE5; white-space: nowrap; font-weight: 600; }
.pm-tabs span.on { background: var(--ink); color: #fff; }
.pm-item { display: flex; justify-content: space-between; gap: 10px; padding: 10px 16px; border-top: 1px solid #F0EAE0; }
.pm-item b { display: block; font-size: 13px; }
.pm-item small { color: var(--muted); }
.pm-price { font-weight: 700; white-space: nowrap; }
.pm-cart { margin: auto 12px 14px; padding: 12px 14px; border-radius: 16px; background: #1FA855; color: #fff; display: flex; justify-content: space-between; font-weight: 700; box-shadow: 0 10px 20px -10px rgba(31,168,85,.7); }
.float-card { position: absolute; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; box-shadow: var(--shadow-2); font-size: .82rem; display: flex; gap: 10px; align-items: center; z-index: 3; }
.float-card strong { display: block; font-size: .9rem; }
.float-qr { left: -6px; bottom: 16%; }
.float-qr .qr-mini { width: 46px; height: 46px; }
.float-views { right: -4px; top: 18%; }
@media (max-width: 420px) { .float-qr { left: -2px; } .float-views { right: -2px; } }
.hero-visual { position: relative; padding: 10px 0; }

/* ---------- Sections ---------- */
section { padding: 64px 0; }
@media (min-width: 920px) { section { padding: 96px 0; } }
.section-head { max-width: 640px; margin-bottom: 36px; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.section-head.center .eyebrow::before { display: none; }
.band { background: var(--card); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.dark-band { background: var(--olive); color: #F3EFE6; }
.dark-band .muted { color: #B9C7BF; }
.dark-band .eyebrow { color: #F2B79F; }

.logos { display: flex; flex-wrap: wrap; gap: 10px 26px; justify-content: center; color: var(--muted); font-weight: 600; font-size: .92rem; }
.logos span { display: inline-flex; gap: 8px; align-items: center; }
.logos span::before { content: '◆'; color: var(--gold); font-size: .6rem; }

.grid { display: grid; gap: 14px; }
@media (min-width: 680px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow-1); }
.feature .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-2); margin-bottom: 14px; }
.feature .ic svg { width: 22px; height: 22px; }
.feature p { color: var(--muted); margin: 0; }
.tag, .feature .tag { display: inline-block; margin-left: 6px; font: 700 .66rem/1 var(--font-body); letter-spacing: .06em; text-transform: uppercase; color: var(--olive); background: var(--olive-soft); padding: 4px 7px; border-radius: 99px; vertical-align: middle; }

.steps { counter-reset: s; display: grid; gap: 14px; }
@media (min-width: 820px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step { position: relative; padding: 24px; border-radius: var(--r-lg); background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); }
.step::before { counter-increment: s; content: '0' counter(s); font: 800 2.4rem/1 var(--font-display); color: #F2B79F; display: block; margin-bottom: 14px; }
.step h3 { color: #fff; }

.compare { width: 100%; border-collapse: collapse; font-size: .95rem; }
.compare th, .compare td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.compare td:not(:first-child), .compare th:not(:first-child) { text-align: center; }
.compare .yes { color: var(--ok); font-weight: 800; }
.compare .no { color: var(--line-2); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- Pricing ---------- */
.billing-toggle { display: inline-flex; padding: 4px; background: var(--paper-2); border-radius: 99px; border: 1px solid var(--line); margin-bottom: 26px; }
.billing-toggle button { border: 0; background: none; padding: 9px 16px; border-radius: 99px; font: 600 .9rem var(--font-body); cursor: pointer; color: var(--muted); }
.billing-toggle button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow-1); }
.billing-toggle .save { color: var(--ok); font-size: .78rem; margin-left: 4px; }
.plans { display: grid; gap: 14px; align-items: stretch; }
@media (min-width: 900px) { .plans { grid-template-columns: repeat(3, 1fr); } }
.plan { display: flex; flex-direction: column; position: relative; }
.plan.featured { border: 2px solid var(--ink); box-shadow: var(--shadow-2); }
.plan .ribbon { position: absolute; top: -12px; left: 22px; background: var(--accent); color: #fff; font: 700 .72rem/1 var(--font-body); padding: 6px 10px; border-radius: 99px; letter-spacing: .04em; }
.plan h3 { font-size: 1.15rem; margin-bottom: 4px; }
.price { font: 800 2.6rem/1 var(--font-display); letter-spacing: -.04em; margin: 16px 0 4px; }
.price small { font: 500 .95rem var(--font-body); color: var(--muted); letter-spacing: 0; }
.plan ul { list-style: none; padding: 0; margin: 18px 0 22px; display: grid; gap: 9px; font-size: .95rem; }
.plan li { display: flex; gap: 9px; }
.plan li::before { content: ''; flex: none; width: 18px; height: 18px; margin-top: 2px; border-radius: 50%; background: var(--olive-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3 3 7-7' fill='none' stroke='%2322443A' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat; }
.plan li.off { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-2); }
.plan li.off::before { background: var(--paper-2); }
.plan .btn { margin-top: auto; }

/* ---------- FAQ ---------- */
.faq { max-width: 760px; margin: 0 auto; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { list-style: none; cursor: pointer; padding: 20px 36px 20px 0; font: 600 1.06rem/1.35 var(--font-body); position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; position: absolute; right: 4px; top: 16px; font: 400 1.6rem/1 var(--font-body); color: var(--muted); transition: transform .2s var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { color: var(--ink-2); padding-bottom: 18px; margin: 0; }

/* ---------- CTA + footer ---------- */
.cta-box { border-radius: 28px; padding: 40px 22px; background: var(--ink); color: #F6F1E8; text-align: center; position: relative; overflow: hidden; }
.cta-box::before { content: ''; position: absolute; inset: 0; background: url("../img/zellige.svg") center/90px repeat; opacity: .07; }
.cta-box > * { position: relative; }
.cta-box p { color: #CFC7BA; max-width: 34em; margin: 0 auto 22px; }
@media (min-width: 720px) { .cta-box { padding: 64px 40px; } }
.site-footer { padding: 48px 0 32px; border-top: 1px solid var(--line); font-size: .93rem; color: var(--muted); }
.footer-grid { display: grid; gap: 28px; grid-template-columns: 1fr 1fr; }
@media (min-width: 820px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.footer-grid h4 { font: 700 .82rem var(--font-body); text-transform: uppercase; letter-spacing: .07em; color: var(--ink); margin-bottom: 12px; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-grid a { text-decoration: none; }
.footer-grid a:hover { color: var(--ink); }
.footer-bottom { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.shown { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } html { scroll-behavior: auto; } }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label, .label { font-weight: 600; font-size: .9rem; }
.field .hint { font-size: .82rem; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; min-height: 46px; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); font: 16px/1.4 var(--font-body); transition: border-color .15s, box-shadow .15s; }
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ink) 10%, transparent); }
.input[aria-invalid="true"] { border-color: var(--err); }
.input-group { display: flex; align-items: stretch; border: 1px solid var(--line-2); border-radius: 12px; background: var(--card); overflow: hidden; }
.input-group span { display: flex; align-items: center; padding: 0 10px 0 14px; color: var(--muted); font-size: .9rem; background: var(--paper-2); border-right: 1px solid var(--line); white-space: nowrap; }
.input-group .input { border: 0; border-radius: 0; min-width: 0; }
.input-group:focus-within { border-color: var(--ink); }
.form-error { color: var(--err); font-size: .88rem; min-height: 1.2em; margin: 4px 0 10px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.switch { appearance: none; -webkit-appearance: none; width: 42px; height: 24px; border-radius: 99px; background: var(--line-2); position: relative; cursor: pointer; transition: background .2s; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: transform .2s var(--ease); }
.switch:checked { background: var(--ok); }
.switch:checked::after { transform: translateX(18px); }
.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > .field { flex: 1 1 140px; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 500px at 50% -10%, var(--accent-soft), transparent 60%), var(--paper); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .logo { margin-bottom: 26px; justify-content: center; display: flex; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--paper-2); padding: 4px; border-radius: 12px; margin-bottom: 20px; }
.tabs button { border: 0; background: none; padding: 10px; border-radius: 9px; font: 600 .93rem var(--font-body); color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow-1); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .82rem; margin: 16px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.linkish { background: none; border: 0; padding: 0; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font: inherit; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 100; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: #fff; padding: 13px 16px; border-radius: 14px; box-shadow: var(--shadow-2); font-weight: 500; font-size: .95rem; opacity: 0; transform: translateY(10px) scale(.98); transition: all .25s var(--ease); display: flex; gap: 10px; align-items: center; }
.toast::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #9ec5ff; flex: none; }
.toast.in { opacity: 1; transform: none; }
.toast-success::before { background: #4ade80; }
.toast-error { background: #3b0d0a; }
.toast-error::before { background: #f87171; }

/* ---------- Skeleton / empty states ---------- */
.skeleton { background: linear-gradient(90deg, var(--paper-2) 25%, #ECE5DA 37%, var(--paper-2) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: 10px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.empty { text-align: center; padding: 40px 20px; border: 1.5px dashed var(--line-2); border-radius: var(--r-lg); color: var(--muted); }
.empty .ic { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-2); }
.empty h3 { color: var(--ink); }

/* ---------- Dashboard ---------- */
.app { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; }
.app-top { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--paper) 90%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.app-top .wrap { height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.plan-pill { font: 700 .72rem/1 var(--font-body); letter-spacing: .06em; text-transform: uppercase; padding: 6px 9px; border-radius: 99px; background: var(--paper-2); border: 1px solid var(--line); }
.plan-pill.pro, .plan-pill.business { background: var(--ink); color: #fff; border-color: var(--ink); }
.app-main { padding: 20px 0 110px; }
@media (min-width: 900px) { .app-main { padding: 32px 0 60px; } }
.app-tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--card); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
.app-tabs button { border: 0; background: none; display: grid; justify-items: center; gap: 3px; padding: 7px 4px; border-radius: 12px; font: 600 .72rem var(--font-body); color: var(--muted); cursor: pointer; }
.app-tabs button svg { width: 22px; height: 22px; }
.app-tabs button[aria-selected="true"] { color: var(--ink); background: var(--paper-2); }
@media (min-width: 900px) {
  .app-tabs { position: static; display: inline-grid; grid-template-columns: repeat(4, auto); gap: 4px; border: 1px solid var(--line); border-radius: 14px; padding: 4px; margin-bottom: 24px; }
  .app-tabs button { grid-auto-flow: column; gap: 8px; padding: 9px 14px; font-size: .9rem; }
  .app-tabs button svg { width: 18px; height: 18px; }
}
.panel[hidden] { display: none; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.panel-head h1 { font-size: clamp(1.6rem, 5vw, 2.1rem); margin: 0; }
.upgrade-bar { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 14px 16px; border-radius: 16px; background: linear-gradient(110deg, var(--ink), #3a2a1c); color: #F6F1E8; margin-bottom: 18px; }
.upgrade-bar strong { color: #fff; }
.upgrade-bar .btn { --bg: #fff; --fg: var(--ink); }
.meter { height: 6px; border-radius: 99px; background: var(--paper-2); overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s var(--ease); }
.demo-banner { background: #FFF6D6; border-bottom: 1px solid #F0DE9C; color: #5d4a00; font-size: .86rem; padding: 8px 16px; text-align: center; }
.demo-banner select { font: inherit; margin-left: 6px; padding: 2px 6px; border-radius: 6px; }

.cat-block { margin-bottom: 18px; }
.cat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 2px 10px; }
.cat-head h3 { margin: 0; font-size: 1.1rem; }
.cat-head .actions { display: flex; gap: 6px; }
.item-list { display: grid; gap: 8px; }
.item-row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; cursor: pointer; transition: border-color .15s, transform .15s; text-align: left; font: inherit; color: inherit; width: 100%; }
.item-row:hover { border-color: var(--line-2); }
.item-row .thumb { width: 48px; height: 48px; border-radius: 10px; background: var(--paper-2); object-fit: cover; display: grid; place-items: center; color: var(--muted); font-weight: 700; }
.item-row .meta { min-width: 0; }
.item-row .meta b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-row .meta small { color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-row .price-tag { font-weight: 700; white-space: nowrap; }
.item-row.off { opacity: .55; }
.item-row.off .price-tag::after { content: ' · épuisé'; font-weight: 500; color: var(--err); font-size: .8rem; }

.share-grid { display: grid; gap: 14px; }
@media (min-width: 820px) { .share-grid { grid-template-columns: 340px 1fr; } }
.qr-box { display: grid; place-items: center; padding: 18px; background: #fff; border-radius: 18px; border: 1px solid var(--line); }
.qr-box svg { width: 100%; max-width: 260px; height: auto; }
.link-box { display: flex; gap: 8px; align-items: center; padding: 6px 6px 6px 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--card); }
.link-box code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }

.bars { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding-top: 10px; }
.bars i { flex: 1; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; opacity: .85; position: relative; }
.bars i:hover { opacity: 1; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.kpi { padding: 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.kpi b { display: block; font: 800 1.6rem/1.1 var(--font-display); }
.kpi span { font-size: .8rem; color: var(--muted); }
.locked { position: relative; }
.locked > .lock-overlay { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; background: color-mix(in srgb, var(--paper) 75%, transparent); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); border-radius: var(--r-lg); padding: 20px; }

/* Dialog (bottom sheet on mobile) */
dialog.sheet { border: 0; padding: 0; width: 100%; max-width: 560px; background: var(--card); color: var(--ink); border-radius: 22px 22px 0 0; margin: auto auto 0; max-height: 92dvh; box-shadow: 0 -10px 40px rgba(0,0,0,.2); }
dialog.sheet[open] { animation: up .28s var(--ease); }
dialog.sheet::backdrop { background: rgba(23,20,15,.42); }
@media (min-width: 700px) { dialog.sheet { border-radius: 22px; margin: auto; } }
@keyframes up { from { transform: translateY(30px); opacity: .4; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); z-index: 1; }
.sheet-head h2 { font-size: 1.2rem; margin: 0; }
.sheet-body { padding: 18px; overflow-y: auto; }
.sheet-foot { display: flex; gap: 10px; justify-content: space-between; padding: 14px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--card); }
.img-pick { display: flex; align-items: center; gap: 12px; }
.img-pick .preview { width: 64px; height: 64px; border-radius: 12px; background: var(--paper-2); object-fit: cover; flex: none; }
.lang-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.lang-chips label { display: inline-flex; gap: 6px; align-items: center; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 99px; cursor: pointer; font-weight: 600; font-size: .9rem; }
.lang-chips input { accent-color: var(--ink); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 32px; height: 32px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; }
.swatches button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ink); }

/* ---------- Legal / prose ---------- */
.prose { max-width: 720px; margin: 0 auto; padding: 48px 0 72px; }
.prose h1 { font-size: clamp(2rem, 6vw, 2.8rem); }
.prose h2 { font-size: 1.35rem; margin-top: 2em; }
.prose p, .prose li { color: var(--ink-2); }
.prose .updated { color: var(--muted); font-size: .9rem; }
.breadcrumbs { font-size: .86rem; color: var(--muted); margin-bottom: 18px; }
.breadcrumbs a { text-decoration: none; }
.article-card { display: block; text-decoration: none; }
.article-card:hover h3 { text-decoration: underline; text-underline-offset: 4px; }

/* Overflow guards (long URLs, grids on narrow phones) */
.grid > *, .share-grid > *, .plans > *, .hero-grid > * { min-width: 0; }
.link-box code { display: block; }
html, body { overflow-x: clip; }
@media (max-width: 899px) { body:has(.app-tabs:not([hidden])) .toasts { bottom: calc(84px + env(safe-area-inset-bottom)); } }
.item-row .price-tag { direction: ltr; unicode-bidi: isolate; }
