/* S-Tec Factory PWA — thème noir / rouge / blanc */
:root {
  --bg: #0a0a0c;
  --surface: #141418;
  --surface-2: #1c1c22;
  --line: #2a2a32;
  --text: #ffffff;
  --muted: #9a9aa6;
  --red: #e60208;
  --red-2: #ff2a2f;
  --green: #22c55e;
  --amber: #f59e0b;
  --radius: 18px;
  --tabbar-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); }
body { overscroll-behavior-y: none; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
p { margin: 0; color: var(--muted); line-height: 1.5; }

/* ---------- Splash ---------- */
#splash {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 40%, #2a0204 0%, var(--bg) 60%);
  transition: opacity .5s ease, visibility .5s;
}
#splash.hide { opacity: 0; visibility: hidden; }
.splash-logo { text-align: center; animation: pop .6s cubic-bezier(.2,.9,.3,1.3) both; }
.splash-logo img { margin: 0 auto 10px; height: auto; filter: drop-shadow(0 0 24px rgba(230,2,8,.55)); }
.splash-name { font-weight: 900; font-style: italic; font-size: 18px; letter-spacing: .5em; color: #fff; padding-left: .5em; }
.splash-name span { color: var(--red); }
.splash-bar { width: 140px; height: 3px; margin: 18px auto 0; background: var(--line); border-radius: 3px; overflow: hidden; }
.splash-bar i { display: block; height: 100%; width: 40%; background: var(--red); animation: load 1s ease-in-out infinite; }
@keyframes pop { from { transform: scale(.8); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes load { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-top) + 12px) 18px 12px;
  background: rgba(10,10,12,.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-style: italic; letter-spacing: .06em; font-size: 15px; }
.brand img { height: 28px; width: auto; }
.brand b { color: #fff; font-size: 13px; letter-spacing: .3em; }
.net { font-size: 12px; padding: 4px 10px; border-radius: 99px; background: rgba(245,158,11,.15); color: var(--amber); }

/* ---------- Main ---------- */
main {
  padding: 18px 18px calc(var(--tabbar-h) + var(--safe-bottom) + 28px);
  max-width: 760px; margin: 0 auto; outline: none;
}
.view-enter { animation: viewIn .35s cubic-bezier(.2,.8,.2,1) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.section { margin-top: 26px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.section-head h2 { font-size: 19px; }
.page-title { font-size: 28px; font-weight: 800; margin-bottom: 6px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 4px 9px; border-radius: 99px; }
.badge-demo { background: rgba(245,158,11,.14); color: var(--amber); border: 1px dashed rgba(245,158,11,.5); }
.badge-red { background: var(--red); color: #fff; }
.badge-live { background: rgba(34,197,94,.14); color: var(--green); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 24px; padding: 26px 22px 24px;
  background:
    linear-gradient(115deg, transparent 52%, rgba(230,2,8,.85) 52%, rgba(230,2,8,.85) 60%, transparent 60%),
    linear-gradient(115deg, transparent 62%, rgba(230,2,8,.35) 62%, rgba(230,2,8,.35) 66%, transparent 66%),
    linear-gradient(160deg, #1d1d24 0%, #0d0d10 100%);
  border: 1px solid var(--line);
}
.hero h1 { font-size: 30px; font-weight: 900; font-style: italic; line-height: 1.05; max-width: 70%; }
.hero h1 span { color: var(--red-2); }
.hero p { margin-top: 10px; max-width: 70%; color: #c9c9d2; }
.hero .btn { margin-top: 18px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 12px; }
.card h3 { font-size: 16px; margin-bottom: 4px; }
.card-row { display: flex; align-items: center; gap: 14px; }
.card-icon { flex: 0 0 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: rgba(230,2,8,.12); color: var(--red-2); font-size: 20px; }
.tap { transition: transform .15s ease, background .2s; cursor: pointer; }
.tap:active { transform: scale(.98); }

.scroller { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; margin: 0 -18px; padding-left: 18px; padding-right: 18px; scrollbar-width: none; }
.scroller::-webkit-scrollbar { display: none; }
.scroller > * { scroll-snap-align: start; flex: 0 0 78%; max-width: 320px; }

.news-card { position: relative; overflow: hidden; min-height: 150px; display: flex; flex-direction: column; justify-content: flex-end; }
.news-card::before { content: ""; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(230,2,8,.25), transparent 60%); pointer-events: none; }
.news-card .badge { position: absolute; top: 12px; left: 12px; }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; background: rgba(230,2,8,.1); border: 1px solid rgba(230,2,8,.35); }
.alert strong { display: block; margin-bottom: 2px; }

/* ---------- Grid produits ---------- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.product { padding: 0; overflow: hidden; }
.product-img { aspect-ratio: 1; display: grid; place-items: center; background: radial-gradient(circle at 50% 35%, #2b2b33, #121216); font-size: 46px; position: relative; }
.product-img .badge { position: absolute; top: 10px; left: 10px; }
.product-body { padding: 12px; }
.product-body h3 { font-size: 14px; line-height: 1.3; }
.product-body p { font-size: 12px; margin-top: 4px; }

/* ---------- Appareils ---------- */
.device { display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: center; }
.gauge { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--red) 0 72%, var(--line) 72% 100%); position: relative; }
.gauge::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--surface); }
.gauge span { position: relative; z-index: 1; font-weight: 800; font-size: 13px; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.kv div { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.kv small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.kv b { font-size: 15px; }
.empty { text-align: center; padding: 34px 18px; }
.empty .big { font-size: 44px; margin-bottom: 10px; }

/* ---------- Listes / réglages ---------- */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 16px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item span { color: var(--muted); font-size: 14px; }
select, input[type=text] {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; font: inherit; font-size: 15px;
}
input[type=text] { width: 100%; }
input[type=text]:focus, select:focus { outline: 2px solid var(--red); outline-offset: 1px; }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }

.switch { position: relative; width: 48px; height: 28px; flex: 0 0 48px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--line); transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + i { background: var(--red); }
.switch input:checked + i::after { transform: translateX(20px); }

/* ---------- FAQ ---------- */
details.faq { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 0 16px; }
details.faq + details.faq { margin-top: 10px; }
details.faq summary { list-style: none; cursor: pointer; padding: 15px 0; font-weight: 600; display: flex; justify-content: space-between; gap: 12px; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; color: var(--red); font-size: 20px; line-height: 1; transition: transform .2s; }
details.faq[open] summary::after { transform: rotate(45deg); }
details.faq p { padding-bottom: 15px; }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer; padding: 13px 20px; border-radius: 99px; font-weight: 700; font-size: 15px; transition: transform .15s, filter .2s; }
.btn:active { transform: scale(.97); }
.btn-red { background: var(--red); color: #fff; box-shadow: 0 8px 24px rgba(230,2,8,.35); }
.btn-ghost { background: var(--surface-2); border: 1px solid var(--line); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.icon-btn { background: none; border: 0; color: var(--muted); font-size: 16px; padding: 6px; cursor: pointer; }
.row-gap { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Tabbar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  background: rgba(14,14,17,.92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255,255,255,.06);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); font-size: 10.5px; font-weight: 600; position: relative; transition: color .2s; }
.tabbar svg { width: 24px; height: 24px; fill: currentColor; stroke: currentColor; transition: transform .25s cubic-bezier(.2,.9,.3,1.4); }
.tabbar a.active { color: #fff; }
.tabbar a.active svg { color: var(--red); transform: translateY(-2px) scale(1.08); }
.tabbar a.active::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--red); box-shadow: 0 0 12px var(--red); }

/* ---------- Install banner / toast / sheet ---------- */
.install {
  position: fixed; left: 12px; right: 12px; z-index: 30;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 10px);
  display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,.5); animation: viewIn .4s both;
}
.install img { border-radius: 10px; }
.install-text { flex: 1; font-size: 13px; }
.install-text strong { display: block; font-size: 14px; }
.install-text span { color: var(--muted); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 40;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
  background: #fff; color: #000; font-weight: 600; font-size: 14px;
  padding: 12px 16px; border-radius: 12px; display: flex; gap: 12px; align-items: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); max-width: calc(100% - 32px); animation: viewIn .3s both;
}
.toast button { background: var(--red); color: #fff; border: 0; border-radius: 8px; padding: 6px 10px; font-weight: 700; cursor: pointer; }

.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.6); animation: fade .25s both; }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow: auto;
  background: var(--surface); border-radius: 24px 24px 0 0; border-top: 1px solid var(--line);
  padding: 10px 20px calc(var(--safe-bottom) + 24px); animation: slideUp .35s cubic-bezier(.2,.8,.2,1) both;
  max-width: 760px; margin: 0 auto;
}
.sheet-grip { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 16px; }
@keyframes fade { from { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(100%); } }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt { margin-top: 14px; }
.center { text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
