/* =========================================================
   CreITIC Pièces : habillage magasin de pièces moto
   Chargé en dernier. Carbone, acier brossé, accent du thème (orange par défaut).
   ========================================================= */
:root {
  --bg: #0b0d10; --bg-soft: #101317; --panel: #14171c; --card: #181c22; --card-2: #1f242b; --hover: #272d35;
  --line: rgba(255, 255, 255, .10); --line-2: rgba(255, 255, 255, .06);
  --text: #f2f4f7; --text-2: #c2c8d0; --muted: #8b939e;
  --accent: var(--theme-accent, #ff6a13); --accent-2: var(--theme-accent, #ff6a13);
  --accent-soft: rgba(var(--theme-rgb, 255,106,19), .14); --accent-glow: rgba(var(--theme-rgb, 255,106,19), .30); --accent-ink: #ffffff;
  --grad: linear-gradient(135deg, var(--theme-accent, #ff6a13), color-mix(in srgb, var(--theme-accent, #ff6a13) 72%, #000));
  --gold: var(--theme-accent, #ff6a13);
  --green: #34d399; --green-soft: rgba(52, 211, 153, .13); --red: #f87171; --red-soft: rgba(248, 113, 113, .13);
  --orange: #fbbf24; --orange-soft: rgba(251, 191, 36, .13); --blue: #60a5fa; --blue-soft: rgba(96, 165, 250, .13);
  --radius: 14px; --radius-sm: 10px;
  --font: 'Segoe UI', Roboto, Arial, sans-serif; --font-display: 'Segoe UI Semibold', 'Segoe UI', Roboto, Arial, sans-serif; --mono: 'Segoe UI', Roboto, Arial, sans-serif;
}
:root[data-light] {
  --bg: #eef0f3; --bg-soft: #f5f6f8; --panel: #ffffff; --card: #ffffff; --card-2: #f4f5f7; --hover: #e9ecf0;
  --line: rgba(15, 23, 42, .12); --line-2: rgba(15, 23, 42, .07);
  --text: #14181f; --text-2: #3f4753; --muted: #6b7380;
}
body { font-family: var(--font); background: var(--bg); }

/* Marque : logo engrenage à la place du monogramme doré */
.crt-logo, .brand-mark, .rv-ring span {
  background: url('../img/logo.svg') center/contain no-repeat !important; color: transparent !important;
  box-shadow: none !important; border: 0 !important; animation: none !important; font-size: 0 !important;
}
.crt-logo { width: 38px; height: 38px; border-radius: 0; }
.pos-brand-name { letter-spacing: .02em; }
.page-title, .modal-title, .th-title, .login-title, .kpi-value { font-family: var(--font-display); letter-spacing: -.01em; font-style: normal; }
.pos-topbar { background: linear-gradient(180deg, #14171c, #0f1216); border-bottom: 1px solid var(--line); box-shadow: inset 0 -2px 0 var(--accent); }
[data-light] .pos-topbar { background: linear-gradient(180deg, #1b1f26, #14171c); }
.sidebar { background: #0f1216; border-right: 1px solid var(--line); }
.kpi, .card { background: var(--card); border: 1px solid var(--line-2); box-shadow: none; }
.kpi.featured { background: var(--grad); }
.btn-gold { background: var(--grad); color: var(--on-accent, #fff); box-shadow: 0 8px 18px -10px var(--accent-glow); }
.badge.gold { color: var(--accent); background: var(--accent-soft); }

/* Langue : FR | EN */
.tb-lang { display: inline-flex; border: 1px solid rgba(255,255,255,.14); border-radius: 9px; overflow: hidden; flex-shrink: 0; }
.tb-lang button { all: unset; cursor: pointer; padding: 6px 9px; font: 700 11px var(--font); color: #aab2bd; letter-spacing: .04em; }
.tb-lang button.on { background: var(--accent); color: var(--on-accent, #fff); }
.tb-lang button:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }

/* Vente directe */
.pos.pos-direct { display: grid; grid-template-columns: minmax(0, 1fr) 400px; height: 100%; min-height: 0; }
.pos-direct .pos-left { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: none; }
.pos-direct .ticket { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); background: var(--panel); }
.pos-direct .catalog-bar { padding: 14px 18px 10px; display: flex; flex-direction: column; gap: 10px; }
.pos-direct .cats { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.cat-chip { display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0; padding: 8px 12px; min-height: 38px; border-radius: 10px; cursor: pointer;
  background: var(--card); border: 1px solid var(--line-2); color: var(--text-2); font: 600 12.5px var(--font); }
.cat-chip svg { width: 15px; height: 15px; }
.cat-chip span { font-size: 11px; color: var(--muted); }
.cat-chip:hover { background: var(--hover); }
.cat-chip.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent, #fff); }
.cat-chip.active span { color: inherit; opacity: .8; }
.stock-cats { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 12px; }
.pos-direct .products { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 18px 18px; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; align-content: start; }
.product { position: relative; display: flex; flex-direction: column; text-align: left; background: var(--card); border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; cursor: pointer; padding: 0; color: var(--text); transition: border-color .15s, transform .15s; }
.product:hover { border-color: var(--accent); transform: translateY(-1px); }
.product.flash { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.product.off { opacity: .55; }
.product .p-img { position: relative; aspect-ratio: 4/3; background: #20252c url('../img/piece.svg') center/44% no-repeat; }
[data-light] .product .p-img { background-color: #e9ecf0; }
.product .p-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product .p-img.noimg::before, .thumb.noimg::before { content: none !important; }
.product .p-body { padding: 10px 11px 11px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.product .p-name { font-weight: 600; font-size: 13px; line-height: 1.3; }
.p-ref { font-size: 11px; color: var(--muted); } .p-ref .low { color: var(--orange); }
.product .p-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: baseline; gap: 6px; padding-top: 4px; }
.product .p-price { font-weight: 700; color: var(--accent); font-size: 14px; }
.product .p-cat { font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product .p-qty { position: absolute; top: 8px; right: 8px; min-width: 24px; height: 24px; padding: 0 6px; display: grid; place-items: center; border-radius: 8px; background: var(--accent); color: var(--on-accent, #fff); font: 700 12px var(--font); }
.product .p-off { position: absolute; z-index: 2; top: 8px; left: 8px; padding: 3px 8px; border-radius: 7px; background: #b91c1c; color: #fff; font: 700 10.5px var(--font); }
.thumb { background: #20252c url('../img/piece.svg') center/56% no-repeat; }
.t-main-one { display: block; } .t-main-one .btn-pay { width: 100%; }
.t-actions.single { display: block; } .t-actions.single .t-act { width: 100%; }
.pos-direct .th-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pos-direct .th-top > div:first-child { flex: 1; }
.pos-direct .th-client { margin-top: 10px; cursor: pointer; }
.pos-direct .ticket-lines { flex: 1; min-height: 0; overflow-y: auto; }
.m-only { display: none !important; }
.m-cart[hidden] { display: none !important; }
.m-cart b { margin-left: auto; }

/* Clôture */
.cl-input { margin: 12px 0; font-size: 20px; text-align: center; height: 50px; }

/* Poste qui imprime */
#ap-badge { position: fixed; left: 14px; bottom: 14px; z-index: 90; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px;
  background: rgba(15,18,22,.92); border: 1px solid rgba(52,211,153,.5); color: #c9f5e4; font: 600 12px var(--font); pointer-events: none; }
#ap-badge span { width: 8px; height: 8px; border-radius: 50%; background: #34d399; }

/* Plusieurs tickets imprimés d'un coup : un par page */
@media print { #print-area .receipt + .receipt { break-before: page; } #ap-badge { display: none; } }

@media (max-width: 1100px) { .pos.pos-direct { grid-template-columns: minmax(0, 1fr) 340px; } }
@media (max-width: 768px) {
  .pos.pos-direct { display: block; position: relative; }
  .pos-direct .pos-left, .pos-direct .ticket { height: 100%; }
  .pos-direct[data-mview="menu"] .ticket { display: none; }
  .pos-direct[data-mview="ticket"] .pos-left { display: none; }
  .pos-direct .ticket { border-left: 0; }
  .pos-direct .products { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 6px 16px 80px; }
  .pos-direct .catalog-bar { padding: 12px 16px 8px; }
  .m-only { display: inline-flex !important; }
  .m-cart { display: flex; align-items: center; gap: 10px; position: absolute; left: 16px; right: 16px; bottom: 14px; min-height: 52px; padding: 0 16px; border: 0; border-radius: 12px; background: var(--grad); color: var(--on-accent, #fff); font: 700 14px var(--font); z-index: 5; }
  .m-cart svg { width: 20px; height: 20px; }
  .tb-lang button { padding: 6px 7px; }
}

/* Ajustements après contrôle à l'écran */
.pos-direct .pos-left { order: 1; } .pos-direct .ticket { order: 2; }
.pos-direct .catalog-bar .input-icon { position: relative; width: 100%; max-width: none; }
.pos-direct .catalog-bar .input { width: 100%; }
.product .p-price { background: none !important; border: 0 !important; padding: 0 !important; white-space: nowrap; box-shadow: none !important; }
.btn-pay, .btn.btn-gold.btn-pay { background: var(--grad) !important; color: var(--on-accent, #fff) !important; border: 0; }
.btn-pay * { color: var(--on-accent, #fff) !important; }
.pos-direct .ticket-head .eyebrow, .pos-direct .l-total, .sum-total .val { color: var(--accent); }
.grid.grid-21 { grid-template-columns: minmax(0, 1fr) 300px; }
.kpi.featured, .kpi.featured * { color: var(--on-accent, #fff) !important; }
.kpi.featured .kpi-ico { background: rgba(255,255,255,.18); border-color: transparent; }
.eyebrow, .login-title em, .brand-sub, .hero-clock small, .gold { color: var(--accent); }
.login { background: #0b0d10; }
.ab-hero-chip { color: var(--accent); }
@media (max-width: 1100px) { .grid.grid-21 { grid-template-columns: minmax(0, 1fr); } }
.pos-direct .catalog-bar { flex: none; align-items: stretch; }
.pos-direct .catalog-bar .input-icon { flex: none; height: 44px; }
.pos-direct .cats { flex: none; width: 100%; justify-content: flex-start; flex-wrap: nowrap; }

/* Connexion CREITIC : noir, jaune, blanc */
.login { --accent: #FFD400; --accent-2: #F5B800; --accent-soft: rgba(255,212,0,.14); --accent-glow: rgba(255,212,0,.38); --line: rgba(255,212,0,.26);
  --grad: linear-gradient(135deg, #FFE680, #FFD400 45%, #F5B800); background: #070707; color: #fff; }
.login .login-users { background: radial-gradient(900px 500px at 100% 100%, rgba(255,212,0,.05), transparent 65%), #070707; }
.login .btn-gold, .login .btn-gold * { color: #111 !important; }
.login .eyebrow, .login .login-title em, .login .ab-eyebrow { color: #FFD400; }
.login .user-card { background: #131313; border-color: rgba(255,255,255,.09); }
.login .user-card:hover, .login .user-card.active { border-color: #FFD400; }
.login .pin-panel { background: #0e0e0e; border-color: rgba(255,212,0,.22); }
.login .pin-dot.filled { background: #FFD400; border-color: #FFD400; }
.login-hero { position: relative; overflow: hidden; isolation: isolate; background:
  radial-gradient(620px 440px at 50% 45%, rgba(255,212,0,.24), transparent 65%), linear-gradient(160deg, #1a1602, #0c0a02 55%, #050505) !important; border-color: rgba(255,212,0,.22) !important; }
.login-hero > :not(.lg-illu) { position: relative; z-index: 2; }
.login-hero .brand-mark { width: 64px; height: 64px; background: url('../img/logo-creitic.svg') center/contain no-repeat !important; }
.login-hero .brand-name { font-weight: 800; letter-spacing: .12em; color: #fff; }
.login-hero .brand-sub, .hero-clock small { color: #FFD400 !important; }
.hero-clock { text-align: center; text-shadow: 0 2px 18px rgba(0,0,0,.85); } .hero-date { text-align: center; color: #fff !important; text-shadow: 0 1px 8px #000; }
.lg-illu { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.lg-disc { position: absolute; left: 50%; top: 47%; width: min(74%, 340px); transform: translate(-50%, -50%); filter: drop-shadow(0 0 34px rgba(255,212,0,.45)); opacity: .82; }
.lg-spin { animation: lgSpin 26s linear infinite; transform-origin: 0 0; }
.lg-part { position: absolute; animation: lgFloat 6s ease-in-out infinite; filter: drop-shadow(0 6px 12px rgba(0,0,0,.6)); }
.lg-part.p1 { width: 50px; left: 12%; top: 22%; } .lg-part.p2 { width: 54px; right: 12%; top: 20%; animation-delay: -2s; }
.lg-part.p3 { width: 24px; left: 13%; top: 58%; transform: rotate(-20deg); animation-delay: -3.5s; } .lg-part.p4 { width: 44px; right: 13%; top: 60%; animation-delay: -1s; }
.lg-rev { position: absolute; left: 8%; right: 8%; width: 84%; bottom: 21%; opacity: .75; filter: drop-shadow(0 0 7px rgba(255,212,0,.7)); }
@keyframes lgSpin { to { transform: rotate(360deg); } }
@keyframes lgFloat { 50% { translate: 0 -12px; } }
@media (prefers-reduced-motion: reduce) { .lg-spin, .lg-part { animation: none; } }
.login .avatar { background: linear-gradient(135deg, #FFE680, #F5B800) !important; color: #111 !important; }

/* Scène animée de connexion */
.lg-illu svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.lg-illu [class^="lg-"] { transform-box: fill-box; transform-origin: center; }
.lg-illu .lg-spin { animation: lgSpin 9s linear infinite; transform-origin: center; }
.lg-spinr { animation: lgSpin 6s linear infinite reverse; }
.lg-ring { animation: lgSpin 40s linear infinite reverse; }
.lg-pulse { animation: lgPulse 3s ease-in-out infinite; }
.lg-caliper { filter: drop-shadow(0 0 8px rgba(255,212,0,.6)); }
.lg-piston { animation: lgPiston 1.1s ease-in-out infinite alternate; }
.lg-illu .lg-spring { transform-origin: top; animation: lgSpring 1.8s ease-in-out infinite alternate; }
.lg-rod { animation: lgRod 1.8s ease-in-out infinite alternate; }
.lg-illu .lg-rock { animation: lgRock 4s ease-in-out infinite; transform-origin: top; }
.lg-zap { animation: lgZap 1.3s steps(1) infinite; filter: drop-shadow(0 0 8px #FFD400); }
.lg-float { animation: lgFloat 5s ease-in-out infinite var(--d, 0s); }
.lg-illu .lg-wrench { animation: lgWrench 3.2s ease-in-out infinite; transform-origin: 100% 0; }
.lg-revl { stroke-dasharray: 34 66; animation: lgRev 2.6s linear infinite; filter: drop-shadow(0 0 7px #FFD400); }
.lg-p { animation: lgRise 8s linear infinite; }
@keyframes lgPulse { 50% { opacity: .45; transform: scale(1.08); } }
@keyframes lgPiston { to { transform: translateY(42px); } }
@keyframes lgSpring { to { transform: scaleY(.68); } }
@keyframes lgRod { to { transform: translateY(-30px); } }
@keyframes lgRock { 50% { transform: rotate(5deg); } }
@keyframes lgZap { 0%, 55% { opacity: 0; } 60%, 75% { opacity: 1; } 80% { opacity: .1; } 88% { opacity: 1; } }
@keyframes lgWrench { 50% { transform: rotate(-24deg); } }
@keyframes lgRev { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes lgRise { 0% { transform: translateY(0); opacity: 0; } 12% { opacity: .9; } 100% { transform: translateY(-640px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .lg-illu * { animation: none !important; } }
.lg-illu .lg-p { transform-box: view-box; }

/* Sélecteur de thèmes : grande liste */
.theme-pop { max-height: min(70vh, 560px); overflow-y: auto; }
.theme-section { font: 700 11px var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 10px 0 8px; }
.theme-name { text-align: center; font-size: 10.5px; line-height: 1.2; }
.theme-swatch-wrap.selected .theme-swatch { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-swatch-wrap.selected .theme-name { color: var(--accent); }

/* Thèmes clairs : fond, textes et surfaces lisibles partout */
:root[data-light] body, :root[data-light] .crt-root, :root[data-light] .main, :root[data-light] .view, :root[data-light] .pos-left { background: var(--bg) !important; }
:root[data-light] .bg-layer { background: var(--bg) !important; }
:root[data-light] .view :is(.page-title, .kpi-value, .kpi-value small, .cell-title, .strong, .rank-name, .modal-title, .th-title, .card-title, h1, h2, h3, h4, td, th, label, .t) { color: var(--text); }
:root[data-light] .kpi.featured .kpi-value, :root[data-light] .kpi.featured .kpi-value small { color: var(--on-accent) !important; }
:root[data-light] .btn:not(.btn-gold):not(.btn-danger), :root[data-light] .btn-icon, :root[data-light] .tabs, :root[data-light] .tab, :root[data-light] .input, :root[data-light] .select { background: #fff; color: var(--text); border-color: var(--line); }
:root[data-light] .tab.active { background: var(--accent); color: var(--on-accent); }
:root[data-light] .ticket-head, :root[data-light] .ticket-foot, :root[data-light] .ticket { background: var(--panel); color: var(--text); }
:root[data-light] .modal, :root[data-light] .modal-body, :root[data-light] .modal-foot, :root[data-light] .modal-head { background: var(--panel); color: var(--text); }
:root[data-light] .page { background: var(--bg) !important; }
:root[data-light] .pos-topbar { background: #fff; box-shadow: inset 0 -2px 0 var(--accent); }
:root[data-light] .pos-topbar .pos-brand-name, :root[data-light] .nav-btn, :root[data-light] .tb-clock, :root[data-light] .tb-clock b, :root[data-light] .tb-icon { color: #14181f !important; }
:root[data-light] .tb-lang { border-color: var(--line); } :root[data-light] .tb-lang button:not(.on) { color: #14181f; }
:root[data-light] .sidebar { background: #fff; } :root[data-light] .sidebar-item-label, :root[data-light] .sf-ver { color: #14181f; }
