/* SODIA GEM — application client (PWA). Mobile d'abord. */

.sga-body { background: var(--f-bg, #f3f6fa); margin: 0; }
.sga { min-height: 100vh; padding-bottom: calc(72px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; }

/* En-tête */
.sga-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px calc(10px); background: var(--f-navy, #06285d); color: #fff; padding-top: calc(10px + env(safe-area-inset-top)); }
.sga-brand { display: flex; align-items: center; gap: 10px; color: #fff !important; text-decoration: none; min-width: 0; }
.sga-brand img { width: 38px; height: 38px; object-fit: contain; background: #fff; border-radius: 9px; padding: 3px; }
.sga-brand span { display: flex; flex-direction: column; min-width: 0; }
.sga-brand strong { font-size: 15px; letter-spacing: .02em; }
.sga-brand small { font-size: 12px; opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sga-top-cart { position: relative; color: #fff !important; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: rgba(255, 255, 255, .12); }
.sga-top-cart .sgf-ico { width: 22px; height: 22px; }
.sga-top-cart b { position: absolute; top: 2px; right: 2px; background: var(--f-green, #12a150); font-size: 11px; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }

.sga-main { flex: 1; padding: 14px 14px 20px; max-width: 760px; width: 100%; margin: 0 auto; }
.sga-pad { padding: 10px 2px; }
.sga-muted { color: var(--f-muted, #64748b); font-size: 13px; }

/* Accueil */
.sga-hello h1 { font-size: 22px; margin: 4px 0 2px; color: var(--f-navy, #06285d); }
.sga-hello p { margin: 0 0 14px; color: var(--f-muted, #64748b); font-size: 14px; }
.sga-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.sga-action { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left; background: #fff; border: 1px solid var(--f-line, #e2e8f0); border-radius: 14px; padding: 14px; color: var(--f-ink, #0f172a) !important; text-decoration: none; font: inherit; cursor: pointer; width: 100%; }
.sga-action .sgf-ico { width: 24px; height: 24px; color: var(--f-green, #12a150); margin-bottom: 4px; }
.sga-action strong { font-size: 15px; }
.sga-action small { font-size: 12px; color: var(--f-muted, #64748b); }
.sga-action.is-main { background: var(--f-green, #12a150); border-color: var(--f-green, #12a150); color: #fff !important; }
.sga-action.is-main .sgf-ico, .sga-action.is-main small { color: #fff; opacity: .95; }
.sga-action-form { margin: 0; }

/* Cartes et listes */
.sga-card { background: #fff; border: 1px solid var(--f-line, #e2e8f0); border-radius: 14px; padding: 14px; margin-bottom: 14px; }
.sga-card h2 { font-size: 15px; margin: 0 0 10px; color: var(--f-navy, #06285d); display: flex; align-items: center; gap: 8px; }
.sga-card h2 .sgf-ico { width: 18px; height: 18px; color: var(--f-green, #12a150); }
.sga-list { list-style: none; margin: 0; padding: 0; }
.sga-list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--f-line, #eef2f7); }
.sga-list li:last-child { border-bottom: 0; }
.sga-list img { width: 44px; height: 44px; object-fit: contain; background: #f6f8fb; border-radius: 10px; flex: none; }
.sga-list-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; color: inherit !important; text-decoration: none; }
.sga-list-main strong { font-size: 14px; line-height: 1.25; }
.sga-list-main small { font-size: 12px; color: var(--f-muted, #64748b); }
.sga-list-main select { margin-top: 4px; font-size: 12px; padding: 4px 6px; border: 1px solid var(--f-line, #e2e8f0); border-radius: 8px; max-width: 100%; }
.sga-promo { background: #fdecea; color: #c0261f; font-style: normal; font-size: 11px; font-weight: 800; padding: 1px 6px; border-radius: 999px; }
.sga-price { font-weight: 700; color: var(--f-navy, #06285d); }
.sga-list .sga-qty { flex: none; width: auto; justify-content: flex-start; }
.sga-list .sga-qty input { width: 46px; flex: none; }
.sga-list .sga-qty button { width: 34px; }
.sga-remove { background: none; border: 0; padding: 0; color: var(--f-red, #ef2d2d); font-size: 12px; text-decoration: underline; cursor: pointer; text-align: left; }

/* Totaux et boutons collants */
.sga-totals p { display: flex; justify-content: space-between; margin: 4px 0; }
.sga-sticky-cta { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); padding: 10px 0; background: linear-gradient(to top, var(--f-bg, #f3f6fa) 70%, transparent); z-index: 20; }

/* Recherche et filtres */
.sga-search { display: flex; gap: 8px; margin-bottom: 10px; }
.sga-search input { flex: 1; height: 46px; border: 1px solid var(--f-line, #e2e8f0); border-radius: 12px; padding: 0 14px; font-size: 16px; background: #fff; }
.sga-search button { width: 52px; height: 46px; border: 0; border-radius: 12px; background: var(--f-green, #12a150); color: #fff; display: grid; place-items: center; }
.sga-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; -webkit-overflow-scrolling: touch; }
.sga-chips a { flex: none; background: #fff; border: 1px solid var(--f-line, #e2e8f0); border-radius: 999px; padding: 7px 14px; font-size: 13px; color: var(--f-ink, #0f172a) !important; text-decoration: none; }
.sga-chips a.is-active { background: var(--f-navy, #06285d); border-color: var(--f-navy, #06285d); color: #fff !important; }

/* Scanner */
.sga-scan h1 { font-size: 20px; color: var(--f-navy, #06285d); margin: 0 0 6px; }
.sga-cam { position: relative; border-radius: 14px; overflow: hidden; background: #000; margin-bottom: 12px; }
.sga-cam video { width: 100%; display: block; max-height: 60vh; object-fit: cover; }
.sga-cam-frame { position: absolute; inset: 18% 12%; border: 3px solid rgba(255, 255, 255, .9); border-radius: 14px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
.sga-cam button { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); }
.sga-scan-result { background: #e7f6ee; border: 1px solid #b7e3cb; color: #0b6b3a; border-radius: 12px; padding: 12px; margin-bottom: 12px; font-size: 14px; }
.sga-scan-result.is-ko { background: #fdecea; border-color: #f6c4c0; color: #b3251d; }

/* Suivi de commande */
.sga-steps { list-style: none; margin: 14px 0; padding: 0; display: flex; gap: 6px; }
.sga-steps li { flex: 1; font-size: 11px; color: var(--f-muted, #64748b); text-align: center; }
.sga-steps li span { display: block; height: 6px; border-radius: 3px; background: var(--f-line, #e2e8f0); margin-bottom: 6px; }
.sga-steps li.is-done { color: var(--f-green-dark, #0b8a43); font-weight: 700; }
.sga-steps li.is-done span { background: var(--f-green, #12a150); }
.sga-qr { width: 180px; height: 180px; margin: 10px auto; background: #fff; padding: 8px; border-radius: 12px; border: 1px solid var(--f-line, #e2e8f0); }
.sga-qr svg { width: 100%; height: 100%; }

/* Compte */
.sga-links { list-style: none; margin: 0 0 14px; padding: 0; background: #fff; border: 1px solid var(--f-line, #e2e8f0); border-radius: 14px; overflow: hidden; }
.sga-links li + li { border-top: 1px solid var(--f-line, #eef2f7); }
.sga-links a { display: flex; align-items: center; gap: 10px; padding: 14px; color: var(--f-ink, #0f172a) !important; text-decoration: none; font-size: 14px; }
.sga-links .sgf-ico { width: 20px; height: 20px; color: var(--f-green, #12a150); }
.sga-version { text-align: center; margin-top: 18px; }
.sga-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }
.sga-kpis a { background: #fff; border: 1px solid var(--f-line, #e2e8f0); border-radius: 14px; padding: 12px; text-align: center; color: var(--f-ink, #0f172a) !important; text-decoration: none; }
.sga-kpis strong { display: block; font-size: 20px; color: var(--f-navy, #06285d); }
.sga-kpis span { font-size: 12px; color: var(--f-muted, #64748b); }
.sga-foot { text-align: center; font-size: 13px; margin-top: 18px; }

/* Connexion */
.sga-login { text-align: center; padding: 20px 0; }
.sga-login-logo { width: 96px; height: 96px; object-fit: contain; }
.sga-login h1 { font-size: 22px; color: var(--f-navy, #06285d); margin: 10px 0 4px; }
.sga-login p { color: var(--f-muted, #64748b); font-size: 14px; margin: 0 0 16px; }
.sga-login .sga-card { text-align: left; }
.sga-login label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.sga-login input[type=text], .sga-login input[type=password] { width: 100%; height: 46px; border: 1px solid var(--f-line, #e2e8f0); border-radius: 12px; padding: 0 12px; font-size: 16px; margin-top: 4px; }
.sga-login .button, .sga-login input[type=submit] { width: 100%; height: 48px; border: 0; border-radius: 12px; background: var(--f-green, #12a150); color: #fff; font-weight: 800; font-size: 15px; cursor: pointer; }
.sga-login-links { margin-top: 12px; font-size: 13px; }
.sga-offline-page { text-align: center; padding: 40px 10px; }
.sga-offline-page .sgf-ico { width: 48px; height: 48px; color: var(--f-navy, #06285d); }

/* Barre du bas */
.sga-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; display: flex; background: #fff; border-top: 1px solid var(--f-line, #e2e8f0); padding-bottom: env(safe-area-inset-bottom); }
.sga-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 0 7px; font-size: 11px; color: var(--f-muted, #64748b) !important; text-decoration: none; position: relative; }
.sga-nav a.is-active { color: var(--f-green-dark, #0b8a43) !important; font-weight: 700; }
.sga-nav .sgf-ico { width: 21px; height: 21px; }
.sga-nav-badge { position: absolute; top: 4px; right: 50%; margin-right: -22px; background: var(--f-green, #12a150); color: #fff; font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px; display: grid; place-items: center; padding: 0 3px; }

/* Bandeaux */
.sga-install { position: fixed; left: 10px; right: 10px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 45; background: var(--f-navy, #06285d); color: #fff; border-radius: 14px; padding: 12px 14px; display: flex; align-items: center; gap: 10px; font-size: 13px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.sga-install button[data-sga-install-no] { background: none; border: 0; color: #fff; font-size: 16px; cursor: pointer; }
.sga-offline { position: fixed; left: 0; right: 0; bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 44; background: #b3251d; color: #fff; text-align: center; font-size: 12px; padding: 6px 10px; }
.sga-pagination { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; padding: 10px 0 0; }
.sga-save-list { margin-top: 14px; }
.sga-save-list label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.sga-save-list input { width: 100%; height: 44px; border: 1px solid var(--f-line, #e2e8f0); border-radius: 12px; padding: 0 12px; font-size: 16px; margin-top: 4px; }

@media (min-width: 720px) {
	.sga-actions { grid-template-columns: repeat(4, 1fr); }
	.sga-nav { position: sticky; bottom: 0; border-radius: 16px 16px 0 0; max-width: 760px; margin: 0 auto; }
	.sga { padding-bottom: 0; }
}
