/* =======================================================
   INLINE STYLES EXTERNALISÉS
   ======================================================= */

/* Hide elements that start hidden and are shown via JS */
.admin-logout-btn-hidden {
  display: none !important;
}

.admin-tabs-hidden {
  display: none !important;
}

/* Admin header layout */
.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Admin head spacing */
.admin-head {
  gap: 16px;
}

.admin-head h3 {
  flex: 1;
  text-align: center;
}

/* Disconnect button styling */
.admin-logout-btn {
  font-size: 12px;
  width: auto;
  padding: 0 18px;
  height: 36px;
  border-radius: 18px;
  color: var(--white);
  background: var(--rust);
  border: none;
  font-weight: 600;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.admin-logout-btn:hover {
  background: #8C3220;
  transform: translateY(-1px);
}

/* Hide non-active admin tabs */
.admin-tab {
  display: none;
}

.admin-tab.active {
  display: inline-block;
}

/* Modal personnalisé */
.modal-small {
  max-width: 300px;
}

.modal-body-compact {
  padding: 22px;
}

.modal-title-small {
  margin-bottom: 16px;
  font-size: 16px;
}

.modal-buttons-vertical {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Admin login form */
.admin-login-form {
  max-width: 280px;
  margin: 16px auto;
  text-align: left;
}

.admin-login-form-narrow {
  max-width: 280px;
  margin: 0 auto 16px;
  text-align: left;
}

.admin-login-btn {
  display: inline-block;
  padding: 11px 26px;
}

.admin-login-title {
  font-weight: 700;
  color: var(--coffee-black);
  font-size: 15px;
}

.admin-login-logo {
  display: block;
  width: 100px;
  height: 100px;
  margin: 0 auto 14px;
  object-fit: contain;
}

/* Admin form buttons */
.admin-form-actions {
  display: flex;
  gap: 10px;
}

.admin-form-actions .btn-primary {
  flex: 0 0 auto;
  padding: 11px 24px;
}

/* Stock field in product form */
.stock-field-disabled {
  color: #8A7660;
}

/* Admin toolbar field */
.admin-toolbar-field {
  margin-bottom: 0;
  min-width: 220px;
}

.admin-toolbar-field-narrow {
  margin-bottom: 0;
  min-width: 200px;
}

/* Sales stats container */
.sales-stats-container {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Sales table phone number */
.sales-phone {
  color: #8A7660;
  font-size: 11.5px;
}

/* Sales total */
.sales-total {
  font-weight: 700;
}

/* Product thumbnail placeholder */
.product-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

/* Stock thumbnail placeholder */
.stock-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

/* Hidden file inputs */
#cameraInput,
#galleryInput {
  position: absolute !important;
  left: -9999px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 28px;
  transition: all 0.3s ease;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--rust);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(24px);
}

.toggle-switch:hover .toggle-slider {
  opacity: 0.9;
}

/* Google Maps button */
.map-search-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gold);
  color: var(--coffee-black);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  white-space: nowrap;
}

.map-search-btn:hover {
  background: var(--gold-light);
  transform: translateY(-1px);
}

.map-search-btn svg {
  width: 14px;
  height: 14px;
}

.map-search-container {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.map-search-container input {
  flex: 1;
}

/* =======================================================
   NOUVELLES FONCTIONNALITÉS - CHAT & ASSISTANCE
   ======================================================= */

/* Call button */
.call-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #2E7D46;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  transition: background 0.2s;
  text-decoration: none;
}

.call-btn:hover {
  background: #256238;
}

/* Chat container */
.chat-wrap {
  display: flex;
  flex-direction: column;
  height: 60vh;
  max-height: 520px;
  border: 1px solid rgba(110, 59, 30, 0.15);
  border-radius: 14px;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  background: var(--cream-light);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.4;
}

.chat-bubble .chat-meta {
  font-size: 10.5px;
  opacity: 0.65;
  margin-top: 4px;
}

.chat-bubble.mine {
  align-self: flex-end;
  background: var(--coffee-brown);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-bubble.theirs {
  align-self: flex-start;
  background: var(--white);
  color: var(--ink);
  border: 1px solid rgba(110, 59, 30, 0.15);
  border-bottom-left-radius: 4px;
}

.chat-empty {
  text-align: center;
  color: #8A7660;
  font-size: 13px;
  margin: auto;
}

.chat-input-row {
  display: flex;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid rgba(110, 59, 30, 0.12);
  background: var(--white);
}

.chat-input-row input {
  flex: 1;
  padding: 11px 14px;
  border-radius: 999px;
  border: 1px solid rgba(110, 59, 30, 0.25);
  font-family: inherit;
  font-size: 13.5px;
}

.chat-input-row button {
  background: var(--rust);
  color: #fff;
  padding: 0 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
}

/* =======================================================
   MODE PLEIN ÉCRAN ADMIN/GERANT
   ======================================================= */

/* Cache les sections client quand un admin/gerant est connecté */
body.admin-mode .hero,
body.admin-mode .section#menu,
body.admin-mode .section#points,
body.admin-mode .section#avis {
  display: none !important;
}

/* Garde header et footer visibles en mode admin */
body.admin-mode header,
body.admin-mode footer {
  display: block !important;
}

/* Ajuste le main pour occuper l'espace */
body.admin-mode {
  background: var(--cream-light);
}

/* Override de l'overlay admin pour mode plein écran */
body.admin-mode .admin-overlay {
  position: fixed;
  inset: 0;
  background: var(--cream-light);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 0;
  overflow: hidden;
}

body.admin-mode .admin-panel {
  max-width: 100%;
  width: 100%;
  height: 100vh;
  max-height: 100vh;
  border-radius: 0;
  margin-bottom: 0;
  box-shadow: none;
  overflow: hidden;
}

/* Cache le bouton admin dans le footer en mode admin */
body.admin-mode .admin-trigger {
  display: none;
}

/* Pleine hauteur pour le corps admin */
body.admin-mode .admin-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: calc(100vh - 120px);
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

/* Sidebar dropdown pour manager */
body.admin-mode .admin-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 260px;
  background: linear-gradient(180deg, var(--coffee-black) 0%, var(--coffee-brown) 100%);
  z-index: 201;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  padding: 80px 20px 20px;
  box-shadow: 4px 0 12px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
}

body.admin-mode .admin-sidebar.open {
  transform: translateX(0);
}

body.admin-mode .admin-sidebar-toggle {
  position: fixed;
  left: 16px;
  top: 16px;
  z-index: 202;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--coffee-brown);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  border: 1px solid rgba(221,165,63,0.3);
  transition: all 0.2s;
}

body.admin-mode .admin-sidebar-toggle:hover {
  background: var(--coffee-black);
  transform: scale(1.05);
}

body.admin-mode .admin-sidebar-menu {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
}

body.admin-mode .admin-sidebar-menu li {
  margin-bottom: 8px;
}

body.admin-mode .admin-sidebar-menu button {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255,255,255,0.08);
  color: var(--white);
  border: 1px solid rgba(221,165,63,0.2);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 10px;
}

body.admin-mode .admin-sidebar-menu button:hover {
  background: rgba(255,255,255,0.15);
  border-color: var(--gold);
}

body.admin-mode .admin-sidebar-menu button.active {
  background: var(--rust);
  border-color: var(--rust);
  color: var(--white);
}

body.admin-mode .admin-sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

body.admin-mode .admin-sidebar-overlay.open {
  display: block;
  opacity: 1;
}

/* Ajustement du contenu admin pour la sidebar */
body.admin-mode .admin-panel {
  padding-left: 0;
  transition: padding-left 0.3s ease;
}

body.admin-mode .admin-panel.sidebar-open {
  padding-left: 260px;
}

/* Responsive */
/* =======================================================
   NOUVEAU LAYOUT CAISSE - Panier fixe à droite
   ======================================================= */

/* Container principal de la caisse : flex row */
.caisse-layout {
  display: flex;
  height: 100%;
  gap: 0;
  position: relative;
}

/* Partie gauche : produits + commandes, scrollable */
.caisse-left {
  flex: 1;
  overflow-y: auto;
  padding-right: 24px;
  min-height: 0;
  height: 100%;
}

/* Partie droite : panier/caisse fixe, COMPLÈTEMENT SANS scroll */
.caisse-right {
  width: 380px;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  z-index: 210;
  background: var(--cream);
  border-left: 2px solid rgba(110,59,30,0.15);
  padding: 16px;
  overflow: hidden;
  box-shadow: -4px 0 12px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
}

/* Le corps du panier SANS scroll */
.caisse-right .caisse-cart-body {
  overflow: hidden;
  margin-bottom: 10px;
}

/* Ajustement du admin-body quand la caisse est active */
body.admin-mode .admin-body.caisse-active {
  overflow: hidden;
  max-height: calc(100vh - 120px);
  padding-right: 400px; /* espace pour le panier fixe */
}

/* En-tête du panier */
.caisse-cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid rgba(110,59,30,0.15);
}

.caisse-cart-header h4 {
  font-size: 16px;
  color: var(--coffee-black);
  font-weight: 700;
}

.caisse-cart-header .cart-badge {
  background: var(--rust);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  /* Cohérent avec le compteur du panier dans le header : police élégante, gras. */
  font-family: var(--font-display);
  padding: 3px 10px;
  border-radius: 999px;
}

/* Pied du panier (total + boutons) */
.caisse-cart-footer {
  border-top: 1px solid rgba(110,59,30,0.15);
  padding-top: 12px;
  flex-shrink: 0;
}

/* === COMMANDES EN ATTENTE === */
.pending-orders-section {
  margin-bottom: 28px;
}

.pending-orders-section .section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--coffee-black);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pending-orders-section .section-title .count-badge {
  background: var(--gold);
  color: var(--coffee-black);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.pending-order-card {
  background: var(--white);
  border: 1px solid rgba(110,59,30,0.12);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.pending-order-card:hover {
  border-color: var(--gold);
  box-shadow: 0 3px 12px rgba(0,0,0,0.1);
  transform: translateX(4px);
}

.pending-order-card .order-info {
  flex: 1;
  min-width: 0;
}

.pending-order-card .order-info .order-client {
  font-weight: 700;
  font-size: 14px;
  color: var(--coffee-black);
}

.pending-order-card .order-info .order-detail {
  font-size: 12px;
  color: #8A7660;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pending-order-card .order-info .order-time {
  font-size: 11px;
  color: #8A7660;
  margin-top: 2px;
}

.pending-order-card .order-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.pending-order-card .order-total {
  font-weight: 700;
  color: var(--rust);
  font-size: 14px;
  white-space: nowrap;
}

.pending-order-card .import-btn {
  background: var(--gold);
  color: var(--coffee-black);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.pending-order-card .import-btn:hover {
  background: var(--gold-light);
  transform: scale(1.05);
}

.pending-order-card .imported-check {
  color: #2E7D46;
  font-weight: 700;
  font-size: 12px;
}

/* Message aucun produit */
.caisse-empty-products {
  text-align: center;
  padding: 40px 20px;
  color: #8A7660;
  font-size: 13px;
  background: var(--cream);
  border-radius: 14px;
}

/* Règles mobile de la caisse : voir le bloc "MOBILE CAISSE" en fin de fichier. */

/* Back-office : navigation persistante, structure type application SaaS */
body.admin-mode {
  background: #f6f6f7;
}

body.admin-mode .admin-panel {
  padding-left: 248px;
  background: #f6f6f7;
}

body.admin-mode .admin-head {
  min-height: 72px;
  padding: 16px 28px;
  background: #ffffff;
  border-bottom: 1px solid #e1e3e5;
}

body.admin-mode .admin-head h3 {
  color: #202223;
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 700;
}

body.admin-mode .admin-sidebar {
  left: 0;
  top: 0;
  bottom: 0;
  width: 248px;
  padding: 22px 14px;
  transform: translateX(0);
  background: linear-gradient(180deg, var(--coffee-black) 0%, var(--coffee-brown) 100%);
  border-right: 1px solid rgba(221, 165, 63, 0.25);
  box-shadow: none;
  overflow-y: auto;
}

body.admin-mode .admin-sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 24px;
  color: #ffffff;
  text-align: center;
}

body.admin-mode .admin-sidebar-avatar {
  width: 64px;
  height: 64px;
  overflow: hidden;
  border: 2px solid var(--gold);
  border-radius: 50%;
  background: #30363b;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 24px;
  font-weight: 700;
}

body.admin-mode .admin-sidebar-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

body.admin-mode .admin-sidebar-brand span {
  color: #aeb4b9;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
}

body.admin-mode .admin-sidebar-brand strong {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: #ffffff;
  font-size: 14px;
}

body.admin-mode .owner-sidebar-menu li:last-child {
  margin-top: auto;
  padding-top: 12px;
}

body.admin-mode .owner-sidebar-menu li:last-child button {
  border-top: 1px solid #59636b;
  border-radius: 0;
}

body.admin-mode .admin-sidebar-menu li {
  margin-bottom: 3px;
}

body.admin-mode .admin-sidebar-menu button {
  min-height: 42px;
  padding: 10px 12px;
  color: #c9cdd1;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
}

body.admin-mode .admin-sidebar-menu button:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--gold);
}

body.admin-mode .admin-sidebar-menu button.active {
  color: #ffffff;
  background: var(--rust);
  border-color: var(--rust);
  box-shadow: inset 3px 0 0 var(--gold);
}

body.admin-mode .admin-sidebar-toggle {
  display: none;
}

body.admin-mode .admin-body {
  padding: 28px 34px 48px;
  background: #f6f6f7;
}

body.admin-mode .admin-toolbar {
  min-height: 46px;
  margin-bottom: 22px;
  align-items: center;
}

body.admin-mode .admin-toolbar h3 {
  color: #202223 !important;
  font-family: var(--font-body);
  font-size: 20px;
  font-weight: 700;
}

body.admin-mode .admin-stat,
body.admin-mode .admin-product-form,
body.admin-mode .admin-table,
body.admin-mode .chat-wrap {
  border: 1px solid #e1e3e5;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

body.admin-mode .admin-product-form,
body.admin-mode .admin-stat {
  background: #ffffff;
}

body.admin-mode .admin-table {
  background: #ffffff;
  border-radius: 8px;
  overflow: hidden;
}

body.admin-mode .admin-table th {
  background: #f6f6f7;
  color: #6d7175;
  border-bottom-color: #e1e3e5;
}

body.admin-mode .admin-table td {
  border-bottom-color: #e1e3e5;
}

body.admin-mode .btn-primary,
body.admin-mode .btn-ghost {
  border-radius: 6px;
}

@media (max-width: 768px) {
  body.admin-mode .admin-panel {
    padding-left: 0;
  }

  body.admin-mode .admin-head {
    min-height: 70px;
    padding: 14px 16px 14px 76px;
  }

  body.admin-mode .admin-sidebar {
    width: min(280px, 86vw);
    padding: 22px 14px;
    transform: translateX(-100%);
    z-index: 301;
  }

  body.admin-mode .admin-sidebar.open {
    transform: translateX(0);
  }

  body.admin-mode .admin-sidebar-toggle {
    display: flex;
    left: 16px;
    top: 14px;
    z-index: 302;
  }

  body.admin-mode .admin-body {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 18px 14px 34px;
  }
}

@media (max-width: 768px) {
  body.admin-mode .admin-sidebar {
    width: 100%;
    max-width: 280px;
  }
  
  body.admin-mode .admin-panel.sidebar-open {
    padding-left: 0;
  }
}

/* POS layout: keep the product shelf compact and let its two rows scroll. */
body.admin-mode .admin-head {
  position: relative;
}

body.admin-mode .admin-head h3 {
  position: absolute;
  left: 50%;
  flex: none;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 150px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body.admin-mode .admin-brand-logo {
  display: block;
  width: 59px;
  height: 59px;
  object-fit: contain;
}

body.admin-mode .admin-head .admin-header-actions {
  margin-left: auto;
}

body.admin-mode .brand-logo {
  width: 46px;
  height: 46px;
  object-fit: contain;
}

body.admin-mode .foot-brand .brand-logo {
  width: 48px;
  height: 48px;
}

.profile-nav {
  display: flex;
  gap: 8px;
  margin: 0 0 20px;
  overflow-x: auto;
  padding: 2px 0 8px;
}

.profile-nav button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 9px 15px;
  border: 1px solid #dedede;
  border-radius: 8px;
  background: #ffffff;
  color: #484848;
  font-weight: 600;
}

.profile-nav button.active {
  border-color: var(--rust);
  background: var(--rust);
  color: #ffffff;
}

.profile-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  max-width: 760px;
  padding: 22px;
  border: 1px solid #e1e3e5;
  border-radius: 10px;
  background: #ffffff;
}

.profile-avatar-editor {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 16px;
}

.profile-avatar-preview {
  display: grid;
  width: 84px;
  height: 84px;
  flex: 0 0 84px;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: #f0e9e1;
  color: var(--coffee-brown);
  font-size: 30px;
  font-weight: 700;
}

.profile-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.profile-upload-label {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.profile-dark-toggle,
.profile-actions {
  grid-column: 1 / -1;
}

.profile-dark-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.manager-invite-form,
.manager-edit-form {
  margin-bottom: 18px;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.shop-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
}

.shop-upload-label {
  display: inline-flex;
  align-items: center;
  width: max-content;
  cursor: pointer;
}

.shop-banner-preview {
  display: grid;
  min-height: 120px;
  max-height: 220px;
  place-items: center;
  overflow: hidden;
  background: #eee7de;
  color: #78634e;
}

.shop-banner-preview img {
  width: 100%;
  height: 100%;
  min-height: 120px;
  max-height: 220px;
  object-fit: cover;
  object-position: center 30%;
}

.shop-hours-calendar {
  max-width: 760px;
  padding: 20px;
  border: 1px solid #e1e3e5;
  border-radius: 10px;
  background: #ffffff;
}

.shop-hours-calendar h4 {
  margin-bottom: 4px;
  color: var(--coffee-black);
  font-size: 18px;
}

.shop-hours-row {
  display: grid;
  grid-template-columns: minmax(115px, 1fr) repeat(2, minmax(140px, .8fr));
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid #ece9e6;
}

.shop-hours-row:last-child {
  border-bottom: 0;
}

.shop-hours-day {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
}

.shop-hours-time {
  display: grid;
  gap: 4px;
  color: #6d7175;
  font-size: 11px;
}

.shop-hours-time input {
  min-height: 40px;
  padding: 7px 10px;
}

.shop-hours-time input:disabled {
  opacity: .45;
}

body.admin-mode.admin-dark-mode .admin-body {
  color: #e8e9ea;
  background: #171a1c;
}

/* Libellés au-dessus des champs : forcés en blanc, sinon ils gardent la couleur
   sombre (--ink / coffee-black) héritée et deviennent illisibles sur fond sombre. */
body.admin-mode.admin-dark-mode .admin-body label,
body.admin-mode.admin-dark-mode .admin-body .field label,
body.admin-mode.admin-dark-mode .admin-body .shop-color-row label,
body.admin-mode.admin-dark-mode .admin-body .shop-toggle label,
body.admin-mode.admin-dark-mode .admin-body .appro-row label,
body.admin-mode.admin-dark-mode .admin-body .qty-label {
  color: #ffffff;
}

body.admin-mode.admin-dark-mode .admin-toolbar h3,
body.admin-mode.admin-dark-mode .profile-panel,
body.admin-mode.admin-dark-mode .admin-product-form,
body.admin-mode.admin-dark-mode .admin-stat,
body.admin-mode.admin-dark-mode .admin-table,
body.admin-mode.admin-dark-mode .profile-nav button {
  color: #e8e9ea !important;
  background: #22272a;
  border-color: #3c4449;
}

body.admin-mode.admin-dark-mode .admin-table th {
  color: #c8cdd0;
  background: #2b3135;
}

body.admin-mode.admin-dark-mode .admin-table td {
  border-bottom-color: #3c4449;
}

body.admin-mode.admin-dark-mode .admin-body input:not([type="checkbox"]),
body.admin-mode.admin-dark-mode .admin-body select,
body.admin-mode.admin-dark-mode .admin-body textarea {
  color: #f1f2f2;
  border-color: #4b555b;
  background: #171a1c;
}

/* Éléments portant leur propre couleur : hors de la liste !important ci-dessus,
   ils garderaient une teinte foncée illisible sur fond sombre. On les éclaircit. */
body.admin-mode.admin-dark-mode .shop-note {
  color: #a9b1b6;
}

body.admin-mode.admin-dark-mode .admin-body input::placeholder,
body.admin-mode.admin-dark-mode .admin-body textarea::placeholder {
  color: #8b949b;
}

body.admin-mode.admin-dark-mode .admin-body .btn-ghost {
  color: #e8e9ea;
  background: #22272a;
  border-color: #4b555b;
}

body.admin-mode.admin-dark-mode .admin-body .btn-ghost:hover {
  border-color: var(--gold);
  background: #2b3135;
}

body.admin-mode.admin-dark-mode .admin-body .admin-photo-btn {
  color: var(--blush);
  border-color: var(--blush);
}

body.admin-mode.admin-dark-mode .admin-body .admin-photo-btn:hover {
  background: rgba(217, 138, 115, 0.12);
}

body.admin-mode.admin-dark-mode .stock-field-disabled {
  color: #8b949b;
}

body.admin-mode.admin-dark-mode .admin-empty {
  color: #a9b1b6;
}

body.admin-mode.admin-dark-mode .profile-nav button.active {
  background: var(--rust);
}

body.admin-mode .compta-add-btn {
  flex: 0 0 46px;
  width: 46px;
  min-width: 46px;
  height: 42px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

body.admin-mode .appro-open-btn {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  padding: 10px 16px;
  white-space: nowrap;
}

body.admin-mode .admin-row-actions {
  align-items: center;
  gap: 6px;
}

body.admin-mode .caisse-point-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

/* Remonte la ligne "Point de vente" (caisse uniquement, pour aligner avec le
   bouton panier) : réduit l'espace au-dessus. */
body.admin-mode .admin-caisse-body .caisse-point-row {
  margin-top: -8px;
}

body.admin-mode .caisse-point-row .admin-toolbar-field {
  flex: 0 1 280px;
  min-width: 0;
  margin: 0;
}

body.admin-mode .caisse-orders-toggle {
  position: relative;
  flex: 0 0 46px;
  width: 46px;
  height: 42px;
  margin: 0 0 1px auto;
  border: 1px solid rgba(110, 59, 30, 0.18);
  border-radius: 12px;
  background: var(--white);
  font-size: 20px;
}

body.admin-mode .caisse-orders-toggle .cart-badge {
  position: absolute;
  /* Compteur en bas du panier plutôt qu'en haut. */
  bottom: -7px;
  right: -7px;
  /* Chiffre du panier : police élégante et gras (Fraunces, celle des titres/valeurs). */
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
}

body.admin-mode .pending-orders-banner[hidden] {
  display: none !important;
}

body.admin-mode .pending-orders-banner {
  margin-top: 10px;
}

body.admin-mode .admin-caisse-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
}

body.admin-mode .caisse-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 36%);
  align-items: start;
  gap: 16px;
  min-height: 0;
}

body.admin-mode .caisse-left {
  min-width: 0;
}

body.admin-mode .caisse-product-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(158px, auto);
  max-height: 380px;
  overflow-y: auto;
  overscroll-behavior: contain;
  align-content: start;
  padding: 2px 4px 8px 2px;
}

body.admin-mode .caisse-product-grid .menu-card {
  min-width: 0;
  margin: 0;
  padding: 12px;
}

body.admin-mode .caisse-product-grid .menu-card .card-photo {
  height: 56px;
}

body.admin-mode .caisse-product-grid .menu-card .card-icon {
  margin-bottom: 4px;
  font-size: 28px;
}

body.admin-mode .caisse-right {
  position: sticky;
  top: 8px;
  right: auto;
  bottom: auto;
  z-index: 1;
  width: auto;
  max-height: calc(100dvh - 165px);
  min-height: 0;
  overflow: auto;
  box-shadow: 0 5px 22px rgba(48, 28, 16, 0.13);
}

body.admin-mode .caisse-cart-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

body.admin-mode .cancel-import-btn {
  margin-left: auto;
  color: var(--rust);
  font-size: 12px;
  font-weight: 700;
}

body.admin-mode .caisse-footer-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 340px);
  align-items: center;
  gap: 8px 14px;
  margin-top: 14px;
}

body.admin-mode .register-open-status,
body.admin-mode .register-closed-status {
  margin: 0;
  font-size: 13px;
}

body.admin-mode .register-open-status {
  color: #3c7148;
}

body.admin-mode .register-closed-status {
  color: var(--rust);
  font-weight: 700;
}

body.admin-mode .register-close-card {
  width: min(100%, 560px);
  margin: 20px auto;
  padding: 24px;
  border-radius: 14px;
  background: var(--cream);
}

body.admin-mode .register-close-card h3 {
  margin-bottom: 10px;
  color: var(--coffee-black);
}

body.admin-mode .register-close-card > p {
  margin-bottom: 18px;
  color: #725c49;
  font-size: 14px;
}

body.admin-mode .register-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 14px;
  margin-bottom: 18px;
  padding: 14px;
  border-radius: 10px;
  background: var(--white);
  color: #725c49;
  font-size: 13px;
}

body.admin-mode .register-summary strong {
  color: var(--coffee-black);
  text-align: right;
}

@media (max-width: 900px) {
  body.admin-mode .caisse-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  body.admin-mode .caisse-right {
    position: sticky;
    top: auto;
    bottom: 0;
    max-height: min(54dvh, 470px);
  }
}

@media (max-width: 600px) {
  body.admin-mode .admin-head h3 {
    max-width: calc(100% - 116px);
  }

  body.admin-mode .admin-brand-logo {
    width: 48px;
    height: 48px;
  }

  .profile-panel { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .shop-hours-calendar { padding: 14px; }
  .shop-hours-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .shop-hours-day { grid-column: 1 / -1; }

  body.admin-mode .admin-toolbar .compta-add-btn {
    align-self: flex-end;
  }

  body.admin-mode .caisse-point-row .admin-toolbar-field {
    flex-basis: min(72%, 280px);
  }

  body.admin-mode .caisse-product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: min(42dvh, 360px);
  }

  body.admin-mode .caisse-right {
    max-height: 58dvh;
  }

  body.admin-mode .caisse-footer-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  body.admin-mode .register-close-card {
    padding: 18px;
  }
}

@media (max-width: 768px) {
  /* Caisse mobile : plein écran dans le flux (cf. bloc MOBILE CAISSE en fin de fichier) */
  body.admin-mode .caisse-right {
    position: static !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    min-height: calc(100dvh - 140px) !important;
    z-index: auto !important;
    overflow: visible !important;
    border-left: none !important;
    border-top: 1px solid rgba(110, 59, 30, 0.15) !important;
    border-radius: 12px !important;
    padding: 14px !important;
  }

  body.admin-mode .caisse-right .caisse-cart-body {
    max-height: min(45dvh, 420px) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
}

/* Caisse : regroupe les commandes en une ligne compacte et réserve trois rangées aux produits. */
body.admin-mode .admin-panel.pos-bar {
  position: relative;
}

body.admin-mode .admin-panel.pos-bar .admin-head {
  z-index: 24;
  height: 3vh;
  min-height: 0;
  padding: 0;
  overflow: visible;
  background: var(--cream);
  /* Supprime la ligne du header admin (border-bottom hérité de body.admin-mode .admin-head)
     qui se peint au-dessus de la barre et coupait le bouton panier / le select. */
  border-bottom: 0;
}

body.admin-mode .admin-panel.pos-bar .admin-head h3 {
  /* Même axe vertical que la barre Point de vente : centre exact de la barre de 64px. */
  top: 32px;
  left: 50%;
  width: 48px;
  height: 48px;
  max-width: none;
  transform: translate(-50%, -50%);
}

body.admin-mode .admin-panel.pos-bar .admin-brand-logo {
  width: 48px;
  height: 48px;
}

body.admin-mode .admin-panel.pos-bar .admin-header-actions {
  position: absolute;
  /* Aligné sur la même ligne que le logo, le select et le panier. */
  top: 32px;
  right: 24px;
  z-index: 23;
  justify-content: flex-end;
  transform: translateY(-50%);
}

body.admin-mode .admin-panel.pos-bar .admin-point-bar {
  position: absolute;
  top: 0;
  right: 0;
  left: 248px;
  z-index: 22;
  height: 64px;
  padding: 0 24px;
  border: 0;
  background: var(--cream);
}

body.admin-mode .admin-panel.pos-bar .caisse-point-row {
  position: relative;
  height: 100%;
  align-items: center;
  margin: 0;
}

body.admin-mode .admin-panel.pos-bar .caisse-point-row .admin-toolbar-field {
  flex: 0 0 280px;
  align-self: center;
  /* Le label est sorti du flux pour que le select seul soit centré sur la ligne. */
  position: relative;
}

body.admin-mode .admin-panel.pos-bar .caisse-point-row .field label {
  position: absolute;
  left: 0;
  bottom: calc(100% + 2px);
  margin: 0;
  font-size: 11px;
}

body.admin-mode .admin-panel.pos-bar .caisse-point-row select {
  min-height: 32px;
  padding-top: 5px;
  padding-bottom: 5px;
}

body.admin-mode .admin-panel.pos-bar .caisse-orders-toggle {
  position: absolute;
  top: 50%;
  right: 190px;
  width: 40px;
  height: 40px;
  margin: 0;
  transform: translateY(-50%);
}

/* Barre POS absolue (64px) : dégage le contenu des onglets non-caisse
   (stock, ventes, assistance) pour qu'il ne passe pas sous la barre. */
body.admin-mode .admin-panel.pos-bar .admin-body:not(.admin-caisse-body) {
  padding-top: 72px;
}

body.admin-mode .admin-caisse-body {
  flex: 1 1 0%;
  height: 0;
  padding: 50px 24px 10dvh;
  overflow: hidden;
}

body.admin-mode .caisse-layout {
  flex: 1 1 auto;
  align-items: stretch;
  gap: 14px;
}

body.admin-mode .caisse-left {
  display: flex;
  flex-direction: column;
}

body.admin-mode .caisse-left > h4 {
  flex: 0 0 auto;
  margin-bottom: 8px !important;
}

body.admin-mode .caisse-product-grid {
  flex: 0 1 auto;
  grid-auto-rows: 142px;
  max-height: min(470px, calc(100dvh - 175px));
  padding: 2px 4px 4px 2px;
}

body.admin-mode .caisse-product-grid .menu-card {
  height: 142px;
  overflow: hidden;
  padding: 8px;
}

body.admin-mode .caisse-product-grid .menu-card .card-photo {
  height: 38px;
  object-fit: contain;
}

body.admin-mode .caisse-product-grid .menu-card .card-icon {
  margin-bottom: 2px;
  font-size: 24px;
}

body.admin-mode .caisse-product-grid .menu-card .card-name {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  font-size: 12px;
  line-height: 1.15;
}

body.admin-mode .caisse-product-grid .menu-card .card-price {
  font-size: 11px;
}

body.admin-mode .caisse-product-grid .menu-card .card-add {
  padding: 4px 10px;
  font-size: 10px;
}

body.admin-mode .caisse-footer-actions {
  flex: 0 0 auto;
  margin-top: auto;
}

@media (max-width: 768px) {
  body.admin-mode .admin-panel.pos-bar .admin-head {
    height: auto;
    min-height: 56px;
    padding: 8px 16px 8px 76px;
  }

  body.admin-mode .admin-panel.pos-bar .admin-head h3 {
    left: 50%;
    width: 48px;
    height: 48px;
    transform: translate(-50%, -50%);
  }

  body.admin-mode .admin-panel.pos-bar .admin-header-actions {
    right: 16px;
  }

  body.admin-mode .admin-panel.pos-bar .admin-point-bar {
    position: sticky;
    left: auto;
    height: auto;
    padding: 8px 16px;
    background: var(--cream);
    border-bottom: 1px solid rgba(110, 59, 30, 0.12);
  }

  /* Sur mobile la barre POS est en flux : sans sélecteur (onglets produits,
     sections, points, gérants, comptabilité) on la masque pour éviter un
     bandeau crème vide — le header porte déjà logo + Déconnexion. */
  body.admin-mode .admin-panel.pos-bar .admin-point-bar:empty {
    display: none;
  }

  body.admin-mode .admin-panel.pos-bar .caisse-point-row {
    min-height: 42px;
  }

  body.admin-mode .admin-panel.pos-bar .caisse-point-row .field label {
    /* Sur mobile, la barre n'est plus superposée : le label reprend sa place dans le flux. */
    position: static;
    margin-bottom: 2px;
  }

  body.admin-mode .admin-panel.pos-bar .caisse-orders-toggle {
    position: relative;
    top: auto;
    right: auto;
    transform: none;
  }

  body.admin-mode .admin-caisse-body {
    height: auto;
    padding: 16px 14px 24px;
    overflow: auto;
  }

  body.admin-mode .caisse-product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: min(42dvh, 360px);
  }
}

/* ===== CAISSE v3 : plein écran 2 colonnes + liste panier haute avec scroll ===== */
/* REMPLACE tout le bloc "CAISSE v2" ajouté à la fin de styles.css (de "/* ===== CAISSE : mise en page plein écran" jusqu'à la fin du fichier). */

/* --- Bureau / tablette large (> 900px) --- */
@media (min-width:901px){
  html body.admin-mode .admin-body.admin-caisse-body{
    display:flex;
    flex-direction:column;
    max-height:none;                /* annule calc(100vh - 120px) : pleine hauteur */
    overflow:hidden !important;
    padding-bottom:12px;
  }
  html body.admin-mode .admin-caisse-body .caisse-layout{
    flex:1 1 0;                     /* caisse-layout = toute la hauteur libre */
    min-height:0;
    height:auto;
    display:grid;
    grid-template-columns:minmax(0,1fr) 380px;
    grid-template-rows:minmax(0,1fr);   /* la rangée ne dépasse jamais l'écran */
    align-items:stretch;
    gap:20px;
  }
  html body.admin-mode .admin-caisse-body .caisse-left{
    min-width:0;
    min-height:0;
    overflow-y:auto;
    overscroll-behavior:contain;
  }
  html body.admin-mode .admin-caisse-body .caisse-right{
    position:static;
    width:auto;
    height:auto;                    /* étiré sur toute la hauteur par la grille */
    min-height:0;
    max-height:none;
    overflow:hidden;
    display:flex;
    flex-direction:column;
  }
  html body.admin-mode .admin-caisse-body .caisse-right .caisse-cart-body{
    flex:1 1 0;                     /* la liste prend tout l'espace libre */
    min-height:0;
    max-height:none;
    overflow-y:auto;                /* scroll vertical de la commande */
    overscroll-behavior:contain;
    padding-right:6px;
    margin-bottom:8px;
  }
  html body.admin-mode .admin-caisse-body .caisse-footer-actions{
    flex:0 0 auto;
    margin-top:10px;
  }
}

/* --- Mobile / petite tablette (≤ 900px) --- */

/* =======================================================
   MOBILE : produits sur une LIGNE (scroll horizontal),
   caisse en plein écran avec scroll vertical des articles
   ======================================================= */
@media (max-width: 768px) {
  /* La caisse n'est plus fixée en bas : plus besoin de grand padding réservé. */
  body.admin-mode .admin-body.caisse-active {
    padding-right: 0;
    padding-bottom: 24px;
  }
 
  .caisse-layout {
    flex-direction: column;
    height: auto;
    min-height: 0;
  }
 
  .caisse-left {
    padding-right: 0;
    overflow-y: visible;
    height: auto;
    flex: 0 0 auto;
  }
 
  /* Produits : une seule ligne, défilement horizontal (gauche ↔ droite) */
  body.admin-mode .caisse-left .card-grid,
  body.admin-mode .caisse-product-grid {
    display: flex !important;
    flex: 0 0 auto;
    height: auto;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    gap: 10px !important;
    padding: 2px 2px 10px !important;
    touch-action: pan-x;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }
 
  body.admin-mode .caisse-left .card-grid .menu-card,
  body.admin-mode .caisse-product-grid .menu-card {
    flex: 0 0 auto;
    min-width: 150px;
    max-width: 180px;
    flex-shrink: 0;
  }
 
  body.admin-mode .caisse-left .card-grid .menu-card .card-photo,
  body.admin-mode .caisse-product-grid .menu-card .card-photo {
    height: 60px;
  }
 
  body.admin-mode .caisse-left .card-grid .menu-card .card-name,
  body.admin-mode .caisse-product-grid .menu-card .card-name {
    font-size: 12px;
  }
 
  body.admin-mode .caisse-left .card-grid .menu-card .card-price,
  body.admin-mode .caisse-product-grid .menu-card .card-price {
    font-size: 11px;
  }
 
  body.admin-mode .caisse-left .card-grid .menu-card .card-add,
  body.admin-mode .caisse-product-grid .menu-card .card-add {
    font-size: 10px;
    padding: 4px 10px;
  }
 
  /* Caisse : plein écran sous la rangée produits */
  .caisse-right {
    position: static !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: calc(100dvh - 140px) !important;
    max-height: none !important;
    border-left: none !important;
    border-top: 1px solid rgba(110,59,30,0.15) !important;
    z-index: auto !important;
    box-shadow: none !important;
    border-radius: 12px !important;
    padding: 14px !important;
    overflow: visible !important;
  }
 
  .caisse-right .caisse-cart-body {
    max-height: min(45dvh, 420px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 6px !important;
  }
 
  .caisse-cart-header {
    margin-bottom: 10px;
    padding-bottom: 8px;
  }
 
  .caisse-cart-header h4 {
    font-size: 14px;
  }
 
  .caisse-cart-footer {
    padding-top: 8px;
    margin-top: auto;
  }
 
  /* Commandes en attente sur mobile */
  .pending-order-card {
    padding: 10px 12px;
  }
 
  .pending-order-card .order-info .order-client {
    font-size: 13px;
  }
 
  .pending-order-card .order-info .order-detail {
    font-size: 11px;
  }
 
  .pending-order-card .order-total {
    font-size: 12px;
  }
 
  .pending-order-card .import-btn {
    font-size: 10px;
    padding: 4px 10px;
  }
}

/* --- Lignes du panier : nom complet visible, boutons +/- jamais écrasés --- */
html body.admin-mode .caisse-cart-body > div > div:first-child{ min-width:0; overflow-wrap:anywhere; }
html body.admin-mode .caisse-cart-body > div > div:last-child{ flex-shrink:0; }

/* --- Pied de caisse compact pour libérer de la hauteur --- */
html body.admin-mode .caisse-cart-footer > div[style]{ margin:6px 0 !important; }
html body.admin-mode .caisse-cart-footer .field{ margin-bottom:8px; }
html body.admin-mode .caisse-cart-footer .field input{ padding:8px 12px; }
html body.admin-mode .caisse-cart-footer .seg{ flex-wrap:nowrap; gap:6px; }
html body.admin-mode .caisse-cart-footer .seg button{ min-width:0; padding:8px 4px; font-size:11px; }