/* V-POS — Design system minimal (docs/06-design-system.md)
 * Tablette paysage 1280-1920px, cibles ≥48px, contraste AAA. */

:root {
  --color-bg:           #FAFBFC;
  --color-surface:      #FFFFFF;
  --color-surface-alt:  #F2F4F7;
  --color-text:         #0F172A;
  --color-text-muted:   #64748B;
  --color-border:       #E2E8F0;

  --color-primary:      #2563EB;
  --color-primary-hover:#1D4ED8;
  --color-success:      #10B981;
  --color-warning:      #F59E0B;
  --color-danger:       #EF4444;
  --color-cash:         #059669;
  --color-card:         #2563EB;

  --touch-tiny:  48px;
  --touch-small: 56px;
  --touch-med:   64px;
  --touch-prim:  72px;
  --touch-xl:    80px;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(15,23,42,0.05);
  --shadow-md: 0 4px 12px rgba(15,23,42,0.10);

  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
}

/* ========== Thème sombre ========== */
[data-theme="dark"] {
  --color-bg:           #0F172A;
  --color-surface:      #1E293B;
  --color-surface-alt:  #273449;
  --color-text:         #F1F5F9;
  --color-text-muted:   #94A3B8;
  --color-border:       #334155;

  --color-primary:      #6366F1;
  --color-primary-hover:#818CF8;
  --color-success:      #34D399;
  --color-warning:      #FBBF24;
  --color-danger:       #F87171;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.30);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.45);
}
/* Inputs en sombre : la couleur de fond s'adapte */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: var(--color-surface-alt);
  color: var(--color-text);
  border-color: var(--color-border);
}
/* La bannière "fond panier vide" et autres utilisent souvent var(--color-bg) */

/* Toggle thème clair/sombre intégré dans la status-bar (après Déconnecter) */
.btn-theme {
  margin-left: 4px;
  width: 40px; height: 40px;
  padding: 0;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: var(--radius-md);
  font-size: 18px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-theme:hover { background: var(--color-surface-alt); }

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  height: 100%; width: 100%;
  font-family: var(--font-body);
  font-size: 18px;
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}

button { font: inherit; border: none; cursor: pointer; background: none; color: inherit; }
input { font: inherit; }

/* --- STATUS BAR --- */
.status-bar {
  height: 40px; display: flex; align-items: center; padding: 0 16px;
  background: var(--color-surface); border-bottom: 1px solid var(--color-border);
  gap: 12px; font-size: 14px;
}
.status-bar .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--color-text-muted);
}
.status-bar.online .dot { background: var(--color-success); }
.status-bar.offline .dot { background: var(--color-warning); }
.status-bar.error .dot { background: var(--color-danger); }
.status-bar .spacer { flex: 1; }
.status-bar .cashier-name { font-weight: 600; }
.status-bar .btn-logout {
  height: 32px; padding: 0 12px; border-radius: 6px;
  background: var(--color-surface-alt);
  color: var(--color-text);
}

/* --- PIN LOGIN --- */
.pin-login {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-bg);
  flex-direction: column; gap: 24px;
}
.pin-login h1 {
  font-size: 28px; margin: 0;
}
.pin-dots { display: flex; gap: 12px; height: 40px; align-items: center; }
.pin-dots .dot {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--color-surface); border: 2px solid var(--color-border);
}
.pin-dots .dot.filled { background: var(--color-primary); border-color: var(--color-primary); }
.pin-dots .dot.error { background: var(--color-danger); border-color: var(--color-danger); animation: shake 300ms; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.pin-keypad {
  display: grid; grid-template-columns: repeat(3, var(--touch-xl));
  grid-gap: 12px;
}
.pin-keypad button {
  width: var(--touch-xl); height: var(--touch-xl);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: 28px; font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: transform 80ms ease;
}
.pin-keypad button:active { transform: scale(0.95); background: var(--color-surface-alt); }
.pin-keypad button.op { color: var(--color-text-muted); font-size: 16px; font-weight: 500; }
.pin-error { color: var(--color-danger); font-weight: 600; height: 24px; }
.pin-cashiers {
  display: flex; gap: 12px; flex-wrap: wrap; max-width: 500px; justify-content: center;
}
.pin-cashiers button {
  padding: 12px 20px; border-radius: var(--radius-md);
  background: var(--color-surface); box-shadow: var(--shadow-sm);
  font-weight: 600;
}
.pin-cashiers button.selected { outline: 3px solid var(--color-primary); }

/* --- MAIN LAYOUT (catalog + cart) --- */
.main-layout {
  display: grid;
  grid-template-columns: 200px 1fr 360px;
  height: calc(100vh - 40px);
  overflow: hidden;
}

/* Categories col */
.category-col {
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  padding: 12px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
}
.category-col button {
  display: flex; align-items: center; gap: 8px;
  min-height: var(--touch-small); padding: 0 12px;
  border-radius: var(--radius-md);
  border-left: 4px solid transparent;
  background: var(--color-surface-alt); font-weight: 600;
  text-align: left;
}
.category-col button.active {
  background: var(--color-surface); box-shadow: var(--shadow-sm);
}
.category-col button .icon { font-size: 22px; }

/* Catalog center */
.catalog-col {
  padding: 16px; overflow-y: auto; background: var(--color-bg);
}
.catalog-search {
  width: 100%; height: var(--touch-small); padding: 0 16px; margin-bottom: 12px;
  border-radius: var(--radius-md); background: var(--color-surface);
  border: 1px solid var(--color-border); font-size: 18px;
}
.catalog-toolbar {
  display: flex; gap: 12px; margin-bottom: 12px;
}
.catalog-search-wrap { position: relative; flex: 1; }
.catalog-search-wrap .catalog-search { width: 100%; margin-bottom: 0; padding-right: 44px; }
.catalog-search-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px;
  border: none; background: var(--color-border);
  color: var(--color-text-muted);
  border-radius: 50%;
  font-size: 22px; line-height: 1; font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.catalog-search-clear:hover { background: var(--color-text-muted); color: var(--color-surface); }
/* Masque la croix native (Chrome/Edge) pour notre bouton custom */
.catalog-search::-webkit-search-cancel-button { display: none; }
.catalog-sort {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  font-size: 16px;
  cursor: pointer;
  min-width: 170px;
}
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.product-card {
  background: var(--color-surface); border-radius: var(--radius-md);
  padding: 12px 14px; min-height: 120px;
  display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: var(--shadow-sm); border-left: 4px solid var(--color-border);
  transition: transform 80ms ease;
  text-align: left;
}
.product-card:active { transform: scale(0.97); }
.product-card .name { font-weight: 600; font-size: 18px; line-height: 1.25; }
.product-card .price { font-size: 22px; font-weight: 700; text-align: right; }

/* "dès" devant le prix mini d'un groupe de variantes */
.product-card .price .from {
  font-size: 12px; font-weight: 500; opacity: 0.8;
}

/* Badge "N variantes" en bas-droite des cartes-groupes */
.product-card.is-group .variants-badge {
  position: absolute;
  bottom: 8px; left: 8px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px; font-weight: 600;
}
.product-card.is-group:not(.has-image) .variants-badge {
  background: var(--color-text-muted);
}

/* Liste des variantes dans le modal */
.vpos-modal-variants { max-width: 560px; }
.variants-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
  max-height: 60vh; overflow-y: auto;
}
.variant-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  padding: 14px 10px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer; min-height: 90px;
  position: relative;
  font-family: inherit;
  color: var(--color-text);
}
.variant-card:hover:not(:disabled) {
  background: var(--color-surface);
  border-color: var(--color-primary);
}
.variant-card .variant-label { font-weight: 600; font-size: 16px; }
.variant-card .variant-price { font-size: 18px; font-weight: 700; }
.variant-card .variant-stock {
  position: absolute; top: 6px; right: 6px;
  font-size: 10px; font-weight: 600;
  padding: 2px 6px; border-radius: 999px;
  background: var(--color-warning); color: #92400E;
}
.variant-card.stock-out { opacity: 0.5; cursor: not-allowed; }
.variant-card.stock-out .variant-stock { background: var(--color-danger); color: #fff; }

/* Image de fond produit (Horus) : nom + prix lisibles via dégradé sombre en bas */
.product-card.has-image {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  min-height: 160px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.7);
}
.product-card.has-image .name,
.product-card.has-image .price { color: #fff; }
.product-card.has-image.stock-out { opacity: 0.55; }

/* Bouton catégorie avec image de fond */
.category-col .cat-btn.has-image {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.7);
  min-height: 64px;
}

/* ========== Install wizard (DB serveur vierge) ========== */
.install-wizard {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-bg);
  padding: 20px;
  z-index: 100;
  overflow-y: auto;
}
.install-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  padding: 32px 36px;
  width: 100%; max-width: 720px;
}
.install-header h1 { margin: 0 0 4px; font-size: 26px; }
.install-header p  { margin: 0 0 18px; color: var(--color-text-muted); }
.install-steps { display: flex; gap: 8px; margin-bottom: 8px; }
.install-step {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-border); color: var(--color-text-muted);
  font-weight: 700; font-size: 14px;
}
.install-step.active { background: #6366F1; color: #fff; transform: scale(1.1); }
.install-step.done   { background: #10B981; color: #fff; }
.install-pane h2 { margin: 18px 0 4px; font-size: 19px; }
.install-hint { margin: 0 0 16px; color: var(--color-text-muted); font-size: 14px; }
.install-pane label { display: block; margin-bottom: 14px; }
.install-pane label > span {
  display: block; font-size: 13px; font-weight: 600; color: var(--color-text-muted); margin-bottom: 6px;
}
.install-pane label > span em { font-style: normal; color: var(--color-warning); margin-left: 4px; font-weight: 500; font-size: 12px; }
.install-pane input[type=text],
.install-pane input[type=url],
.install-pane select,
.install-pane textarea {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  font-size: 15px; background: var(--color-bg, var(--color-surface)); color: var(--color-text);
  font-family: inherit;
}
.install-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.install-recap { background: var(--color-surface-alt); padding: 14px 18px; border-radius: var(--radius-md); }
.install-recap h4 { margin: 12px 0 4px; font-size: 13px; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.install-recap h4:first-child { margin-top: 0; }
.install-recap div { font-size: 14px; margin-bottom: 3px; }
.install-error {
  background: #FEE2E2; color: #991B1B; padding: 10px 14px;
  border-radius: var(--radius-md); margin: 12px 0; font-size: 14px;
}
.install-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; }
.install-actions button {
  padding: 11px 22px; border-radius: var(--radius-md); font-weight: 600; font-size: 15px;
  cursor: pointer; border: 1px solid transparent;
}
.install-actions .btn-primary { background: #6366F1; color: #fff; }
.install-actions .btn-ghost   { background: transparent; border-color: var(--color-border); color: var(--color-text-muted); }
.install-actions button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ========== Modal Paramètres (multi-tabs) ========== */
/* Spécificité .vpos-modal.settings-modal (2 classes) > .vpos-modal seul → garantie */
.settings-backdrop { padding: 0; }
.vpos-modal.settings-modal {
  width: 95vw; max-width: 1100px; min-height: 86vh; max-height: 92vh;
  display: flex; flex-direction: column;
  padding: 0;
}
.settings-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 24px; border-bottom: 1px solid var(--color-border);
}
.settings-header h3 { margin: 0; font-size: 22px; }
.settings-close {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: var(--color-border); cursor: pointer; font-size: 20px; line-height: 1;
}
.settings-body { display: flex; flex: 1; overflow: hidden; }
.settings-tabs {
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 12px; border-right: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  min-width: 220px;
}
.settings-tabs button {
  text-align: left; padding: 12px 16px; border: none; background: transparent;
  border-radius: var(--radius-md); cursor: pointer; font-size: 15px; font-weight: 500;
  color: var(--color-text);
}
.settings-tabs button:hover { background: var(--color-surface); }
.settings-tabs button.active { background: var(--color-primary); color: white; font-weight: 600; }
.settings-content { flex: 1; padding: 20px 28px; overflow-y: auto; }
.settings-pane h4 { margin: 0 0 12px; font-size: 16px; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.settings-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.settings-fields label { display: block; }
.settings-fields label > span { display: block; font-size: 13px; font-weight: 600; color: var(--color-text-muted); margin-bottom: 4px; }
.settings-fields > div > label,
.settings-fields div label { font-size: 13px; font-weight: 600; color: var(--color-text-muted); display: block; margin-bottom: 4px; }
.settings-fields > div > div { font-size: 16px; font-weight: 500; }
.settings-field-wide { grid-column: 1 / -1; }
.settings-field-inline { grid-template-columns: 2fr 1fr auto; align-items: end; }
.settings-fields input[type=text],
.settings-fields input[type=url],
.settings-fields input[type=number],
.settings-fields select,
.settings-fields textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--color-border);
  border-radius: var(--radius-md); font-size: 15px; background: var(--color-bg, var(--color-surface)); color: var(--color-text);
}
.settings-fields textarea { line-height: 1.4; }
.settings-actions { display: flex; gap: 12px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.settings-actions .btn-primary,
.settings-actions .btn-ghost {
  padding: 10px 18px; border-radius: var(--radius-md); font-weight: 600;
  border: 1px solid transparent; cursor: pointer; font-size: 14px;
}
.settings-actions .btn-primary { background: #6366F1; color: white; }
.settings-actions .btn-ghost { background: transparent; border-color: var(--color-border); color: var(--color-text-muted); }
.settings-actions .btn-primary:disabled,
.settings-actions .btn-ghost:disabled { opacity: 0.5; cursor: not-allowed; }

.settings-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.settings-table th, .settings-table td {
  padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--color-border); font-size: 14px;
}
.settings-table th { background: var(--color-surface-alt); font-size: 12px; text-transform: uppercase; color: var(--color-text-muted); }
.settings-table tr.inactive { opacity: 0.55; }
.btn-tiny {
  padding: 6px 10px; border: 1px solid var(--color-border); background: var(--color-surface);
  border-radius: 6px; cursor: pointer; font-size: 12px; margin-right: 4px;
}
.btn-tiny:hover { background: var(--color-surface-alt); }

.settings-footer {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 12px 24px; border-top: 1px solid var(--color-border);
}
.settings-message { font-size: 14px; }

/* Logo upload */
.logo-row { display: flex; gap: 24px; align-items: flex-start; }
.logo-thumb {
  width: 140px; height: 140px; border: 2px dashed var(--color-border);
  border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center;
  background: var(--color-surface-alt); overflow: hidden;
}
.logo-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-empty { color: var(--color-text-muted); font-size: 13px; }
.logo-actions { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.settings-upload-btn {
  display: inline-block; padding: 10px 18px; border-radius: var(--radius-md);
  background: #6366F1; color: white; font-weight: 600; cursor: pointer; font-size: 14px;
  text-align: center; border: none;
}
.settings-upload-btn:hover { background: #4F46E5; }
.hint { color: var(--color-text-muted); font-size: 13px; margin: 0; }

/* Receipt preview (simulation thermique 58mm = 384px @ 203 DPI)
 * Suit le design docs/06-design-system.md §10 */
.receipt-preview {
  width: 384px; max-width: 100%;
  margin: 0 auto 8px;
  padding: 16px 20px;
  background: #fff;
  color: #000;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px; line-height: 1.45;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  border-radius: 2px;
}
.receipt-preview .receipt-logo {
  display: block; margin: 0 auto 8px;
  max-width: 240px; max-height: 90px; object-fit: contain;
}
.receipt-preview .r-name {
  text-align: center; font-weight: bold; font-size: 18px;
  letter-spacing: 0.5px; margin-bottom: 4px;
}
.receipt-preview .r-center { text-align: center; }
.receipt-preview .r-mb { margin-bottom: 2px; }
.receipt-preview .r-small { font-size: 11px; opacity: 0.8; }
.receipt-preview .r-bold { font-weight: bold; }
.receipt-preview .r-large { font-size: 16px; }
.receipt-preview .r-sep {
  border-top: 1px dashed #000;
  margin: 8px 0;
}
.receipt-preview .r-row {
  display: flex; justify-content: space-between;
}
.receipt-preview .r-item { margin-bottom: 2px; }
.receipt-preview .r-item-name { font-weight: 500; }
.receipt-preview .r-item-qty {
  display: flex; justify-content: space-between;
}
.receipt-preview .r-qr {
  display: inline-block; padding: 18px 24px; margin: 6px auto;
  border: 1px dashed #000; font-size: 11px; letter-spacing: 1px;
}
.receipt-preview .r-qr-img {
  display: block; width: 120px; height: 120px;
  margin: 6px auto 4px; image-rendering: pixelated;
}

/* Catalogue local : barre d'action (titre + bouton créer) */
.catalog-tabs-row {
  display: flex; justify-content: space-between; align-items: center;
  margin: 0 0 10px;
}
.catalog-tabs-row .btn-primary {
  padding: 8px 14px; font-size: 13px; border: none; background: #6366F1;
  color: #fff; border-radius: var(--radius-md); cursor: pointer; font-weight: 600;
}
.color-dot {
  display: inline-block; width: 14px; height: 14px; border-radius: 50%;
  vertical-align: middle; border: 1px solid var(--color-border);
}

/* Logo source picker (3 boutons toggle) */
.logo-source-tabs {
  display: flex; gap: 4px; padding: 3px;
  background: var(--color-border); border-radius: var(--radius-md);
  margin-bottom: 8px; width: fit-content;
}
.logo-source-tabs button {
  padding: 6px 14px; border: none; background: transparent;
  border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer;
  color: var(--color-text-muted);
}
.logo-source-tabs button.active {
  background: var(--color-surface); color: var(--color-text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.logo-url-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.logo-url-row input { flex: 1; min-width: 240px; padding: 10px 12px;
  border: 1px solid var(--color-border); border-radius: var(--radius-md); font-size: 14px;
  background: var(--color-bg, var(--color-surface)); color: var(--color-text); }
.logo-url-row .btn-primary {
  padding: 10px 16px; border: none; background: #6366F1; color: white;
  border-radius: var(--radius-md); font-weight: 600; cursor: pointer;
}
.logo-url-row .hint { width: 100%; }

/* ========== Modals (article libre, remise) ========== */
.vpos-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 24px;
}
.vpos-modal {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  width: 100%; max-width: 460px;
  padding: 24px 28px;
  animation: vpos-modal-in 140ms ease-out;
}
@keyframes vpos-modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.vpos-modal h3 { margin: 0 0 4px; font-size: 22px; }
.vpos-modal .modal-hint { margin: 0 0 18px; color: var(--color-text-muted); font-size: 14px; }
.vpos-modal label {
  display: block; margin-bottom: 14px;
}
.vpos-modal label > span {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--color-text-muted); margin-bottom: 6px;
}
.vpos-modal input[type=text],
.vpos-modal input[type=number] {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 16px;
  background: var(--color-bg, #fff);
}
.vpos-modal input:focus {
  outline: none; border-color: #6366F1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.modal-row-2 {
  display: grid; grid-template-columns: 2fr 1fr; gap: 12px;
}
.modal-error {
  background: #FEE2E2; color: #991B1B;
  padding: 8px 12px; border-radius: var(--radius-md);
  font-size: 14px; margin-bottom: 12px;
}
.modal-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 8px;
}
.modal-actions .btn-ghost,
.modal-actions .btn-primary {
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-size: 15px; font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
}
.modal-actions .btn-ghost {
  background: transparent; border-color: var(--color-border);
  color: var(--color-text-muted);
}
.modal-actions .btn-primary {
  background: #6366F1; color: #fff;
}
.modal-actions .btn-primary:hover { background: #4F46E5; }
.discount-mode-tabs {
  display: flex; gap: 6px; margin-bottom: 14px;
  background: var(--color-border); padding: 4px;
  border-radius: var(--radius-md);
}
.discount-mode-tabs button {
  flex: 1; padding: 8px 12px;
  background: transparent; border: none;
  border-radius: calc(var(--radius-md) - 2px);
  font-size: 14px; font-weight: 600; cursor: pointer;
  color: var(--color-text-muted);
}
.discount-mode-tabs button.active {
  background: var(--color-surface);
  color: var(--color-text, #1F2937);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.discount-quick {
  display: flex; gap: 6px; margin-bottom: 14px;
}
.discount-quick button {
  flex: 1; padding: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.discount-quick button:hover { background: #FEF3C7; border-color: #F59E0B; }

/* Cart actions toolbar (au-dessus des lignes) */
.cart-tools {
  display: flex; gap: 8px; padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
}
.cart-tool-btn {
  flex: 1;
  padding: 10px 8px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 4px;
}
.cart-tool-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.cart-tool-btn.active {
  background: #FEF3C7;
  border-color: #F59E0B;
  color: #92400E;
}
.cart-tool-clear {
  flex: 0 0 auto;
  width: 38px; padding: 0;
  background: var(--color-danger, #DC2626);
  color: #fff;
  border-color: var(--color-danger, #DC2626);
}

/* Cart right */
.cart-col {
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.cart-header { padding: 12px 16px; border-bottom: 1px solid var(--color-border); font-weight: 700; }
.cart-empty { padding: 24px; color: var(--color-text-muted); text-align: center; }
.cart-lines { flex: 1; overflow-y: auto; padding: 8px 0; }
.cart-line {
  display: grid; grid-template-columns: 1fr auto auto;
  gap: 8px; padding: 8px 16px;
  border-bottom: 1px solid var(--color-border);
}
.cart-line .name { font-weight: 600; }
.cart-line .qty-price { color: var(--color-text-muted); font-size: 14px; }
.cart-line .total { font-weight: 600; text-align: right; align-self: center; }
.cart-line .remove {
  align-self: center; color: var(--color-danger);
  min-width: var(--touch-tiny); min-height: var(--touch-tiny);
}
.cart-footer {
  border-top: 1px solid var(--color-border);
  padding: 12px 16px; display: flex; flex-direction: column; gap: 8px;
  background: var(--color-surface-alt);
}
.cart-footer .row { display: flex; justify-content: space-between; }
.cart-footer .row.total { font-size: 28px; font-weight: 800; margin-top: 4px; }

.btn-encaisser {
  width: 100%; height: 88px;
  background: var(--color-primary); color: white;
  font-size: 24px; font-weight: 800; letter-spacing: 1px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  margin-top: 8px;
  transition: transform 80ms ease;
}
.btn-encaisser:active { transform: scale(0.98); }
.btn-encaisser[disabled] { opacity: 0.5; cursor: not-allowed; }

/* --- PAYMENT SCREEN --- */
.payment-screen {
  position: fixed; inset: 0; z-index: 50;
  background: var(--color-bg); display: flex; flex-direction: column;
}
.payment-header {
  padding: 20px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--color-border); background: var(--color-surface);
}
.payment-total {
  font-size: 64px; font-weight: 800; text-align: center; padding: 32px;
}
.payment-remaining {
  font-size: 20px; color: var(--color-text-muted); text-align: center;
  margin-top: -20px; margin-bottom: 20px;
}
.payment-methods {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  padding: 16px; flex: 1;
}
.payment-method-btn {
  min-height: 140px; border-radius: var(--radius-lg);
  font-size: 24px; font-weight: 700; color: white;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; box-shadow: var(--shadow-md);
  transition: transform 80ms ease;
}
.payment-method-btn:active { transform: scale(0.98); }
.payment-method-btn .icon { font-size: 48px; }
.pm-cash { background: var(--color-cash); }
.pm-card { background: var(--color-card); }
.pm-cheque { background: #6B7280; }
.pm-credit { background: var(--color-warning); }

.payment-cancel {
  width: 100%; height: var(--touch-prim);
  background: var(--color-surface); color: var(--color-text-muted);
  font-weight: 600; border-top: 1px solid var(--color-border);
}

.payment-cash-screen {
  padding: 20px; display: flex; flex-direction: column; gap: 16px;
}
.payment-cash-amount {
  font-size: 48px; font-weight: 800; text-align: center;
  padding: 20px; background: var(--color-surface); border-radius: var(--radius-md);
}
.payment-cash-quick { display: flex; gap: 12px; justify-content: center; }
.payment-cash-quick button {
  min-height: var(--touch-prim); min-width: 88px;
  padding: 0 20px; border-radius: var(--radius-md);
  background: var(--color-surface); font-size: 20px; font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.payment-cash-keypad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 400px; margin: 0 auto;
}
.payment-cash-keypad button {
  height: var(--touch-xl); border-radius: var(--radius-md);
  background: var(--color-surface); font-size: 24px; font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.payment-cash-validate {
  background: var(--color-success); color: white; font-size: 22px; font-weight: 700;
  min-height: 88px; border-radius: var(--radius-md);
}
.payment-cash-validate[disabled] { opacity: 0.5; }
.payment-change {
  font-size: 32px; font-weight: 700; color: var(--color-cash); text-align: center;
}

/* --- SUCCESS --- */
.success-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: var(--color-success); color: white;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 16px;
  font-size: 48px; font-weight: 800;
  animation: popin 200ms ease;
}
@keyframes popin {
  0% { opacity: 0; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1); }
}
.success-overlay .icon { font-size: 128px; }

/* --- CUSTOMER BADGE + POPUP --- */
.customer-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: var(--color-surface-alt);
  border-bottom: 1px solid var(--color-border);
  font-size: 15px;
}
.customer-bar .btn-customer {
  flex: 1;
  min-height: var(--touch-small);
  padding: 0 12px;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
  display: flex; align-items: center; justify-content: space-between;
}
.customer-bar .btn-customer.attached {
  background: linear-gradient(90deg, #10B98122 0%, #10B98111 100%);
  border-left: 4px solid var(--color-success);
}
.customer-bar .pts {
  color: var(--color-text-muted); font-weight: 500; font-size: 14px;
}
.customer-bar .btn-detach {
  width: var(--touch-small); height: var(--touch-small);
  border-radius: 50%;
  background: var(--color-surface);
  color: var(--color-danger);
  box-shadow: var(--shadow-sm);
}

.loyalty-banner {
  margin: 8px 12px; padding: 12px 16px;
  background: linear-gradient(90deg, #F59E0B22, #F59E0B11);
  border: 2px solid var(--color-warning);
  border-radius: var(--radius-md);
  display: flex; align-items: center; gap: 12px;
}
.loyalty-banner .info { flex: 1; font-weight: 600; }
.loyalty-banner .info small { display:block; font-weight:400; font-size:13px; color:var(--color-text-muted); }
.loyalty-banner button {
  min-height: var(--touch-med);
  padding: 0 20px;
  border-radius: var(--radius-md);
  background: var(--color-warning); color: white;
  font-weight: 700;
}

.modal-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 32px;
}
.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  width: 600px; max-width: 100%;
  max-height: 80vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 20px; font-weight: 700;
}
.modal-body { padding: 16px 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--color-border);
  display: flex; gap: 12px; justify-content: flex-end;
}
.modal input[type="text"],
.modal input[type="tel"],
.modal input[type="email"] {
  width: 100%; height: var(--touch-small);
  padding: 0 14px; margin-bottom: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  font-size: 18px;
}
.modal input:focus { outline: 3px solid var(--color-primary); border-color: var(--color-primary); }

.customer-result {
  width: 100%; padding: 12px 14px; margin-bottom: 8px;
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
  text-align: left;
  min-height: var(--touch-small);
  display: flex; align-items: center; justify-content: space-between;
}
.customer-result:active { transform: scale(0.98); }
.customer-result .name { font-weight: 600; font-size: 17px; }
.customer-result .contact { color: var(--color-text-muted); font-size: 14px; }
.customer-result .pts-badge {
  padding: 4px 10px; border-radius: 999px;
  background: var(--color-warning); color: white;
  font-size: 13px; font-weight: 700;
}

.btn-ghost {
  min-height: var(--touch-small);
  padding: 0 16px;
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
  font-weight: 600;
}
.btn-primary {
  min-height: var(--touch-small);
  padding: 0 18px;
  border-radius: var(--radius-md);
  background: var(--color-primary); color: white;
  font-weight: 700;
}
.btn-primary:active { background: var(--color-primary-hover); }

/* --- STOCK BADGES --- */
.product-card.stock-low { outline: 2px solid var(--color-warning); }
.product-card.stock-out { opacity: 0.6; }
.product-card .stock-tag {
  position: absolute;
  top: 6px; right: 6px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
  background: var(--color-warning); color: white;
}
.product-card.stock-out .stock-tag { background: var(--color-danger); }
.product-card { position: relative; }

/* --- SNACK : plan de tables --- */
.tables-screen {
  position: fixed; inset: 0; z-index: 70;
  background: var(--color-bg);
  display: flex; flex-direction: column;
}
.tables-header {
  padding: 16px 20px; background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 22px; font-weight: 700;
}
.tables-grid {
  padding: 20px; flex: 1; overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}
.table-card {
  min-height: 120px; border-radius: var(--radius-lg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; font-weight: 700;
  box-shadow: var(--shadow-sm);
  transition: transform 80ms ease;
  border: 3px solid transparent;
}
.table-card:active { transform: scale(0.97); }
.table-card.free { background: #10B98122; border-color: var(--color-success); color: #065F46; }
.table-card.occupied { background: #F59E0B22; border-color: var(--color-warning); color: #92400E; }
.table-card.waiting { background: #EF444422; border-color: var(--color-danger); color: #991B1B; }
.table-card .label { font-size: 30px; }
.table-card .amount { font-size: 16px; font-weight: 600; }
.table-card .status { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }

/* --- SNACK : options overlay --- */
.options-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: var(--color-bg);
  display: flex; flex-direction: column;
}
.options-header {
  padding: 16px 20px; background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  font-size: 22px; font-weight: 700;
  display: flex; align-items: center; justify-content: space-between;
}
.options-body {
  flex: 1; padding: 20px; overflow-y: auto;
}
.options-group { margin-bottom: 24px; }
.options-group-label {
  font-size: 18px; font-weight: 700; margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.options-group-label .required { color: var(--color-danger); font-size: 14px; }
.options-btns {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.options-btns button {
  min-height: var(--touch-prim); min-width: 72px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: 17px; font-weight: 600; text-align: left;
  box-shadow: var(--shadow-sm);
  border: 3px solid transparent;
  transition: transform 80ms ease;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.options-btns button:active { transform: scale(0.96); }
.options-btns button.selected {
  background: #2563EB11;
  border-color: var(--color-primary);
}
.options-btns button .delta {
  font-size: 13px; color: var(--color-text-muted);
  font-weight: 500;
}
.options-footer {
  padding: 16px 20px; background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  display: flex; gap: 12px; justify-content: flex-end;
}
.options-footer .btn-validate {
  min-height: 72px; min-width: 240px;
  border-radius: var(--radius-md);
  background: var(--color-primary); color: white;
  font-size: 20px; font-weight: 700;
}
.options-footer .btn-validate:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- SNACK : boutons top bar --- */
.snack-actions {
  display: flex; gap: 8px;
}
.snack-actions button {
  height: 32px; padding: 0 14px; border-radius: 6px;
  font-weight: 600; font-size: 13px; color: white;
}
.btn-kitchen { background: var(--color-warning); }
.btn-pre-bill { background: #6B7280; }
.btn-tables { background: var(--color-primary); }

/* --- PRINTER STATUS + CONFIG --- */
.printer-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  cursor: pointer; border: none;
}
.printer-pill.connected { background: #10B98122; color: #065F46; }
.printer-pill.disconnected { background: #F59E0B22; color: #92400E; }
.printer-pill.error { background: #EF444422; color: #991B1B; }
.printer-pill.unsupported { background: var(--color-surface-alt); color: var(--color-text-muted); }
.printer-pill .dot {
  width: 8px; height: 8px; border-radius: 50%;
}
.printer-pill.connected .dot { background: var(--color-success); }
.printer-pill.disconnected .dot { background: var(--color-warning); }
.printer-pill.error .dot { background: var(--color-danger); }
.printer-pill.unsupported .dot { background: var(--color-text-muted); }

.printer-config-body { font-size: 16px; }
.printer-config-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--color-border);
}
.printer-config-row:last-child { border-bottom: none; }
.printer-config-row .label {
  flex: 1;
  display: flex; flex-direction: column; gap: 4px;
}
.printer-config-row .label .name { font-weight: 700; }
.printer-config-row .label .status-text { font-size: 13px; color: var(--color-text-muted); }
.printer-config-row .actions { display: flex; gap: 8px; }
.printer-config-result {
  margin-top: 12px; padding: 10px; border-radius: var(--radius-md);
  background: var(--color-surface-alt);
  font-size: 14px; min-height: 20px;
}

[x-cloak] { display: none !important; }
