/* css/app.css — NuanceOS — Styles principaux */

/* ================================================================
   VARIABLES & RESET
================================================================ */

:root {
  --header-h: 64px;
  --tabs-h: 52px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  --text: #1a1a1a;
  --text-muted: #888;
  --border: #e8e8e8;
  --bg: #f2f2f7;
  --surface: #fff;
  --surface-hover: #f5f5f5;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.14);
  --transition: .18s ease;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  line-height: 1;
}

input {
  font-family: inherit;
  font-size: inherit;
  border: none;
  outline: none;
}

.hidden { display: none !important; }

/* ================================================================
   HEADER
================================================================ */

#app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: calc(var(--header-h) + var(--safe-top));
  padding-top: var(--safe-top);
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: calc(16px + var(--safe-left));
  padding-right: calc(16px + var(--safe-right));
}

.header-left {
  flex: 0 0 auto;
}

#app-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.3px;
  white-space: nowrap;
}

.header-center {
  flex: 1 1 auto;
}

#search-input {
  width: 100%;
  height: 40px;
  background: var(--bg);
  border-radius: 10px;
  padding: 0 16px;
  font-size: 15px;
  color: var(--text);
  transition: box-shadow var(--transition);
}

#search-input:focus {
  box-shadow: 0 0 0 3px rgba(0,125,255,.2);
}

#search-input::placeholder {
  color: var(--text-muted);
}

.header-right {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

.lock-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: var(--text-muted);
  transition: background var(--transition);
}

.lock-btn:active {
  background: var(--bg);
}

.cart-btn {
  position: relative;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: var(--text);
  transition: background var(--transition);
}

.cart-btn:active {
  background: var(--bg);
}

.cart-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #ff3b30;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.cart-btn.cart-pulse {
  animation: cartPulse .4s ease;
}

.cart-badge.badge-bounce {
  animation: badgeBounce .4s ease;
}

@keyframes cartPulse {
  0%, 100% { transform: scale(1); }
  40% { transform: scale(1.2); }
}

@keyframes badgeBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.4); }
}

/* ================================================================
   ONGLETS
================================================================ */

#brand-tabs {
  position: fixed;
  top: calc(var(--header-h) + var(--safe-top));
  left: 0;
  right: 0;
  z-index: 99;
  height: var(--tabs-h);
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  padding: 0 calc(16px + var(--safe-left)) 0 calc(16px + var(--safe-right));
  gap: 4px;
}

.tab {
  flex: 0 0 auto;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  border-bottom: 2px solid transparent;
}

.tab:active {
  background: var(--bg);
}

.tab.active {
  color: var(--tab-color, var(--text));
  border-bottom-color: var(--tab-color, var(--text));
  font-weight: 600;
}

/* ================================================================
   BANNERS
================================================================ */

#offline-banner,
#error-banner {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 98;
  top: calc(var(--header-h) + var(--tabs-h) + var(--safe-top));
  background: #ff3b30;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

#error-banner {
  background: #ff9500;
}

#retry-btn {
  background: rgba(255,255,255,.3);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

#retry-btn:active {
  background: rgba(255,255,255,.5);
}

/* ================================================================
   CATALOGUE — GRILLE PRODUITS
================================================================ */

#catalog-view {
  position: fixed;
  top: calc(var(--header-h) + var(--tabs-h) + var(--safe-top));
  left: 0;
  right: 0;
  bottom: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px calc(16px + var(--safe-right)) calc(16px + var(--safe-bottom)) calc(16px + var(--safe-left));
}

.product-grid {
  display: grid;
  gap: 8px;
  /* 6 colonnes paysage, 4 portrait */
  grid-template-columns: repeat(6, 1fr);
}

@media (orientation: portrait) {
  .product-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 600px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---- Carte produit ---- */

.product-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
  user-select: none;
}

.product-card:active {
  transform: scale(.97);
  box-shadow: none;
}

.product-card.card-add-pulse {
  animation: cardPulse .35s ease;
}

@keyframes cardPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

.card-image-wrapper {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--bg);
  overflow: hidden;
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-image-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #e8e8e8 0%, #d0d0d0 100%);
}

.brand-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  padding: 2px 5px;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .3px;
  text-transform: uppercase;
}

.card-body {
  padding: 6px 8px 8px;
}

.card-title {
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  color: var(--text);
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.card-price {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.variant-hint {
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 10px;
}

/* ---- Skeleton loading ---- */

.skeleton .skeleton-img {
  aspect-ratio: 1 / 1;
  background: linear-gradient(90deg, #e8e8e8 25%, #f0f0f0 50%, #e8e8e8 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

.skeleton .skeleton-body {
  padding: 10px 12px 12px;
}

.skeleton-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #e8e8e8 25%, #f0f0f0 50%, #e8e8e8 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  margin-bottom: 8px;
}

.skeleton-line.short {
  width: 50%;
  margin-bottom: 0;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 60px 0;
  font-size: 16px;
}

/* ================================================================
   OVERLAY
================================================================ */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 199;
  background: rgba(0,0,0,.4);
  animation: fadeIn .2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ================================================================
   DRAWER PANIER
================================================================ */

#cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  width: min(420px, 88vw);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  box-shadow: var(--shadow-lg);
  padding-right: var(--safe-right);
  padding-bottom: var(--safe-bottom);
}

#cart-drawer.open {
  transform: translateX(0);
}

.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(16px + var(--safe-top)) 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.cart-header h2 {
  font-size: 20px;
  font-weight: 700;
}

#close-cart-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

#close-cart-btn:active {
  background: var(--border);
}

.cart-content {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 0;
}

.cart-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 0;
  font-size: 15px;
}

/* ---- Section par marque ---- */

.cart-section {
  margin-bottom: 8px;
}

.cart-section-header {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 8px 20px;
  background: var(--bg);
}

/* ---- Ligne d'article ---- */

.cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  min-height: 72px;
}

.item-thumb {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
}

.item-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-thumb-placeholder {
  width: 100%;
  height: 100%;
  background: var(--bg);
}

.item-info {
  flex: 1 1 auto;
  min-width: 0;
}

.item-title {
  font-size: 13px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.item-unit-price {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.item-qty-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.qty-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-weight: 400;
}

.qty-btn:active {
  background: var(--border);
}

.qty-value {
  width: 24px;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
}

.item-line-total {
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 600;
  text-align: right;
  min-width: 60px;
}

.item-delete-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: #ff3b30;
  display: flex;
  align-items: center;
  justify-content: center;
}

.item-delete-btn:active {
  background: #fff0ee;
}

/* ---- Footer panier ---- */

.cart-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.cart-total-line {
  display: flex;
  justify-content: space-between;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 14px;
}

/* ================================================================
   BOUTONS COMMUNS
================================================================ */

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 52px;
  background: var(--text);
  color: #fff;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  transition: opacity var(--transition);
}

.btn-primary:active {
  opacity: .8;
}

.btn-primary:disabled {
  background: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
}

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 52px;
  background: var(--bg);
  color: var(--text);
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 500;
  margin-top: 10px;
  transition: background var(--transition);
}

.btn-secondary:active {
  background: var(--border);
}

.btn-large {
  height: 56px;
  font-size: 17px;
}

/* ================================================================
   MODAL VARIANTES
================================================================ */

#variant-modal {
  position: fixed;
  inset: 0;
  z-index: 201;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: none;
}

#variant-modal:not(.hidden) {
  pointer-events: auto;
}

.modal-content {
  position: relative;
  background: var(--surface);
  border-radius: 20px;
  width: min(780px, 96vw);
  max-height: calc(100vh - 48px);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: modalIn .22s cubic-bezier(.34,1.56,.64,1);
}

@keyframes modalIn {
  from { transform: scale(.9) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg);
  font-size: 16px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:active {
  background: var(--border);
}

/* ---- Layout interne modal variantes ---- */

.variant-modal-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-height: calc(100vh - 100px);
}

@media (orientation: portrait) and (max-width: 600px) {
  .variant-modal-layout {
    grid-template-columns: 1fr;
  }
}

.variant-modal-image-col {
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.variant-main-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  max-height: 500px;
}

.variant-image-placeholder {
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(135deg, #e8e8e8, #d0d0d0);
}

.variant-modal-info-col {
  padding: 28px 28px 28px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.variant-brand-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: .4px;
  width: fit-content;
}

.variant-product-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
}

.variant-price {
  font-size: 26px;
  font-weight: 800;
}

.variant-stock-info {
  font-size: 13px;
  color: #ff9500;
  min-height: 18px;
}

.variant-stock-info.out-of-stock {
  color: #e74c3c;
  font-weight: 500;
}

.variant-option-group {
  margin-bottom: 4px;
}

.option-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.option-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.option-btn {
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: 2px solid var(--border);
  font-size: 14px;
  font-weight: 500;
  background: var(--surface);
  transition: border-color var(--transition), background var(--transition);
}

.option-btn:active {
  background: var(--bg);
}

.option-btn.active {
  border-color: var(--text);
  background: var(--text);
  color: #fff;
}

/* ================================================================
   MODAL ENCAISSEMENT (plein écran)
================================================================ */

#checkout-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

#checkout-modal-body {
  background: var(--surface);
  border-radius: 24px;
  width: min(860px, 96vw);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: modalIn .22s cubic-bezier(.34,1.56,.64,1);
  padding: 32px;
}

/* ---- Étapes communes ---- */

.checkout-step {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.checkout-step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.checkout-step-header h2 {
  font-size: 22px;
  font-weight: 700;
}

.checkout-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg);
  font-size: 16px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.checkout-close-btn:active {
  background: var(--border);
}

/* ---- Étape 1 : choix paiement ---- */

.checkout-brands-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.checkout-brands-row:has(.checkout-brand-block:nth-child(2)) {
  grid-template-columns: 1fr 1fr;
}

.checkout-brand-block {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.checkout-brand-title {
  font-size: 17px;
  font-weight: 700;
}

.payment-method-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.payment-method-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 16px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: 15px;
  font-weight: 500;
  transition: border-color var(--transition), background var(--transition);
}

.payment-method-btn:active {
  background: var(--bg);
}

.payment-method-btn.active {
  border-color: var(--text);
  background: var(--text);
  color: #fff;
}

.pm-icon {
  font-size: 18px;
}

/* ---- Étape 2 : paiement carte ---- */

.step-card-payment {
  align-items: center;
  text-align: center;
  padding: 20px 0;
}

.payment-brand-name {
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.payment-amount-display {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -1px;
}

.payment-instruction {
  font-size: 17px;
  color: var(--text-muted);
  line-height: 1.4;
}

.payment-spinner-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.payment-status-msg {
  font-size: 14px;
  color: var(--text-muted);
}

/* ---- Étape 2 : paiement espèces ---- */

.step-cash-payment {
  align-items: center;
  text-align: center;
}

.cash-form {
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cash-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: left;
}

.cash-input {
  width: 100%;
  height: 56px;
  background: var(--bg);
  border-radius: 12px;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  padding: 0 16px;
  border: 2px solid var(--border);
  transition: border-color var(--transition);
}

.cash-input:focus {
  border-color: var(--text);
}

.change-display {
  height: 24px;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}

.change-ok { color: #34c759; }
.change-short { color: #ff3b30; }

/* ---- Étape 3 : erreur ---- */

.step-error {
  align-items: center;
  text-align: center;
  padding: 20px 0;
}

.error-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #ff3b30;
  color: #fff;
  font-size: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.error-brand-name {
  font-size: 16px;
  font-weight: 700;
}

.error-msg {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 380px;
}

.error-actions {
  width: 100%;
  max-width: 320px;
}

/* ---- Chargement ---- */

.step-loading {
  align-items: center;
  padding: 48px 0;
  gap: 20px;
  color: var(--text-muted);
}

/* ---- Récapitulatif ---- */

.step-summary {
  align-items: center;
  text-align: center;
  gap: 24px;
}

.success-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #34c759;
  color: #fff;
  font-size: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.summary-title {
  font-size: 24px;
  font-weight: 800;
}

.summary-brands {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.summary-brand-row {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 16px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.summary-brand-name {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.summary-brand-detail {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.summary-sumup-ref {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.summary-order-ok {
  font-size: 14px;
  color: #34c759;
  font-weight: 500;
}

.summary-order-warn {
  font-size: 13px;
  color: #ff9500;
  font-weight: 500;
  background: #fff8ed;
  border-radius: 8px;
  padding: 8px 12px;
}

.summary-email-row {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 480px;
  align-items: center;
}

.summary-email-input {
  flex: 1;
  height: 48px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}

.summary-email-input:focus {
  border-color: var(--text);
}

.summary-email-btn {
  white-space: nowrap;
  height: 48px;
  padding: 0 18px;
}

/* ================================================================
   SPINNERS
================================================================ */

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.spinner-large {
  width: 56px;
  height: 56px;
  border-width: 4px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ================================================================
   TOASTS
================================================================ */

.toast-container {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 400;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: #1a1a1a;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(12px) scale(.95);
  transition: opacity .2s ease, transform .2s ease;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast.toast-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast.toast-error {
  background: #ff3b30;
}

.toast.toast-success {
  background: #34c759;
}

/* ================================================================
   ÉTATS GLOBAUX (overflow lock)
================================================================ */

body.drawer-open,
body.modal-open {
  overflow: hidden;
}

/* ================================================================
   ÉCRAN DE VERROUILLAGE PIN
================================================================ */

#lock-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--safe-top)) calc(24px + var(--safe-right))
           calc(24px + var(--safe-bottom)) calc(24px + var(--safe-left));
}

#lock-screen.visible {
  display: flex;
}

.lock-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 320px;
}

/* Nom de l'app */
.lock-app-name {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.5px;
  color: var(--text);
  margin-bottom: 8px;
}

/* Message d'erreur */
.lock-error-msg {
  min-height: 22px;
  font-size: 14px;
  font-weight: 500;
  color: #ff3b30;
  text-align: center;
}

/* Points PIN */
.lock-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 22px;
}

.lock-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  transition: background .12s ease, border-color .12s ease, transform .12s ease;
}

.lock-dot.filled {
  background: var(--text);
  border-color: var(--text);
  transform: scale(1.1);
}

/* Animation de secousse */
@keyframes lockShake {
  0%, 100% { transform: translateX(0); }
  15%  { transform: translateX(-10px); }
  30%  { transform: translateX(9px); }
  45%  { transform: translateX(-8px); }
  60%  { transform: translateX(7px); }
  75%  { transform: translateX(-5px); }
  90%  { transform: translateX(3px); }
}

.lock-dots.shake {
  animation: lockShake .6s cubic-bezier(.36,.07,.19,.97);
}

/* Pavé numérique */
.lock-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
}

.lock-key,
.lock-key-spacer {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 88px;
  max-height: 88px;
  margin: 0 auto;
}

.lock-key {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg);
  font-size: 26px;
  font-weight: 400;
  color: var(--text);
  transition: background .12s ease, transform .08s ease;
  user-select: none;
  -webkit-user-select: none;
}

.lock-key:active {
  background: var(--border);
  transform: scale(.93);
}

.lock-key-back {
  font-size: 22px;
  color: var(--text-muted);
}

/* Panneau de blocage temporaire */
.lock-lockout-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  padding: 8px 0;
}

.lock-lockout-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.lock-lockout-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.lock-countdown {
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #ff3b30;
  letter-spacing: .5px;
}

/* Mention de version */
.lock-version {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ================================================================
   MODE EXCEL — STYLES
================================================================ */

/* ---- Bouton Excel dans le header ---- */

.excel-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: #1d7a3a;
  transition: background var(--transition);
}

.excel-btn:active {
  background: var(--bg);
}

/* ---- Badge Excel sur les onglets ---- */

.tab-excel-badge {
  display: inline-block;
  font-size: 11px;
  color: #1d7a3a;
  margin-left: 4px;
  vertical-align: middle;
  line-height: 1;
}

/* ---- Bannière d'erreur IndexedDB ---- */

#excel-error-banner {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 98;
  top: calc(var(--header-h) + var(--tabs-h) + var(--safe-top));
  background: #ff9500;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  padding: 10px 16px;
}

/* ---- Indicateur de backend dans l'encaissement ---- */

.backend-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 8px;
  vertical-align: middle;
}

.excel-chip {
  background: #e6f4ea;
  color: #1d7a3a;
}

.shopify-chip {
  background: #e8f0fd;
  color: #334FB4;
}

/* ---- Résumé de vente — ligne Excel ---- */

.summary-excel-ref {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}

/* ---- Bouton "Copier les détails" ---- */

.btn-copy-details {
  display: inline-flex;
  align-items: center;
  margin-top: 8px;
  padding: 6px 14px;
  background: rgba(255,149,0,.15);
  border: 1px solid #ff9500;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #cc7a00;
}

.btn-copy-details:active {
  background: rgba(255,149,0,.3);
}

/* ================================================================
   MODAL GESTION EXCEL
================================================================ */

#excel-modal {
  position: fixed;
  inset: 0;
  z-index: 201;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: none;
}

#excel-modal:not(.hidden) {
  pointer-events: auto;
}

.excel-modal-content {
  width: min(600px, 96vw);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.excel-modal-inner {
  padding: 28px 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.excel-modal-loading {
  display: flex;
  justify-content: center;
  padding: 48px;
}

.excel-modal-title {
  font-size: 20px;
  font-weight: 700;
}

.excel-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
}

.excel-current-stats {
  display: flex;
  gap: 16px;
}

.excel-stat {
  flex: 1;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.excel-stat-value {
  font-size: 22px;
  font-weight: 800;
}

.excel-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.excel-no-data {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  padding: 12px 0;
}

.excel-month-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.excel-month-row:last-child {
  border-bottom: none;
}

.excel-month-label {
  font-size: 15px;
  font-weight: 600;
  text-transform: capitalize;
}

.excel-month-stats {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.excel-month-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn-excel-dl {
  padding: 8px 14px;
  background: #1d7a3a;
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: opacity var(--transition);
}

.btn-excel-dl:active {
  opacity: .8;
}

.btn-excel-del {
  padding: 8px 14px;
  background: var(--bg);
  color: #ff3b30;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid #ff3b30;
  transition: background var(--transition);
}

.btn-excel-del:active {
  background: #fff0ee;
}

.excel-warning {
  background: #fff8ed;
  border: 1px solid #ffcc80;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  color: #7a5000;
  line-height: 1.4;
}

.excel-error-state {
  text-align: center;
  color: #ff3b30;
  padding: 32px 0;
  font-size: 14px;
}

/* ================================================================
   FOND DE CAISSE
================================================================ */

/* ---- Bouton header ---- */

.cash-register-btn {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: var(--text-muted);
  transition: background var(--transition);
}

.cash-register-btn:active {
  background: var(--bg);
}

/* Badge statut (point coloré en haut à droite du bouton) */
.cr-status-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.85);
}

.cr-dot-green  { background: #34c759; }
.cr-dot-orange { background: #ff9500; }
.cr-dot-red    { background: #ff3b30; }

/* ---- Bannière session non clôturée ---- */

#stale-session-banner {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 98;
  top: calc(var(--header-h) + var(--tabs-h) + var(--safe-top));
  background: #ff9500;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  padding: 10px 16px;
  cursor: pointer;
}

#stale-session-banner:active {
  opacity: .85;
}

/* ---- Config warning banner ---- */

#config-warning-banner {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 98;
  top: calc(var(--header-h) + var(--tabs-h) + var(--safe-top));
  background: #ff9500;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  padding: 10px 16px;
}

/* ---- Modal fond de caisse ---- */

#cash-register-modal {
  position: fixed;
  inset: 0;
  z-index: 201;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: none;
}

#cash-register-modal:not(.hidden) {
  pointer-events: auto;
}

.cr-modal-content {
  width: min(900px, 96vw);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ---- Structure interne ---- */

.cr-modal-inner {
  padding: 28px 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.cr-loading {
  display: flex;
  justify-content: center;
  padding: 48px;
}

.cr-modal-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.cr-modal-title {
  font-size: 20px;
  font-weight: 700;
}

.cr-history-global-btn {
  padding: 8px 14px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: background var(--transition);
}

.cr-history-global-btn:active {
  background: var(--border);
}

/* ---- Colonnes marques ---- */

.cr-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.cr-columns.cr-single-col {
  grid-template-columns: 1fr;
  max-width: 420px;
}

@media (max-width: 600px) {
  .cr-columns { grid-template-columns: 1fr; }
}

.cr-column {
  background: var(--bg);
  border-radius: var(--radius);
  overflow: hidden;
}

.cr-col-header {
  padding: 14px 16px;
  background: var(--surface);
  border-left: 4px solid transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}

.cr-brand-name {
  font-size: 15px;
  font-weight: 700;
}

.cr-status {
  font-size: 12px;
  font-weight: 500;
}

.cr-status-open   { color: #34c759; }
.cr-status-closed { color: var(--text-muted); }

.cr-col-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cr-closed-msg {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
}

.cr-default-amount {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

/* ---- Montant théorique ---- */

.cr-theoretical-box {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  text-align: center;
}

.cr-theoretical-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 4px;
}

.cr-theoretical-amount {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.5px;
}

/* ---- Ventilation ---- */

.cr-breakdown {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cr-breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.cr-breakdown-row:last-child { border-bottom: none; }

.cr-amount-pos { color: #34c759; font-weight: 600; }
.cr-amount-neg { color: #ff3b30; font-weight: 600; }

/* ---- Boutons d'action dans la colonne ---- */

.cr-col-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.cr-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  background: var(--text);
  color: #fff;
  transition: opacity var(--transition);
}

.cr-action-btn:active { opacity: .8; }

.cr-btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.cr-btn-secondary:active { background: var(--bg); }

.cr-btn-danger {
  background: var(--bg);
  color: #ff3b30;
  border: 1px solid #ff3b30;
}

.cr-btn-danger:active { background: #fff0ee; }

.cr-action-row-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ---- Sous-écrans ---- */

.cr-subscreen-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cr-back-btn {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.cr-back-btn:active { color: var(--text); }

.cr-subscreen-title {
  font-size: 18px;
  font-weight: 700;
}

.cr-subscreen-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 400px;
  margin: 0 auto;
  width: 100%;
}

.cr-open-prompt {
  font-size: 16px;
  text-align: center;
  color: var(--text-muted);
}

/* ---- Champ montant ---- */

.cr-amount-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.cr-amount-input {
  width: 100%;
  height: 60px;
  background: var(--bg);
  border-radius: 12px;
  border: 2px solid var(--border);
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  padding: 0 48px 0 16px;
  color: var(--text);
  transition: border-color var(--transition);
}

.cr-amount-input:focus { border-color: var(--text); }

.cr-currency {
  position: absolute;
  right: 16px;
  font-size: 18px;
  font-weight: 500;
  color: var(--text-muted);
  pointer-events: none;
}

/* ---- Champs note ---- */

.cr-note-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cr-note-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.cr-note-input {
  height: 48px;
  background: var(--bg);
  border-radius: 10px;
  border: 2px solid var(--border);
  padding: 0 14px;
  font-size: 15px;
  color: var(--text);
  transition: border-color var(--transition);
}

.cr-note-input:focus { border-color: var(--text); }

.cr-note-textarea {
  background: var(--bg);
  border-radius: 10px;
  border: 2px solid var(--border);
  padding: 10px 14px;
  font-size: 15px;
  color: var(--text);
  resize: none;
  font-family: inherit;
  transition: border-color var(--transition);
}

.cr-note-textarea:focus { border-color: var(--text); outline: none; }

/* ---- Écran de clôture ---- */

.cr-close-theoretical {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: 16px;
}

.cr-close-theoretical strong {
  font-size: 22px;
  font-weight: 800;
}

.cr-close-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cr-discrepancy {
  min-height: 28px;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  transition: color var(--transition), background var(--transition);
}

.cr-disc-ok     { color: #34c759; }
.cr-disc-warn   { color: #ff9500; }
.cr-disc-danger { color: #ff3b30; background: #fff0ee; }

/* ---- Historique des mouvements ---- */

.cr-history-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
}

.cr-history-row {
  display: grid;
  grid-template-columns: 44px 1fr auto 32px;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.cr-history-row:last-child { border-bottom: none; }

.cr-history-opening {
  color: var(--text-muted);
  font-style: italic;
}

.cr-history-time {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.cr-history-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cr-history-amount {
  font-weight: 700;
  white-space: nowrap;
  text-align: right;
}

.cr-delete-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg);
  color: #ff3b30;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cr-delete-btn:active { background: #fff0ee; }
.cr-delete-placeholder { width: 28px; flex-shrink: 0; }

/* ---- Historique des sessions passées ---- */

.cr-sessions-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.cr-sessions-brand {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cr-sessions-brand-title {
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.cr-global-stats {
  display: flex;
  gap: 10px;
}

.cr-stat-item {
  flex: 1;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cr-stat-val {
  font-size: 18px;
  font-weight: 800;
}

.cr-stat-lbl {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.cr-session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.cr-session-info { flex: 1; min-width: 0; }

.cr-session-date {
  font-size: 13px;
  font-weight: 600;
}

.cr-session-stats {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
}

.cr-session-disc {
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
}

.cr-sections-sep {
  border: none;
  border-top: 1px solid var(--border);
  margin: 4px 0;
}

.cr-no-sessions {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  padding: 16px 0;
}

/* ---- Avertissement caisse non ouverte (écran d'encaissement) ---- */

.step-cr-warning {
  align-items: center;
  text-align: center;
  padding: 20px 0;
}

.cr-warn-icon {
  font-size: 48px;
  line-height: 1;
}

.cr-warn-title {
  font-size: 22px;
  font-weight: 700;
}

.cr-warn-msg {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 380px;
  line-height: 1.5;
}

/* ================================================================
   VENTE LIBRE — CTA dans le catalogue
================================================================ */

.free-sale-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 24px;
  text-align: center;
  min-height: 360px;
}

.free-sale-cta-icon { opacity: .7; }

.free-sale-cta-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
}

.free-sale-cta-sub {
  font-size: 15px;
  color: var(--text-muted);
}

.free-sale-cta-btn {
  margin-top: 8px;
  min-width: 240px;
  padding: 16px 28px;
  font-size: 17px;
  font-weight: 600;
  border-radius: var(--radius);
  color: #fff;
}
.free-sale-cta-btn:active { filter: brightness(.9); }

/* ================================================================
   VENTE LIBRE — Modal
================================================================ */

.free-sale-modal-content {
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.fs-modal-inner { padding: 8px 0; }

.fs-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 24px;
}

.fs-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 8px;
  margin-top: 20px;
}

.fs-form { display: flex; flex-direction: column; }

.fs-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 17px;
  transition: border-color var(--transition);
}
.fs-input:focus { border-color: #334FB4; outline: none; }

.fs-amount-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.fs-amount-input { flex: 1; }
.fs-currency {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-muted);
}

.fs-qty-row {
  display: flex;
  align-items: center;
  gap: 16px;
}
.fs-qty-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border);
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fs-qty-btn:active { background: var(--surface-hover); }
.fs-qty-value {
  font-size: 22px;
  font-weight: 600;
  min-width: 36px;
  text-align: center;
}

.fs-separator {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

.fs-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 18px;
  font-weight: 600;
  padding: 0 4px;
}

.fs-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

/* Chips de descriptions fréquentes */
.fs-chips-label {
  font-size: 12px;
  color: var(--text-muted);
  margin: 10px 0 6px;
}
.fs-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}
.fs-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--transition);
}
.fs-chip:active { background: var(--bg); }
.fs-chip-del {
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1;
  padding: 0 2px;
}
.fs-chip-del:hover { color: #e74c3c; }

/* Panier — item vente libre */
.cart-item-free .item-thumb {
  background: #f8f4ff;
  border-radius: var(--radius-sm);
}
.item-thumb-free {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7b5ea7;
}
.item-free-label {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

/* ================================================================
   RAPPORT DRIVE — Prompt dans la modal fond de caisse
================================================================ */

.cr-report-prompt-icon {
  font-size: 48px;
  margin-bottom: 12px;
  text-align: center;
}

.cr-report-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.cr-drive-links {
  font-size: 14px;
  color: var(--text-muted);
  margin: 12px 0;
}
.cr-drive-link {
  color: #334FB4;
  text-decoration: none;
}
.cr-drive-link:hover { text-decoration: underline; }

/* Statistiques par marque dans la modal ventes */
.excel-brand-section { padding: 4px 0 8px; }
.excel-brand-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}
.excel-dl-row {
  margin-top: 10px;
}
.btn-excel-report {
  padding: 10px 18px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition);
}
.btn-excel-report:active { background: var(--surface-hover); }

/* ================================================================
   CYCLE JOURNALIER — INDICATEURS HEADER
================================================================ */

#day-status-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
}

.day-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  border-radius: 20px;
  padding: 4px 10px;
  height: 28px;
  white-space: nowrap;
  transition: background var(--transition);
}

.day-status-badge:active { background: var(--border); }

.day-status-sep {
  font-size: 11px;
  color: var(--border);
  font-weight: 300;
}

/* ================================================================
   CYCLE JOURNALIER — ONGLETS VERROUILLÉS
================================================================ */

.tab-locked {
  opacity: .45;
  cursor: default;
}

.tab-locked .tab-lock-icon {
  font-size: 11px;
  vertical-align: middle;
}

/* ================================================================
   CYCLE JOURNALIER — BANNIÈRE RAPPEL CLÔTURE
================================================================ */

#day-close-reminder {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 98;
  top: calc(var(--header-h) + var(--tabs-h) + var(--safe-top));
  background: #ff9500;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.reminder-close-link {
  background: rgba(255,255,255,.3);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}
.reminder-close-link:active { background: rgba(255,255,255,.5); }

/* ================================================================
   CYCLE JOURNALIER — ÉCRAN BLOQUANT (overlay plein écran)
================================================================ */

#day-cycle-screen {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--safe-top)) calc(24px + var(--safe-right))
           calc(24px + var(--safe-bottom)) calc(24px + var(--safe-left));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.dc-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 820px;
  text-align: center;
  animation: modalIn .28s cubic-bezier(.34,1.56,.64,1);
}

/* ---- Tutoriel premier lancement ---- */

.dc-welcome-screen {
  max-width: 460px;
}

.dc-welcome-logo {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -.5px;
  color: var(--text);
}

.dc-welcome-title {
  font-size: 22px;
  font-weight: 700;
}

.dc-welcome-sub {
  font-size: 16px;
  color: var(--text-muted);
}

.dc-welcome-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
}

.dc-welcome-step {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dc-step-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.dc-step-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 15px;
}

.dc-step-info strong {
  font-weight: 700;
}

.dc-step-info span {
  color: var(--text-muted);
  font-size: 13px;
}

.dc-welcome-btn {
  max-width: 340px;
}

/* ---- Écran ouverture de journée ---- */

.dc-open-day-screen {
  gap: 16px;
}

.dc-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.5px;
}

.dc-date {
  font-size: 17px;
  color: var(--text-muted);
  font-weight: 500;
}

.dc-subtitle {
  font-size: 20px;
  font-weight: 700;
}

.dc-subtitle-sub {
  font-size: 15px;
  color: var(--text-muted);
  max-width: 480px;
}

.dc-brands-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
  margin-top: 4px;
}

@media (max-width: 600px) {
  .dc-brands-row { grid-template-columns: 1fr; }
}

.dc-brand-block {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  text-align: left;
}

.dc-brand-block.dc-brand-open {
  opacity: .7;
}

.dc-brand-header {
  padding: 14px 16px;
  border-left: 4px solid transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}

.dc-brand-name {
  font-size: 16px;
  font-weight: 700;
}

.dc-brand-status {
  font-size: 12px;
  font-weight: 600;
}

.dc-status-open   { color: #34c759; }
.dc-status-closed { color: var(--text-muted); }
.dc-status-stale  { color: #ff9500; }

.dc-brand-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dc-brand-already-open {
  padding: 20px 16px;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: #34c759;
}

.dc-amount-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-muted);
}

.dc-amount-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.dc-amount-input {
  width: 100%;
  height: 52px;
  background: var(--bg);
  border-radius: 10px;
  border: 2px solid var(--border);
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  padding: 0 40px 0 12px;
  font-family: inherit;
  color: var(--text);
  transition: border-color var(--transition);
}

.dc-amount-input:focus { border-color: var(--text); outline: none; }

.dc-currency {
  position: absolute;
  right: 12px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-muted);
  pointer-events: none;
}

.dc-open-btn {
  height: 48px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  transition: opacity var(--transition);
}
.dc-open-btn:active { opacity: .82; }

.dc-open-both-btn {
  max-width: 380px;
  margin-top: 4px;
}

/* ---- Vue verrouillée dans le grid ---- */

.dc-locked-brand-view {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 56px 24px;
  text-align: center;
}

.dc-lock-icon { font-size: 48px; line-height: 1; opacity: .6; }

.dc-lock-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.dc-lock-msg {
  font-size: 15px;
  color: var(--text-muted);
  max-width: 400px;
  line-height: 1.5;
}

.dc-lock-amount-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 200px;
}

/* ---- Écran clôture rétroactive ---- */

.dc-pending-closure-screen {
  max-width: 500px;
}

.dc-warning-icon {
  font-size: 52px;
  font-weight: 800;
  color: #ff9500;
  line-height: 1;
}

.dc-warning-title {
  font-size: 24px;
  font-weight: 800;
}

.dc-warning-msg {
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1.5;
}

.dc-warning-sub {
  font-size: 14px;
  color: var(--text-muted);
}

.dc-closure-stats {
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.dc-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.dc-stat-row:last-child { border-bottom: none; }
.dc-stat-row strong { font-weight: 700; font-size: 16px; }

.dc-closure-form {
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}
