/* ===================================================
   Variables & Reset
   =================================================== */
:root {
  --primary:        #2563eb;
  --primary-dark:   #1d4ed8;
  --primary-light:  #eff6ff;
  --success:        #16a34a;
  --success-light:  #f0fdf4;
  --danger:         #dc2626;
  --danger-light:   #fef2f2;
  --warning:        #d97706;
  --warning-light:  #fffbeb;

  --bg:          #f1f5f9;
  --card:        #ffffff;
  --text:        #0f172a;
  --text-muted:  #64748b;
  --border:      #e2e8f0;
  --input-bg:    #f8fafc;

  --sidebar-w:   260px;
  --topbar-h:    60px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.08);
  --shadow:    0 1px 4px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,.12);

  --radius:    10px;
  --radius-sm:  6px;
  --radius-xs:  4px;
  --transition: .2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style: none; }

code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: .85em;
  background: #e2e8f0;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  letter-spacing: .03em;
}

/* ===================================================
   Utilities
   =================================================== */
.hidden   { display: none !important; }
.text-muted { color: var(--text-muted); font-size: .9em; }
.mt-4  { margin-top: 1rem; }
.mb-3  { margin-bottom: .75rem; }
.inline-form { display: inline; }

/* ===================================================
   Buttons
   =================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  white-space: nowrap;
  line-height: 1.2;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }

.btn-primary  { background: var(--primary);   color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-outline  { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); }

.btn-ghost    { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--border); color: var(--text); }

.btn-danger   { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

.btn-sm   { padding: .35rem .7rem; font-size: .8rem; }
.btn-full { width: 100%; justify-content: center; padding: .8rem 1rem; font-size: .95rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }

.btn-back {
  color: var(--text-muted);
  font-size: .85rem;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}
.btn-back:hover { color: var(--text); text-decoration: none; }

.btn-logout {
  font-size: .78rem;
  color: #94a3b8;
  padding: .25rem .6rem;
  border-radius: var(--radius-xs);
  transition: background var(--transition), color var(--transition);
}
.btn-logout:hover { background: rgba(255,255,255,.1); color: #f1f5f9; text-decoration: none; }

/* ===================================================
   Alerts
   =================================================== */
.alert {
  padding: .85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  border-left: 3px solid;
  margin-bottom: 1.25rem;
}
.alert-success { background: var(--success-light); border-color: var(--success); color: #166534; }
.alert-danger  { background: var(--danger-light);  border-color: var(--danger);  color: #991b1b; }
.alert-warning { background: var(--warning-light); border-color: var(--warning); color: #92400e; }
.error-list    { padding-left: 1.25rem; margin: 0; }
.error-list li { margin-bottom: .2rem; }

/* ===================================================
   Badges
   =================================================== */
.badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.badge-success { background: var(--success-light); color: var(--success);  border: 1px solid #bbf7d0; }
.badge-warning { background: var(--warning-light); color: var(--warning); border: 1px solid #fde68a; }

/* ===================================================
   Forms
   =================================================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.form-group label {
  font-size: .875rem;
  font-weight: 500;
  color: var(--text);
}
.required { color: var(--danger); }

.form-control {
  width: 100%;
  padding: .6rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  background: var(--input-bg);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
  background: #fff;
}
.form-control[readonly] { background: var(--bg); color: var(--text-muted); cursor: default; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.form-grid .form-actions,
.form-grid .form-info,
.form-grid .form-full { grid-column: 1 / -1; }

.form-actions {
  display: flex;
  gap: .75rem;
  padding-top: .5rem;
  flex-wrap: wrap;
}
.form-info {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1rem;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  color: #1e40af;
}

.filter-bar {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  align-items: flex-end;
}
.filter-bar .form-control { flex: 1; min-width: 150px; width: auto; }

/* ===================================================
   Cards
   =================================================== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
  flex-wrap: wrap;
}
.card-header h2 { font-size: 1rem; font-weight: 600; }
.card-body { padding: 1.25rem; }

/* ===================================================
   Tables
   =================================================== */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.table th {
  text-align: left;
  padding: .65rem .75rem;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: .75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg); }
.table .actions { display: flex; gap: .5rem; white-space: nowrap; }

.id-code { font-size: .78rem; letter-spacing: .05em; }
.id-code-lg {
  font-size: 1.15rem;
  letter-spacing: .12em;
  background: var(--primary-light);
  color: #1e40af;
  padding: .35rem .75rem;
  border-radius: var(--radius-xs);
}
.id-display {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .9rem 1rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
}
.id-display label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.device-row {
  display: flex;
  gap: .65rem;
  align-items: center;
}
.device-row .form-control { flex: 1; min-width: 0; }

/* ===================================================
   Stats Grid (Dashboard)
   =================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem 1.25rem;
  text-align: center;
}
.stat-value {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.1;
}
.stat-label {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: .45rem;
}
.stat-card-accent {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
}
.stat-card-accent .stat-value,
.stat-card-accent .stat-label {
  color: #fff;
}
.dash-bar-wrap {
  background: #e2e8f0;
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
}
.dash-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #0ea5e9);
  border-radius: 99px;
  transition: width .4s ease;
  min-width: 4px;
}

/* ===================================================
   Login Layout
   =================================================== */
.login-layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #1e3a8a 0%, #2563eb 60%, #0ea5e9 100%);
  padding: 1rem;
}
.login-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
}
.login-header { text-align: center; margin-bottom: 2rem; }
.login-icon   { font-size: 2.75rem; display: block; margin-bottom: .75rem; }
.login-header h1 { font-size: 1.5rem; font-weight: 700; }
.login-header p  { color: var(--text-muted); font-size: .9rem; margin-top: .25rem; }
.login-form { display: flex; flex-direction: column; gap: 1.1rem; }

/* ===================================================
   Admin Layout
   =================================================== */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* — Sidebar — */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: #1e293b;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.2rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.brand-icon { font-size: 1.4rem; }
.brand-name { font-size: .95rem; font-weight: 700; color: #f1f5f9; letter-spacing: .3px; }

.sidebar-nav { padding: .6rem 0; flex: 1; }
.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1.25rem;
  color: #94a3b8;
  font-size: .875rem;
  transition: background var(--transition), color var(--transition);
}
.sidebar-nav li a:hover,
.sidebar-nav li.active a {
  background: rgba(255,255,255,.06);
  color: #f1f5f9;
  text-decoration: none;
}
.sidebar-nav li.active a {
  background: rgba(37,99,235,.22);
  color: #93c5fd;
  border-left: 3px solid #3b82f6;
}
.nav-icon { font-size: .95rem; width: 1.2rem; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  padding: .9rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.admin-user { font-size: .78rem; color: #94a3b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 99;
}
.sidebar-overlay.visible { display: block; }

/* — Content area — */
.admin-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  transition: margin-left var(--transition);
}

/* Sidebar collapse (desktop) */
body.sidebar-collapsed .sidebar       { transform: translateX(-100%); }
body.sidebar-collapsed .admin-content { margin-left: 0; }
body.sidebar-collapsed .menu-toggle   { display: block; }

/* Close button inside sidebar */
.sidebar-close-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: .2rem .35rem;
  border-radius: 6px;
  flex-shrink: 0;
}
.sidebar-close-btn:hover { background: rgba(255,255,255,.08); color: #f1f5f9; }
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.page-title { font-size: 1rem; font-weight: 600; }
.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text);
  padding: .25rem .4rem;
  border-radius: var(--radius-xs);
  line-height: 1;
}
.menu-toggle:hover { background: var(--bg); }
.content-area { padding: 1.5rem; flex: 1; }

/* ===================================================
   Public Layout
   =================================================== */
.public-layout {
  min-height: 100vh;
  background: linear-gradient(160deg, #eff6ff 0%, #f1f5f9 60%);
  display: flex;
  flex-direction: column;
}
.public-nav {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: .9rem 1.5rem;
  display: flex;
  align-items: center;
  box-shadow: var(--shadow-sm);
}
.nav-brand {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.nav-brand:hover { text-decoration: none; }

.public-main {
  flex: 1;
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.public-hero {
  text-align: center;
  padding: 2rem 0 1.5rem;
}
.hero-icon    { font-size: 3.5rem; margin-bottom: .75rem; }
.public-hero h1 { font-size: 1.8rem; font-weight: 700; margin-bottom: .5rem; }
.public-hero p  { color: var(--text-muted); font-size: .95rem; }

.public-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem;
  margin-bottom: 1.25rem;
}
.public-card h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: .5rem; }
.wallet-help-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .9rem;
  padding: .9rem 1rem;
  margin-bottom: 1.25rem;
  border: 1px solid #bfdbfe;
  background: linear-gradient(135deg, #eff6ff, #f8fafc);
  border-radius: 12px;
}
.wallet-help-banner strong {
  display: block;
  font-size: .9rem;
  margin-bottom: .15rem;
}
.wallet-help-banner span {
  display: block;
  color: var(--text-muted);
  font-size: .82rem;
}
.wallet-guide-hero {
  background: linear-gradient(145deg, #0f172a, #1d4ed8);
  color: #fff;
}
.wallet-guide-hero h2 { color: #fff; }
.wallet-guide-hero .text-muted { color: rgba(255,255,255,.8); }
.wallet-guide-eyebrow {
  display: inline-block;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: .22rem .55rem;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  margin-bottom: .85rem;
  background: rgba(255,255,255,.08);
}
.wallet-guide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.wallet-guide-card h3 {
  font-size: 1rem;
  margin-bottom: .9rem;
}
.wallet-guide-platform {
  display: inline-flex;
  align-items: center;
  padding: .28rem .55rem;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: .74rem;
  font-weight: 700;
  margin-bottom: .75rem;
}
.wallet-guide-steps {
  list-style: decimal;
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  color: var(--text);
  font-size: .9rem;
}
.wallet-guide-checklist,
.wallet-guide-tips,
.wallet-guide-faq {
  display: grid;
  gap: .8rem;
}
.wallet-guide-check,
.wallet-guide-tip,
.wallet-guide-faq-item {
  padding: .9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--input-bg);
  font-size: .9rem;
}
.wallet-guide-check::before {
  content: "✓";
  color: var(--success);
  font-weight: 700;
  margin-right: .5rem;
}
.wallet-guide-tip strong,
.wallet-guide-faq-item strong {
  display: block;
  margin-bottom: .25rem;
}
.wallet-guide-tip span,
.wallet-guide-faq-item span {
  color: var(--text-muted);
  font-size: .85rem;
}
.wallet-guide-actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}
@media (max-width: 640px) {
  .wallet-help-banner {
    flex-direction: column;
    align-items: flex-start;
  }
  .wallet-guide-grid {
    grid-template-columns: 1fr;
  }
}

/* ===================================================
   User management — badges & role picker
   =================================================== */
.badge-info        { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.badge-role-admin  { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; font-weight: 600; }
.badge-role-user   { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }

.role-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  margin-top: .25rem;
}
.role-option input[type="radio"] { display: none; }
.role-card {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  padding: .9rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  background: var(--input-bg);
}
.role-card .role-icon { font-size: 1.4rem; margin-bottom: .2rem; }
.role-card strong     { font-size: .9rem; }
.role-card small      { font-size: .78rem; color: var(--text-muted); }
.role-option input:checked + .role-card {
  border-color: var(--primary);
  background: var(--primary-light);
}
.role-option input:disabled + .role-card { opacity: .5; cursor: not-allowed; }
@media (max-width: 480px) { .role-options { grid-template-columns: 1fr; } }

/* ===================================================
   Settings page
   =================================================== */
.form-settings { display: flex; flex-direction: column; }

.setting-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 2rem;
  align-items: start;
  padding: 1.25rem 0;
}
.setting-label label {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  display: block;
  margin-bottom: .3rem;
}
.setting-control { display: flex; flex-direction: column; gap: .4rem; }
.setting-input-sm { max-width: 180px; }
.setting-divider  { border: none; border-top: 1px solid var(--border); margin: 0; }

/* Ticket editor */
.ticket-editor-wrap {
  display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap;
}
.ticket-editor-form { flex: 1; min-width: 220px; }
.radio-inline, .checkbox-inline {
  display: flex; align-items: center; gap: .4rem;
  font-size: .88rem; cursor: pointer; user-select: none;
}
.radio-inline input, .checkbox-inline input { cursor: pointer; }

.ticket-preview-wrap { flex: 0 0 auto; }
.ticket-preview-label {
  font-size: .75rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: .4rem;
}
.ticket-preview {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: .75rem .6rem;
  width: 210px;
  font-family: 'Courier New', Courier, monospace;
  font-size: .72rem;
  line-height: 1.55;
  box-shadow: 2px 2px 6px rgba(0,0,0,.08);
  color: #111;
  white-space: pre-wrap;
  word-break: break-all;
}
.tp-line   { display: block; }
.tp-center { text-align: center; }
.tp-right  { text-align: right; }
.tp-bold   { font-weight: 700; }
.tp-large  { font-size: 1rem; line-height: 1.3; }
.tp-huge   { font-size: 1.15rem; font-weight: 700; line-height: 1.3; letter-spacing: .04em; }
.tp-xsmall { font-size: .58rem; line-height: 1.4; color: #4b5563; }
.tp-small  { font-size: .68rem; }
.tp-muted  { color: #6b7280; }
.tp-sep    { text-align: center; color: #9ca3af; letter-spacing: .02em; }

/* Header-lines editor */
.hl-row {
  display: flex; align-items: center; gap: .3rem;
  background: var(--bg); border: 1px solid var(--border-color);
  border-radius: 8px; padding: .3rem .45rem;
}
.hl-row-sep { background: var(--bg-alt); }
.hl-reorder { display: flex; flex-direction: column; gap: 0; }
.hl-reorder button {
  background: none; border: none; cursor: pointer; padding: 0 .1rem;
  font-size: .7rem; color: var(--text-muted); line-height: 1.2;
}
.hl-reorder button:hover { color: var(--text); }
.hl-sep-label { flex: 1; text-align: center; color: var(--text-muted); font-size: .82rem; font-style: italic; }
.hl-select {
  font-size: .78rem; padding: .2rem .25rem;
  border: 1px solid var(--border-color); border-radius: 6px;
  background: var(--bg-input, #fff); cursor: pointer; color: var(--text);
}
.hl-toggle-btn {
  padding: .18rem .38rem; border: 1px solid var(--border-color); border-radius: 6px;
  background: none; cursor: pointer; font-size: .78rem; color: var(--text-muted);
  white-space: nowrap;
}
.hl-toggle-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.hl-align-group { display: flex; border: 1px solid var(--border-color); border-radius: 6px; overflow: hidden; }
.hl-align-btn {
  padding: .18rem .32rem; border: none; border-right: 1px solid var(--border-color);
  background: none; cursor: pointer; color: var(--text-muted); display: flex; align-items: center;
}
.hl-align-btn:last-child { border-right: none; }
.hl-align-btn.active { background: var(--primary); color: #fff; }
.hl-del-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: .85rem; padding: .15rem .28rem; border-radius: 4px;
}
.hl-del-btn:hover { color: var(--danger); }

/* — settings full-width grid — */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(560px, 1fr));
  gap: 1.5rem;
  align-items: start;
}

/* Ticket line editor */
.tl-row { border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; background: var(--bg); transition: opacity .15s, box-shadow .15s; }
.tl-row + .tl-row { margin-top: 0; }
.tl-row-main { display: flex; align-items: center; gap: .3rem; padding: .3rem .45rem; }
.tl-row-vars {
  display: flex; align-items: center; gap: .3rem; flex-wrap: wrap;
  padding: .22rem .45rem .28rem 2.1rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-alt, #f8fafc);
}
.tl-var-btn {
  padding: .1rem .3rem; border: 1px solid var(--border-color); border-radius: 4px;
  background: none; cursor: pointer; font-size: .7rem; color: var(--text-muted);
  white-space: nowrap;
}
.tl-var-btn:hover { background: var(--bg); color: var(--text); }
.tl-row-special .tl-row-main { background: var(--bg-alt, #f8fafc); }

/* Drag & drop */
.tl-drag-handle {
  cursor: grab; color: var(--text-muted); font-size: 1rem; padding: 0 .25rem;
  line-height: 1; user-select: none; flex-shrink: 0; opacity: .55;
  transition: opacity .1s;
}
.tl-drag-handle:hover { opacity: 1; color: var(--text); }
.tl-row-dragging { opacity: .4; box-shadow: 0 4px 16px rgba(0,0,0,.15); }
.tl-row-drag-over { box-shadow: 0 0 0 2px var(--primary); background: var(--primary-light, #eff6ff); }
.danger-zone .card-header { background: #fff1f1; border-bottom-color: #fca5a5; }
.danger-zone .card-header h2 { color: var(--danger); font-size: 1rem; }

.preview-badge {
  display: inline-block;
  background: var(--primary-light);
  color: #1e40af;
  border-radius: var(--radius-xs);
  padding: .15rem .55rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .06em;
}
.input-with-suffix {
  display: flex;
  align-items: center;
  gap: 0;
  max-width: 180px;
}
.input-with-suffix .form-control {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  border-right: none;
}
.input-suffix {
  padding: .6rem .85rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
  font-weight: 600;
  font-size: .9rem;
  white-space: nowrap;
}
.form-hint { font-size: .78rem; color: var(--text-muted); margin-top: .2rem; }

/* Groupe identifiant : préfixe figé + champ suffixe */
.id-input-group {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}
.id-input-group:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.id-prefix-badge {
  display: flex;
  align-items: center;
  padding: 0 .85rem;
  background: var(--bg);
  border-right: 1px solid var(--border);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--text-muted);
  white-space: nowrap;
  user-select: none;
}
.id-suffix-input {
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  flex: 1;
  min-width: 0;
}

@media (max-width: 600px) {
  .setting-row { grid-template-columns: 1fr; gap: .75rem; }
  .setting-input-sm, .input-with-suffix { max-width: 100%; }
}

/* ===================================================
   Credit card (public home)
   =================================================== */

/* State groups — hidden by default, JS reveals the active one */
.state-group { display: none; }

#state-loading {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 1rem;
}

.cc-wrap {
  max-width: 480px;
  margin: 0 auto 1.5rem;
}

.cc-card {
  position: relative;
  width: 100%;
  aspect-ratio: 1.586;
  border-radius: 20px;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 50%, #2563eb 100%);
  padding: 1.3rem 1.5rem;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  box-shadow:
    0 24px 64px rgba(15, 23, 42, .55),
    0 8px 24px rgba(37, 99, 235, .4),
    inset 0 1px 0 rgba(255,255,255,.15);
  user-select: none;
  transition: transform .35s ease, box-shadow .35s ease;
}
.cc-card:hover {
  transform: translateY(-5px) scale(1.015);
  box-shadow:
    0 36px 80px rgba(15, 23, 42, .6),
    0 12px 32px rgba(37, 99, 235, .5),
    inset 0 1px 0 rgba(255,255,255,.2);
}

/* Reflet brillant */
.cc-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg,
    rgba(255,255,255,.10) 0%,
    rgba(255,255,255,.03) 40%,
    transparent 60%);
  border-radius: 20px;
  pointer-events: none;
  z-index: 0;
}

/* Bulles décoratives */
.cc-circle   { position: absolute; border-radius: 50%; pointer-events: none; }
.cc-circle-1 {
  width: 300px; height: 300px;
  top: -120px;  right: -80px;
  background: radial-gradient(circle, rgba(255,255,255,.07) 0%, transparent 60%);
}
.cc-circle-2 {
  width: 220px; height: 220px;
  bottom: -80px; left: -60px;
  background: radial-gradient(circle, rgba(96,165,250,.12) 0%, transparent 65%);
}

/* ── Ligne 1 : Brand + cercles réseau ── */
.cc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
  z-index: 1;
}
.cc-brand-name {
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
  opacity: .9;
}

/* Cercles type Mastercard */
.cc-network {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}
.cc-net-a, .cc-net-b {
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  top: 50%;
  transform: translateY(-50%);
}
.cc-net-a { left: 0;  background: #f59e0b; opacity: .95; }
.cc-net-b { right: 0; background: #ef4444; opacity: .80; }

/* ── Ligne 2 : Puce + Solde ── */
.cc-mid {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 1;
}

/* Puce EMV dorée */
.cc-chip {
  width: 44px;
  height: 34px;
  border-radius: 6px;
  background: linear-gradient(145deg, #c8922a 0%, #f5d270 35%, #d4a84b 55%, #c8922a 100%);
  box-shadow: 0 2px 6px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.25);
  position: relative;
  flex-shrink: 0;
}
/* Lignes de la puce */
.cc-chip::before {
  content: '';
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 1.5px;
  background: rgba(0,0,0,.22);
  transform: translateY(-50%);
}
.cc-chip::after {
  content: '';
  position: absolute;
  left: 50%; top: 18%; bottom: 18%;
  width: 1.5px;
  background: rgba(0,0,0,.22);
  transform: translateX(-50%);
}

/* Solde à droite de la puce */
.cc-balance { text-align: right; }
.cc-balance-label {
  font-size: .55rem;
  text-transform: uppercase;
  letter-spacing: .2em;
  opacity: .55;
  margin-bottom: .25rem;
}
.cc-balance-amount {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: .4rem;
}
.cc-amount {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.01em;
}
.cc-currency {
  font-size: .88rem;
  font-weight: 600;
  opacity: .7;
  letter-spacing: .08em;
}

/* ── Ligne 3 : Numéro / Identifiant ── */
.cc-number-row {
  position: relative;
  z-index: 1;
}
.cc-number {
  font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 1.1rem;
  letter-spacing: .22em;
  opacity: .88;
  display: block;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0,0,0,.3);
}

/* ── Ligne 4 : Titulaire + Commission ── */
.cc-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  position: relative;
  z-index: 1;
  gap: .5rem;
}
.cc-footer-col { min-width: 0; }

.cc-label {
  font-size: .5rem;
  text-transform: uppercase;
  letter-spacing: .18em;
  opacity: .5;
  margin-bottom: .18rem;
  white-space: nowrap;
}
.cc-name {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .07em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.cc-commission-val {
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .05em;
  opacity: .8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

/* ===================================================
   Member details (public home — registered device)
   =================================================== */
.member-details { display: flex; flex-direction: column; gap: .85rem; margin-top: .5rem; }
.detail-row     { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; }
.detail-row dt  {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  min-width: 85px;
  flex-shrink: 0;
}
.detail-row dd { font-size: .95rem; color: var(--text); }


/* ===================================================
   Toast de notification débit
   =================================================== */
.tx-toast {
  position: fixed;
  top: -120px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #fff;
  padding: .9rem 1.5rem;
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(0,0,0,.3);
  z-index: 9000;
  text-align: center;
  min-width: 200px;
  max-width: 320px;
  cursor: pointer;
  transition: top .4s cubic-bezier(.34,1.56,.64,1);
  user-select: none;
}
.tx-toast.toast-visible { top: 1rem; }
.tx-toast-amount { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }
.tx-toast-desc   { font-size: .78rem; opacity: .85; margin-top: .2rem; }

/* ===================================================
   Écran de confirmation de paiement
   =================================================== */
.confirm-screen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: linear-gradient(160deg, #16a34a 0%, #15803d 50%, #166534 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .25s ease;
}
.confirm-screen.hidden { display: none !important; }

.confirm-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem 1.5rem;
  text-align: center;
  color: #fff;
  width: 100%;
  max-width: 420px;
}

/* Cercle animé avec coche */
.confirm-check {
  width: 96px;
  height: 96px;
  animation: popIn .45s cubic-bezier(.175,.885,.32,1.275) both,
             checkPulse 2.8s .45s ease-in-out infinite;
}
@keyframes popIn {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
@keyframes checkPulse {
  0%, 100% { transform: scale(1);    filter: drop-shadow(0 0 0px  rgba(255,255,255,.0)); }
  50%      { transform: scale(1.12); filter: drop-shadow(0 0 18px rgba(255,255,255,.5)); }
}
.check-svg { width: 100%; height: 100%; overflow: visible; }

.check-circle {
  stroke: rgba(255,255,255,.35);
  stroke-width: 3;
}
.check-tick {
  stroke: #fff;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 38;
  stroke-dashoffset: 38;
  animation: drawTickLoop 2.8s .45s ease-in-out infinite;
}
@keyframes drawTickLoop {
  0%   { stroke-dashoffset: 38; opacity: .4; }
  25%  { stroke-dashoffset: 0;  opacity: 1;  }
  65%  { stroke-dashoffset: 0;  opacity: 1;  }
  90%  { stroke-dashoffset: 38; opacity: .4; }
  100% { stroke-dashoffset: 38; opacity: .4; }
}

.confirm-card-name {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: .95;
  margin-bottom: .15rem;
}

.confirm-label {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .85;
}

.confirm-amount-wrap {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  animation: slideUp .35s .1s ease both;
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.confirm-amount {
  font-size: clamp(3.5rem, 15vw, 5.5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.02em;
}
.confirm-currency {
  font-size: 1.6rem;
  font-weight: 700;
  opacity: .8;
}

.confirm-desc {
  font-size: .95rem;
  opacity: .75;
  max-width: 280px;
  display: none;
}

/* Minuterie circulaire */
.confirm-timer-wrap {
  position: relative;
  width: 56px;
  height: 56px;
  margin-top: .5rem;
}
.timer-svg { width: 56px; height: 56px; transform: rotate(-90deg); }
.timer-track {
  stroke: rgba(255,255,255,.2);
  stroke-width: 3.5;
}
.timer-arc {
  stroke: #fff;
  stroke-width: 3.5;
  stroke-linecap: round;
}
.timer-count {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

.confirm-close-btn {
  margin-top: .5rem;
  background: rgba(255,255,255,.18);
  color: #fff;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 10px;
  padding: .6rem 2rem;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background .2s;
}
.confirm-close-btn:hover { background: rgba(255,255,255,.28); }

/* ===================================================
   Modal paiement
   =================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: fadeIn .2s ease;
}
.modal-overlay.hidden { display: none !important; }

.modal-box {
  background: var(--card);
  border-radius: 24px 24px 0 0;
  padding: 2rem 1.5rem 2.5rem;
  width: 100%;
  max-width: 520px;
  position: relative;
  animation: slideUp .28s cubic-bezier(.4,0,.2,1);
}
@keyframes fadeIn  { from { opacity: 0 }          to { opacity: 1 } }
@keyframes slideUp { from { transform: translateY(100%) } to { transform: translateY(0) } }

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--bg);
  border: none;
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  font-size: .85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.modal-close:hover { background: var(--border); }

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 .25rem;
}
.modal-subtitle {
  font-size: .875rem;
  color: var(--text-muted);
  margin: 0 0 1.5rem;
}
.modal-subtitle strong { color: var(--primary); }

/* Tap hint sous la carte */
.cc-tap-hint {
  text-align: center;
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .4rem;
  letter-spacing: .03em;
  pointer-events: none;
}

/* Liste des transactions (public) */
.tx-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.tx-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--border);
}
.tx-item:last-child { border-bottom: none; }
.tx-info { min-width: 0; }
.tx-desc {
  font-size: .9rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tx-date {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .15rem;
}
.tx-amount {
  font-size: .95rem;
  font-weight: 700;
  color: #ef4444;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Transaction récente — mise en évidence verte */
.tx-item.tx-recent {
  background: linear-gradient(90deg, rgba(22,163,74,.08) 0%, rgba(22,163,74,.04) 100%);
  border-radius: 10px;
  margin: 0 -.5rem;
  padding: .75rem .5rem;
  border-bottom-color: rgba(22,163,74,.2);
  position: relative;
}
.tx-item.tx-recent:last-child { border-bottom: none; }

/* Disque SVG de décompte (remplace le badge pill) */
.tx-timer-disc {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  position: absolute;
  top: .5rem;
  right: 0;
}
.disc-svg {
  width: 22px;
  height: 22px;
  transform: rotate(-90deg);
  overflow: hidden;
}
.disc-track {
  fill: rgba(22,163,74,.18);
  stroke: none;
}
.disc-fill {
  fill: none;
  stroke: #16a34a;
  stroke-width: 12;           /* 2×r → couvre tout le disque */
  stroke-dasharray: 37.6991;  /* 2π×6 */
  stroke-linecap: butt;
}

.tx-amount-recent {
  color: #16a34a;
}

/* ===================================================
   Spinner*/
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.public-footer {
  text-align: center;
  padding: 1.25rem;
  color: var(--text-muted);
  font-size: .8rem;
  border-top: 1px solid var(--border);
  background: var(--card);
}

/* ===================================================
   Responsive — Mobile
   =================================================== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-md);
  }
  .menu-toggle    { display: block; }
  .admin-content  { margin-left: 0; }
  .content-area   { padding: 1rem; }
  .form-grid      { grid-template-columns: 1fr; }
  .filter-bar     { flex-direction: column; }
  .filter-bar .form-control { width: 100%; }
  .table th, .table td { padding: .55rem .6rem; font-size: .8rem; }
  .stats-grid     { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .stats-grid  { grid-template-columns: 1fr; }
  .login-card  { padding: 2rem 1.25rem; }
  .public-main { padding: 1.25rem 1rem 2rem; }
}


/* ═══════════════════════════════════════════════════════
   CAISSE ENREGISTREUSE
   ═══════════════════════════════════════════════════════ */

/* ── Layout global ── */
.caisse-layout {
  margin: 0; padding: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #f1f5f9;
  overflow: hidden;
}

#caisse-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* ── Plein écran (loading / non autorisé) ── */
.caisse-fullscreen {
  position: fixed; inset: 0;
  background: #0f172a;
  color: #e2e8f0;
  display: flex; align-items: center; justify-content: center;
  z-index: 20;
}
.caisse-loading-inner { text-align: center; }
.spinner-light { border-top-color: #fff; }
.caisse-auth-box {
  text-align: center; padding: 2rem; max-width: 360px;
}
.caisse-auth-icon { font-size: 3rem; margin-bottom: 1rem; }
.device-id-note {
  font-size: .65rem; color: #94a3b8; margin-top: 1.5rem; word-break: break-all;
}

/* ── Topbar ── */
.caisse-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1rem;
  height: 52px;
  background: #0f172a;
  color: #f8fafc;
  flex-shrink: 0;
  gap: .75rem;
}
.caisse-topbar-left {
  display: flex; align-items: center; gap: .6rem;
  flex: 1;
}
.topbar-icon { opacity: .6; flex-shrink: 0; }
.caisse-name-badge {
  font-size: .8rem; font-weight: 700;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.15);
  color: #f1f5f9;
  padding: .25rem .7rem;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: .03em;
}
.caisse-topbar-center { flex: 1; display: flex; justify-content: center; }
.caisse-clock {
  font-size: 1.1rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #94a3b8;
  letter-spacing: .05em;
}
.caisse-topbar-right { flex: 1; display: flex; justify-content: flex-end; align-items: center; gap: .5rem; }

/* Bluetooth status button */
.bt-status-btn {
  display: flex; align-items: center; gap: .35rem;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  color: #94a3b8;
  padding: .45rem .8rem;
  font-size: .8rem; font-weight: 600;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
  white-space: nowrap;
}
.bt-status-btn:hover { background: rgba(255,255,255,.14); }
.bt-status-btn.bt-connected    { color: #34d399; border-color: rgba(52,211,153,.35); background: rgba(52,211,153,.1); }
.bt-status-btn.bt-connecting   { color: #fbbf24; border-color: rgba(251,191,36,.35);  background: rgba(251,191,36,.08); }
.bt-status-btn.bt-disconnected { color: #94a3b8; border-color: rgba(255,255,255,.12); background: rgba(255,255,255,.06); cursor: pointer; }
.bt-status-btn.bt-connecting svg { animation: bt-pulse 1s ease-in-out infinite; }
@keyframes bt-pulse { 0%,100% { opacity:1; } 50% { opacity:.3; } }

/* Mobile cart toggle button */
.caisse-cart-toggle-btn {
  display: none;
  position: relative;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  color: #f8fafc;
  border-radius: 10px;
  padding: .5rem .8rem;
  cursor: pointer;
  gap: .4rem;
  align-items: center;
}
.cart-badge {
  background: #ef4444;
  color: #fff;
  border-radius: 50%;
  font-size: .65rem;
  font-weight: 800;
  min-width: 1.1rem; height: 1.1rem;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ── Body ── */
.caisse-body {
  display: flex; flex: 1; overflow: hidden; min-height: 0;
}

/* ── Articles panel ── */
.caisse-articles-panel {
  flex: 1; overflow-y: auto; min-height: 0;
  padding: 1rem;
  background: #f1f5f9;
}
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--article-min-width, 150px), 1fr));
  gap: .85rem;
}
.article-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  padding: 0;
  text-align: left;
  transition: transform .12s ease, box-shadow .12s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
  position: relative;
}
.article-card:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,.1);
  transform: translateY(-2px);
}
.article-card:active {
  transform: scale(.96);
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.article-card-img-wrap {
  position: relative;
  width: 100%; height: var(--article-img-height, 120px);
  background: #f8fafc;
  overflow: hidden;
}
.article-card-img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .2s ease;
}
.article-card:hover .article-card-img { transform: scale(1.05); }
.article-card-no-img {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem;
  background: linear-gradient(135deg, #e0e7ff 0%, #f0fdf4 100%);
}
.article-card-add { display: none; }
.stock-badge {
  position: absolute;
  top: .35rem; right: .35rem;
  min-width: 1.5rem; height: 1.5rem;
  padding: 0 .35rem;
  border-radius: 99px;
  font-size: .72rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.stock-ok    { background: #16a34a; color: #fff; }
.stock-low   { background: #d97706; color: #fff; }
.stock-empty { background: #dc2626; color: #fff; }
.article-card-info {
  padding: .6rem .7rem .7rem;
  display: flex; flex-direction: column; gap: .15rem;
}
/* Sans image : centrer le texte et augmenter le padding */
.article-card.no-image {
  justify-content: center;
}
.article-card.no-image .article-card-info {
  flex: 1;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: .75rem .5rem;
}
.article-card-name {
  font-size: var(--article-font-size, .82rem); font-weight: 600;
  color: #1e293b;
  line-height: 1.25;
}
.article-card-price {
  font-size: 1rem; font-weight: 800;
  color: #2563eb;
}
.caisse-empty-articles {
  text-align: center; padding: 4rem 1rem; color: #94a3b8;
}
.caisse-empty-articles h3 { color: #64748b; margin: .5rem 0 .25rem; }

/* ── Cart panel ── */
.caisse-cart-panel {
  width: 320px; flex-shrink: 0;
  display: flex; flex-direction: column;
  background: #ffffff;
  color: #1e293b;
  border-left: 1px solid #e2e8f0;
}
.cart-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.cart-header-title {
  display: flex; align-items: center; gap: .5rem;
  font-size: .95rem; font-weight: 700; color: #1e293b;
}
.cart-clear-btn {
  display: flex; align-items: center; gap: .3rem;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #64748b;
  border-radius: 8px;
  padding: .45rem .85rem;
  font-size: .78rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.cart-clear-btn:hover { background: #fee2e2; color: #dc2626; }

.cart-items {
  flex: 1; overflow-y: auto;
  padding: .5rem;
}
.cart-items::-webkit-scrollbar { width: 4px; }
.cart-items::-webkit-scrollbar-track { background: transparent; }
.cart-items::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.cart-empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%;
  color: #94a3b8;
  text-align: center; padding: 2rem 1rem;
  gap: .5rem;
}
.cart-empty-state p { margin: 0; font-size: .9rem; }
.cart-empty-state small { font-size: .75rem; color: #cbd5e1; }

.cart-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: .6rem .75rem;
  margin-bottom: .4rem;
  transition: background .1s;
}
.cart-item:hover { background: #f1f5f9; }
.cart-item-name {
  font-size: .85rem; font-weight: 600; color: #1e293b;
  margin-bottom: .35rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cart-item-row2 {
  display: flex; align-items: center; gap: .5rem;
}
.cart-item-controls {
  display: flex; align-items: center; gap: .2rem;
}
.qty-btn {
  width: 2.4rem; height: 2.4rem;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #1e293b;
  font-size: 1.1rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .12s;
}
.qty-btn:hover { background: #cbd5e1; }
.qty-val {
  min-width: 1.8rem; text-align: center;
  font-size: .9rem; font-weight: 700; color: #1e293b;
}
.cart-item-unit {
  font-size: .7rem; color: #94a3b8;
  flex: 1;
}
.cart-item-total {
  font-size: .88rem; font-weight: 700; color: #0284c7;
  white-space: nowrap;
}

.cart-footer {
  padding: 1rem;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
  background: #f8fafc;
}
.cart-total-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: .75rem;
}
.cart-total-label {
  font-size: .75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: #64748b;
}
.cart-total {
  font-size: 1.5rem; font-weight: 800; color: #1e293b;
}
.btn-encaisser {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1.05rem; font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  box-shadow: 0 4px 14px rgba(22,163,74,.4);
  transition: opacity .15s, transform .1s;
}
.btn-encaisser:hover { opacity: .92; transform: translateY(-1px); }
.btn-encaisser:active { transform: scale(.97); }
.btn-encaisser:disabled {
  background: #e2e8f0;
  color: #94a3b8;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

/* ── Mobile layout ── */
@media (max-width: 700px) {
  .caisse-cart-toggle-btn { display: flex; }
  .caisse-body { flex-direction: column; position: relative; overflow: hidden; }
  .caisse-articles-panel { flex: 1; min-height: 0; padding: .6rem; overflow-y: auto; }
  .articles-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .5rem; }
  .caisse-cart-panel {
    position: fixed; bottom: 0; left: 0; right: 0;
    width: 100%; height: 60dvh;
    border-left: none; border-top: 2px solid #e2e8f0;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    z-index: 50;
  }
  .caisse-cart-panel.cart-open { transform: translateY(0); }
}

/* ── Modals paiement ── */
.caisse-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.65);
  z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
}
.caisse-modal {
  background: #ffffff;
  isolation: isolate;
  border-radius: 20px 20px 0 0;
  padding: 1.5rem;
  width: 100%; max-width: 480px;
  max-height: 90dvh; overflow-y: auto;
  position: relative;
  box-shadow: 0 -8px 40px rgba(0,0,0,.25);
}
@media (min-width: 520px) {
  .caisse-modal-overlay { align-items: center; }
  .caisse-modal { border-radius: 20px; max-height: 85dvh; }
}
.caisse-modal-close {
  position: absolute; top: .75rem; right: .75rem;
  background: #f1f5f9; border: none; border-radius: 50%;
  width: 2.75rem; height: 2.75rem; cursor: pointer;
  font-size: 1.1rem; display: flex; align-items: center; justify-content: center;
  color: #64748b;
}
.caisse-modal-close:hover { background: #e2e8f0; }
.caisse-modal-title { margin: 0 0 1.25rem; font-size: 1.2rem; color: #1e293b; }

.pay-summary {
  border: 1px solid #e2e8f0; border-radius: 10px;
  overflow: hidden; margin-bottom: .75rem;
  background: #ffffff;
}
.pay-summary-row {
  display: flex; justify-content: space-between;
  padding: .5rem .75rem; font-size: .85rem;
  border-bottom: 1px solid #f1f5f9; color: #475569;
  background: #ffffff;
}
.pay-summary-row:last-child { border-bottom: none; }
.pay-total-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: .5rem .25rem; margin-bottom: .75rem;
  background: #ffffff;
}
.pay-total-row strong { font-size: 1.4rem; color: #1e293b; }

/* Payment method buttons */
.pay-method-btns {
  display: flex; gap: .4rem; margin-top: .75rem;
}
.pay-method-btn {
  flex: 1; padding: 1.25rem .4rem;
  border: 2px solid transparent; border-radius: 14px;
  cursor: pointer;
  font-size: 1.8rem; font-weight: 700; color: #1e293b;
  text-align: center; line-height: 1.25;
  transition: all .15s;
  min-width: 0;
}
.pay-method-btn:nth-child(1) { background: #f0fdf4; border-color: #86efac; color: #15803d; }
.pay-method-btn:nth-child(2) { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
.pay-method-btn:nth-child(3) { background: #faf5ff; border-color: #c4b5fd; color: #6d28d9; }
.pay-method-btn:nth-child(1):hover { background: #dcfce7; }
.pay-method-btn:nth-child(2):hover { background: #dbeafe; }
.pay-method-btn:nth-child(3):hover { background: #ede9fe; }
.pay-method-btn:active { transform: scale(.96); }
.pay-method-btn span   { display: block; font-size: .85rem; font-weight: 700; margin-top: .3rem; }

/* Confirmed payment entries */
.pay-entry-row {
  display: flex; align-items: center; gap: .5rem;
  padding: .45rem .6rem; border-radius: 8px;
  margin-bottom: .35rem; font-size: .88rem;
}
.pay-entry-block { margin-bottom: .35rem; }
.pay-entry-block .pay-entry-row { margin-bottom: 0; }
.pay-entry-cash   { background: #f0fdf4; border: 1px solid #bbf7d0; }
.pay-entry-carte  { background: #eff6ff; border: 1px solid #bfdbfe; }
.pay-entry-wallet { background: #faf5ff; border: 1px solid #e9d5ff; }
.pay-entry-icon   { font-size: 1rem; width: 1.4rem; text-align: center; flex-shrink: 0; }
.pay-entry-label  { flex: 1; font-weight: 600; color: #1e293b; }
.pay-entry-amount { font-weight: 700; color: #0f172a; white-space: nowrap; }
.pay-entry-remove {
  background: none; border: none; cursor: pointer;
  color: #94a3b8; font-size: 1rem; padding: .35rem .45rem;
  transition: color .1s;
}
.pay-entry-remove:hover { color: #ef4444; }
.pay-entry-edit {
  background: none; border: none; cursor: pointer;
  color: #94a3b8; font-size: .95rem; padding: .35rem .35rem;
  transition: color .1s; line-height: 1;
}
.pay-entry-edit:hover { color: #3b82f6; }
.pay-entry-edit-input {
  width: 90px; padding: .2rem .4rem; border: 1.5px solid #93c5fd;
  border-radius: 5px; font-size: .88rem; font-weight: 700;
  text-align: right; background: #fff; outline: none;
  color: #0f172a;
}
.pay-entry-edit-input:focus { border-color: #3b82f6; box-shadow: 0 0 0 2px #bfdbfe; }
.pay-cash-helper {
  margin-top: .25rem; padding: .55rem .65rem;
  border: 1px dashed #86efac; border-radius: 8px;
  background: #f7fee7;
}
.pay-cash-helper-head {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
}
.pay-cash-helper-label {
  display: block; margin-bottom: .35rem;
  font-size: .78rem; font-weight: 700; color: #166534;
}
.pay-cash-helper-close {
  background: none; border: none; cursor: pointer;
  color: #65a30d; font-size: .95rem; padding: .15rem .25rem;
  line-height: 1; border-radius: 6px;
}
.pay-cash-helper-close:hover { color: #166534; background: rgba(255,255,255,.75); }
.pay-cash-helper-row {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
}
.pay-cash-helper-input { width: 110px; }
.pay-cash-helper-result {
  font-size: .82rem; font-weight: 700; padding: .35rem .55rem;
  border-radius: 999px; background: #fff; border: 1px solid #d1d5db;
}
.pay-cash-helper-result.is-positive { color: #166534; border-color: #86efac; background: #f0fdf4; }
.pay-cash-helper-result.is-warning { color: #b45309; border-color: #fcd34d; background: #fffbeb; }

/* Wallet search header */
.pay-wallet-search-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .4rem; font-size: .9rem;
}
.pay-wallet-search-header small { color: #dc2626; font-weight: 600; }

/* Saisie mode: amount row */
.pay-wallet-saisie-row {
  background: #fffbeb; border: 1px solid #fde68a;
  border-radius: 10px; padding: .5rem .75rem; margin-bottom: .5rem;
}
.pay-wallet-saisie-row label {
  font-size: .78rem; font-weight: 600; color: #92400e;
  text-transform: uppercase; letter-spacing: .05em;
}
.pay-wallet-saisie-row .pay-amount-input { background: #fff; }

/* Benevole name in code box */
.wallet-code-ben {
  font-size: .82rem; font-weight: 600; color: #475569;
  margin-bottom: .25rem;
}

/* ── Répartition paiements ── */
.pay-split-section {
  border: 1px solid #e2e8f0; border-radius: 12px;
  overflow: hidden; margin-bottom: .75rem;
}
.pay-split-label {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: #64748b;
  padding: .5rem .75rem; background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
.pay-split-row {
  display: flex; align-items: center; gap: .65rem;
  padding: .55rem .75rem; border-bottom: 1px solid #f1f5f9;
  background: #ffffff;
}
.pay-split-row:last-child { border-bottom: none; }
.pay-split-icon { font-size: 1.1rem; width: 1.4rem; text-align: center; flex-shrink: 0; }
.pay-split-name { flex: 1; font-size: .88rem; font-weight: 600; color: #334155; }
.pay-split-input { display: flex; align-items: center; gap: .35rem; }
.pay-amount-input {
  width: 80px; padding: .3rem .5rem;
  border: 1px solid #e2e8f0; border-radius: 8px;
  font-size: .9rem; font-weight: 600; color: #1e293b;
  text-align: right; background: #f8fafc;
}
.pay-amount-input:focus { outline: none; border-color: #2563eb; background: #fff; }
.pay-amount-input[readonly] { background: #f1f5f9; color: #64748b; cursor: not-allowed; }
.pay-currency { font-size: .8rem; font-weight: 600; color: #64748b; }

/* Wallet header row */
.pay-wallet-header {
  display: flex; align-items: center; gap: .65rem;
  padding: .55rem .75rem; border-bottom: 1px solid #f1f5f9;
  background: #fafbff;
}
.btn-add-wallet {
  margin-left: auto;
  background: #eff6ff; border: 1px solid #bfdbfe;
  color: #1d4ed8; border-radius: 8px;
  padding: .45rem .85rem; font-size: .82rem; font-weight: 600;
  cursor: pointer; transition: background .12s;
}
.btn-add-wallet:hover { background: #dbeafe; }

/* Wallet entries */
.wallet-entry {
  border-top: 1px solid #e2e8f0;
  padding: .5rem .75rem; background: #ffffff;
}
.wallet-entry-top {
  display: flex; align-items: center; gap: .5rem; margin-bottom: .35rem;
}
.wallet-remove-btn {
  background: none; border: none; cursor: pointer; font-size: 1rem;
  color: #94a3b8; padding: .4rem; line-height: 1;
  transition: color .12s;
}
.wallet-remove-btn:hover { color: #ef4444; }
.wallet-slot-paid {
  font-size: .75rem; font-weight: 700; color: #16a34a;
  background: #f0fdf4; border: 1px solid #bbf7d0;
  border-radius: 6px; padding: .15rem .5rem;
}
.wallet-entry-search { width: 100%; position: relative; }
.wallet-entry-search input { width: 100%; box-sizing: border-box; }
.benevole-results { border: 1px solid #e2e8f0; border-radius: 10px; overflow: hidden; margin-top: .25rem; max-height: 160px; overflow-y: auto; }
.benevole-results-inline { position: absolute; width: 100%; z-index: 10; background: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.1); }
.benevole-result-item {
  padding: .65rem .75rem; cursor: pointer;
  display: flex; flex-direction: column; gap: .1rem;
  border-bottom: 1px solid #e2e8f0; font-size: .88rem;
  transition: background .1s;
}
.benevole-result-item:hover { background: #f8fafc; }
.benevole-result-item:last-child { border-bottom: none; }
.benevole-result-item small { font-size: .7rem; color: #94a3b8; }
.benevole-result-disabled {
  cursor: not-allowed; opacity: .5; pointer-events: none;
}
.benevole-result-disabled:hover { background: transparent; }
.benevole-selected-box {
  display: flex; align-items: center; justify-content: space-between;
  padding: .5rem .75rem;
  background: #dcfce7; border: 1px solid #86efac;
  border-radius: 10px; font-size: .9rem; font-weight: 600; color: #166534;
  margin-top: .5rem;
}
.wallet-entry-selected {
  display: flex; align-items: center; justify-content: space-between;
  padding: .35rem .5rem;
  background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px;
  font-size: .82rem; font-weight: 600; color: #166534;
}
.wallet-remove-ben {
  background: none; border: none; cursor: pointer; font-size: .95rem;
  color: #94a3b8; padding: .3rem .5rem;
}
.wallet-remove-ben:hover { color: #ef4444; }

/* Code section per wallet slot */
.btn-gen-wallet {
  width: 100%; margin-top: .35rem; font-size: .85rem; padding: .6rem;
}
.wallet-code-box {
  margin-top: .35rem; padding: .75rem .5rem 1rem; background: #f8fafc;
  border: 1px solid #e2e8f0; border-radius: 10px; text-align: center;
}
.wallet-code-actions {
  display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; margin-top: .6rem;
}
.wallet-code-value {
  font-size: 2.8rem; font-weight: 800; letter-spacing: .28em;
  color: #0f172a; font-variant-numeric: tabular-nums; line-height: 1.1;
}
.wallet-code-qr { margin: .5rem 0; }
.wallet-slot-status {
  display: flex; align-items: center; justify-content: center; gap: .35rem;
  font-size: .78rem; font-weight: 600; margin-top: .3rem;
  padding: .3rem .5rem; border-radius: 6px;
}
.wallet-slot-status.waiting { background: #fef9c3; color: #854d0e; border: 1px solid #fde68a; }
.wallet-slot-status.paid    { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

/* Remaining row */
.pay-remaining-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: .6rem .75rem; border-radius: 10px;
  background: #f8fafc; border: 1px solid #e2e8f0;
  margin-bottom: .75rem; font-size: .9rem; font-weight: 600; color: #475569;
  transition: background .2s;
}
.pay-remaining-row strong { font-size: 1.05rem; }

.pay-actions { display: flex; gap: .75rem; margin-top: .75rem; }
.pay-actions .btn { flex: 1; padding: .75rem 1rem; font-size: .9rem; }

/* Print modal */
.caisse-modal-print { text-align: center; }
.print-success-icon { font-size: 2.5rem; margin-bottom: .5rem; }
.print-tickets-list {
  border: 1px solid #e2e8f0; border-radius: 10px;
  overflow: hidden; margin: 1rem 0; text-align: left;
}
.print-ticket-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: .4rem .75rem; border-bottom: 1px solid #e2e8f0;
  font-size: .85rem; gap: .5rem;
}
.print-ticket-item:last-child { border-bottom: none; }
.ticket-nom { flex: 1; font-weight: 600; }
.ticket-prix { color: #2563eb; font-weight: 700; }
.ticket-status { width: 1.4rem; text-align: center; }
.print-actions { display: flex; gap: .75rem; margin: .75rem 0 .5rem; }
.print-actions .btn { flex: 1; padding: .75rem 1rem; font-size: .9rem; }
.print-status-msg { font-size: .8rem; color: #94a3b8; min-height: 1.2em; margin-top: .25rem; }
.btn-new-sale { width: 100%; margin-top: .5rem; }

/* ── Admin caisse styles ── */
.article-thumb {
  width: 56px; height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
}
.article-thumb-cell { width: 72px; }
.article-thumb-lg {
  width: 120px; height: 120px;
  object-fit: cover; border-radius: 12px;
  border: 1px solid var(--border);
  display: block; margin-bottom: .5rem;
}
.no-thumb {
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  background: linear-gradient(135deg, #e0e7ff, #f0fdf4);
  border-radius: 8px; border: 1px solid var(--border);
}
.current-image-wrap {
  display: flex; align-items: center; gap: 1rem; margin-bottom: .75rem;
}
.remove-image-label { font-size: .85rem; color: var(--text-muted); cursor: pointer; }
.nav-section-label {
  padding: .35rem 1rem .1rem;
  font-size: .65rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-muted); opacity: .7;
  list-style: none;
}
.row-inactive td { opacity: .55; }
.device-registered { font-size: .8rem; color: var(--success, #16a34a); }
.device-id-small {
  font-size: .65rem; background: var(--bg);
  padding: .1rem .35rem; border-radius: 4px; margin-left: .4rem;
}

/* Caisse validate page */
.caisse-validate {
  max-width: 420px; margin: 0 auto; padding: 2rem 1rem; text-align: center;
}

/* ── Admin Ventes ── */
.filter-bar {
  display: flex; align-items: flex-end; flex-wrap: wrap;
  gap: .75rem; margin-bottom: 1.25rem;
}
.filter-form {
  display: flex; align-items: flex-end; flex-wrap: wrap; gap: .6rem; flex: 1;
}
.filter-group {
  display: flex; flex-direction: column; gap: .2rem;
}
.filter-group label { font-size: .72rem; font-weight: 600; color: var(--text-muted); }
.form-control-sm {
  padding: .3rem .55rem; font-size: .82rem;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
}
.filter-total {
  font-size: .88rem; color: var(--text-muted); white-space: nowrap;
  padding: .35rem 0;
}
.filter-total strong { color: var(--text); font-size: 1rem; }

.ventes-list { display: flex; flex-direction: column; gap: .75rem; }

/* ── Ventes table ── */
.ventes-articles-cell {
  font-size: .82rem; color: var(--text); max-width: 280px;
}
.benevole-payment-detail {
  min-width: 220px;
  font-size: .84rem;
  line-height: 1.5;
}
.ventes-benevole-name {
  font-size: .85rem; font-weight: 600; color: var(--text);
}
.vl-qty {
  font-size: .75rem; font-weight: 700;
  color: var(--primary); min-width: 1.5rem; text-align: right;
}
.vl-nom { flex: 1; color: var(--text); font-weight: 500; }
.vl-prix { font-size: .75rem; color: var(--text-muted); }
.vl-sub { font-weight: 700; color: var(--text); white-space: nowrap; }

/* ── Vente edit ── */
.vente-edit-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 860px) {
  .vente-edit-grid { grid-template-columns: 1fr; }
}
.section-title {
  font-size: .95rem; font-weight: 700;
  color: var(--text); margin: 0 0 1rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--border);
}
.vente-ligne-edit {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem 0;
  border-bottom: 1px dashed var(--border);
  flex-wrap: wrap;
}
.vente-ligne-edit:last-child { border-bottom: none; }
.vl-nom-edit { flex: 1; font-size: .85rem; font-weight: 600; min-width: 100px; }
.vl-unit-edit { font-size: .75rem; color: var(--text-muted); white-space: nowrap; }
.vl-qty-edit { display: flex; align-items: center; gap: .3rem; }
.vl-qty-edit label { font-size: .72rem; color: var(--text-muted); }
.vl-qty-input { width: 60px !important; text-align: center; padding: .25rem .4rem !important; }
.vl-subtotal { font-size: .85rem; font-weight: 700; color: var(--primary); white-space: nowrap; min-width: 70px; text-align: right; }
.btn-remove-ligne {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: .85rem; padding: .2rem .4rem;
  border-radius: 6px; transition: background .1s, color .1s;
}
.btn-remove-ligne:hover { background: #fee2e2; color: #ef4444; }
.add-ligne-section {
  margin-top: 1rem; padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.add-ligne-section h4 {
  font-size: .8rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .05em;
  margin: 0 0 .6rem;
}
.new-art-select { flex: 1; min-width: 160px; }
.vente-total-edit-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 1rem; padding-top: .75rem;
  border-top: 2px solid var(--border);
  font-size: .9rem; font-weight: 600;
}
.vente-total-edit-row strong { font-size: 1.25rem; color: var(--primary); }
.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--border);
}
.vente-payments-list {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.vente-payment-row {
  display: grid;
  grid-template-columns: minmax(120px, 150px) minmax(120px, 1fr) minmax(160px, 1.3fr) auto;
  gap: .75rem;
  align-items: end;
  padding: .75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}
.payment-amount-group,
.payment-wallet-group {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.payment-amount-group label,
.payment-wallet-group label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-muted);
}
.payment-mode-select,
.payment-amount-input,
.wallet-benevole-select {
  width: 100%;
}
.payment-wallet-group.is-hidden {
  display: none;
}
.vente-payment-summary {
  margin-top: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
}
.vente-payment-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  font-size: .9rem;
}
.vente-payment-summary-row strong {
  font-size: 1rem;
  white-space: nowrap;
}
#payment-diff-row.is-ok strong,
#payment-diff-row.is-ok span {
  color: var(--success, #16a34a);
}
#payment-diff-row.is-warning strong,
#payment-diff-row.is-warning span {
  color: #d97706;
}
#payment-diff-row.is-error strong,
#payment-diff-row.is-error span {
  color: #dc2626;
}
.payment-save-hint {
  margin-top: .85rem;
  padding: .7rem .85rem;
  border-radius: 10px;
  font-size: .84rem;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text-muted);
}
.payment-save-hint.is-ok {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}
.payment-save-hint.is-error {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}
@media (max-width: 860px) {
  .vente-payment-row {
    grid-template-columns: 1fr;
  }
}

/* ── Wallet mode radio selector ── */
.wallet-mode-group {
  display: flex; flex-direction: column; gap: .75rem;
}
.wallet-mode-option {
  display: flex; align-items: flex-start; gap: .9rem;
  padding: .9rem 1rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  position: relative;
  background: var(--bg-card);
}
.wallet-mode-option input[type=radio] {
  position: absolute; opacity: 0; width: 0; height: 0;
}
.wallet-mode-option:hover { border-color: var(--primary); }
.wallet-mode-option.selected,
.wallet-mode-option:has(input:checked) {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, var(--bg-card));
}
.wallet-mode-icon {
  font-size: 1.6rem; flex-shrink: 0; line-height: 1; margin-top: .1rem;
}
.wallet-mode-body { flex: 1; }
.wallet-mode-label {
  font-weight: 700; font-size: .95rem; margin-bottom: .2rem;
}
.wallet-mode-desc {
  font-size: .82rem; color: var(--text-muted); line-height: 1.45;
}
.wallet-mode-check {
  font-size: .9rem; font-weight: 700; color: var(--primary);
  opacity: 0; flex-shrink: 0; margin-top: .1rem;
  transition: opacity .15s;
}
.wallet-mode-option.selected .wallet-mode-check,
.wallet-mode-option:has(input:checked) .wallet-mode-check { opacity: 1; }

/* ── Admin codes page ── */
.form-row-inline { display: flex; gap: 1rem; flex-wrap: wrap; }
.code-result {
  background: color-mix(in srgb, var(--success, #22c55e) 8%, var(--bg-card));
  border: 2px solid var(--success, #22c55e);
  border-radius: 12px; padding: 1.25rem;
  margin-bottom: 1.5rem; text-align: center;
}
.code-result-header {
  font-weight: 700; color: #16a34a; margin-bottom: .75rem; font-size: .9rem;
}
.code-display {
  font-size: 2.5rem; font-weight: 900; letter-spacing: .3em;
  font-family: monospace; color: var(--primary);
  margin-bottom: .5rem; word-spacing: .4em;
}
.code-meta {
  font-size: .82rem; color: var(--text-muted); margin-bottom: .75rem;
}
.code-actions { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1rem; }
.code-qr-wrap { margin-bottom: .75rem; }
.code-url-wrap input { font-size: .78rem; text-align: center; }
.codes-table-wrap { overflow-x: auto; }
.code-badge {
  background: #1e293b; color: #e2e8f0; border-radius: 6px;
  padding: .2rem .5rem; font-family: monospace; font-size: .9rem;
  letter-spacing: .1em; font-weight: 700;
}
.code-status { font-size: .78rem; font-weight: 600; padding: .15rem .5rem; border-radius: 20px; }
.code-status--active  { background: #dcfce7; color: #15803d; }
.code-status--used    { background: #e2e8f0; color: #64748b; }
.code-status--expired { background: #fee2e2; color: #b91c1c; }
.code-row--used td,
.code-row--expired td { opacity: .6; }

/* ── Caisse code/QR generation in payment modal ── */
.caisse-code-hint {
  font-size: .82rem; color: #94a3b8; text-align: center;
  margin-bottom: 1rem; line-height: 1.5;
}
.caisse-code-display {
  font-size: 2.8rem; font-weight: 900; letter-spacing: .35em;
  font-family: monospace; color: #38bdf8;
  text-align: center; margin-bottom: .5rem;
  background: rgba(56, 189, 248, .08);
  border: 2px dashed rgba(56, 189, 248, .3);
  border-radius: 10px; padding: .6rem 1rem;
}
.caisse-code-qr { text-align: center; margin-bottom: .5rem; }
.caisse-code-meta {
  font-size: .78rem; color: #64748b; text-align: center; margin-bottom: .75rem;
}
.caisse-code-wait {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  font-size: .82rem; color: #94a3b8; margin-bottom: .5rem;
}
.caisse-code-spinner {
  width: 14px; height: 14px;
  border: 2px solid #334155;
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Paiement partiel (solde insuffisant) ── */
.partial-wallet-row, .partial-cash-row {
  display: flex; align-items: center; gap: .85rem;
  padding: .75rem 1rem; border-radius: 10px; margin-bottom: .5rem;
}
.partial-wallet-row { background: #eff6ff; border: 1px solid #bfdbfe; }
.partial-cash-row   { background: #fff7ed; border: 1px solid #fed7aa; }
.partial-icon { font-size: 1.5rem; }
.partial-label { font-size: .78rem; color: #64748b; margin-bottom: .15rem; }
.partial-amount {
  font-size: 1.3rem; font-weight: 800; color: #2563eb;
}
.partial-amount-cash { color: #ea580c; }
.partial-hint {
  font-size: .8rem; color: #64748b; text-align: center;
  margin: .75rem 0 .5rem; line-height: 1.5;
}

/* ── Transactions : crédits / recharges ── */
.tx-credit { background: #f0fdf4 !important; border-left: 3px solid #22c55e; }
.tx-amount-credit { color: #16a34a; font-weight: 700; }
.tx-credit-icon { font-size: 1.1rem; flex-shrink: 0; align-self: center; }
.tx-toast-credit { background: #166534 !important; }

/* ── Actions QR / code portefeuille ── */
.wallet-print-qr-btn, .wallet-cancel-btn { font-size: .78rem; }

/* ── Impression QR slip ── */
#qr-print-slip { display: none; }

@media print {
    body > *:not(#qr-print-slip) { display: none !important; }
    #qr-print-slip {
        display: block !important;
        position: fixed;
        inset: 0;
        background: #fff;
        z-index: 99999;
    }
}

/* ── Article categories ── */
.articles-cat-sep {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--cat-color, #64748b);
  padding: .3rem 0 .1rem;
  border-bottom: 2px solid var(--cat-color, #e2e8f0);
  margin-bottom: .25rem;
}
.articles-cat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cat-color, #64748b);
  flex-shrink: 0;
}
.cat-row td { vertical-align: middle; }
.cat-row .drag-handle { color: #94a3b8; }

/* ── Article group card ── */
.article-group-card {
  background: color-mix(in srgb, var(--group-color, #6366f1) 10%, #fff);
  border: 2px solid color-mix(in srgb, var(--group-color, #6366f1) 35%, #e2e8f0);
  border-radius: 16px;
  padding: .9rem .5rem .75rem;
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
  text-align: center;
}
.article-group-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,.1);
}
.article-group-card:active { transform: scale(.96); }
.article-group-icon { font-size: 2rem; line-height: 1; }
.article-group-name {
  font-size: .82rem; font-weight: 700; color: #1e293b;
  line-height: 1.2; word-break: break-word;
}
.article-group-count {
  font-size: .72rem; color: var(--group-color, #6366f1);
  font-weight: 600;
}

/* ── Group popup ── */
.group-popup-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.55);
  z-index: 200;
  display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 600px) {
  .group-popup-overlay { align-items: center; }
}
.group-popup {
  background: #fff;
  border-radius: 20px 20px 0 0;
  width: 100%; max-width: min(95vw, calc(var(--article-min-width, 150px) * 4 + 5rem));
  max-height: 80dvh;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -4px 30px rgba(0,0,0,.2);
}
@media (min-width: 600px) {
  .group-popup {
    border-radius: 20px;
    max-height: 75dvh;
  }
}
.group-popup-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.1rem .75rem;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 700; font-size: 1rem; color: #1e293b;
  flex-shrink: 0;
  border-top: 4px solid var(--group-color, #6366f1);
  border-radius: 20px 20px 0 0;
}
.group-popup-close {
  background: #f1f5f9; border: none; border-radius: 8px;
  width: 2rem; height: 2rem;
  font-size: 1rem; cursor: pointer; color: #64748b;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.group-popup-close:hover { background: #fee2e2; color: #dc2626; }
.group-popup-grid {
  flex: 1; overflow-y: auto;
  padding: .85rem;
}
