/* ── Le Maki — palette charte ─────────────────────────────────────────── */
:root {
  --vert-sauge: #5A8A6B;
  --vert-sauge-dark: #436b54;
  --jaune-soleil: #F4C95D;
  --terracotta: #C97B5C;
  --terracotta-dark: #a55e44;
  --bleu-ciel: #7FB8C9;
  --creme: #F5EDDD;
  --creme-dark: #ebe0c8;
  --noir: #1F1F1F;
  --bois: #6B4423;
  --shadow: 0 4px 16px rgba(31, 31, 31, 0.08);
  --shadow-lg: 0 8px 32px rgba(31, 31, 31, 0.16);
  --radius: 14px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overscroll-behavior: none; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--creme);
  color: var(--noir);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
}

#app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* ── Typo titres ──────────────────────────────────────────────────────── */
h1, h2, h3 {
  font-family: 'Caveat', 'Comic Sans MS', cursive;
  font-weight: 700;
  color: var(--vert-sauge);
  line-height: 1.1;
}
h1 { font-size: 56px; }
h2 { font-size: 36px; }
h3 { font-size: 26px; }

/* ── Layout ───────────────────────────────────────────────────────────── */
.center-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px;
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}
@media (max-width: 720px) {
  .page { padding: 12px; gap: 12px; }
}

.card {
  background: white;
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow);
  border-top: 6px solid var(--vert-sauge);
}
.card--center {
  max-width: 440px;
  width: 100%;
  text-align: center;
}

/* ── Inputs ───────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.field label { font-weight: 600; color: var(--bois); font-size: 14px; }
.input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--creme-dark);
  border-radius: var(--radius-sm);
  font-size: 17px;
  background: white;
  color: var(--noir);
  transition: border-color 0.15s;
}
.input:focus {
  outline: none;
  border-color: var(--vert-sauge);
}

/* ── Boutons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.05s, background 0.15s;
  min-height: 48px;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--primary { background: var(--vert-sauge); color: white; }
.btn--primary:hover:not(:disabled) { background: var(--vert-sauge-dark); }

.btn--accent { background: var(--jaune-soleil); color: var(--noir); }

.btn--danger { background: var(--terracotta); color: white; }
.btn--danger:hover:not(:disabled) { background: var(--terracotta-dark); }

.btn--ghost { background: transparent; color: var(--bois); }
.btn--block { width: 100%; }
.btn--lg { padding: 18px 32px; font-size: 18px; min-height: 56px; }

/* ── Erreurs ──────────────────────────────────────────────────────────── */
.error {
  background: #fee;
  color: #a33;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.muted { color: var(--bois); font-size: 14px; }

/* ── Bandeau réseau ───────────────────────────────────────────────────── */
.net-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  z-index: 100;
  transform: translateY(0);
  transition: transform 0.25s;
}
.net-banner--hidden { transform: translateY(100%); }
.net-banner--offline { background: var(--terracotta); color: white; }
.net-banner--syncing { background: var(--jaune-soleil); color: var(--noir); }

/* ── Header / topbar ──────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--vert-sauge);
  color: white;
  box-shadow: var(--shadow);
  gap: 8px;
}
.topbar h1 {
  color: white;
  font-size: 32px;
  margin: 0;
  flex-shrink: 0;
}
.topbar .who {
  font-size: 14px;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar .btn {
  background: rgba(255,255,255,0.18);
  color: white;
  padding: 8px 14px;
  min-height: 0;
  font-size: 14px;
  flex-shrink: 0;
}
.topbar .btn:hover:not(:disabled) { background: rgba(255,255,255,0.28); }

@media (max-width: 720px) {
  .topbar { padding: 10px 12px; gap: 6px; }
  .topbar h1 { font-size: 24px; }
  .topbar .who { display: none; }
  .topbar .btn { padding: 6px 10px; font-size: 13px; }
}

/* Onglets section (Caisse / Produits / Tickets / Dashboard) */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--vert-sauge-dark);
  padding: 0 12px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.75);
  padding: 14px 20px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  font-size: 15px;
  white-space: nowrap;
  flex-shrink: 0;
}
.tabs button:hover { color: white; }
.tabs button.active {
  color: white;
  border-bottom-color: var(--jaune-soleil);
}

@media (max-width: 720px) {
  .tabs button { padding: 12px 14px; font-size: 14px; }
}

/* ── Logo placeholder ─────────────────────────────────────────────────── */
.logo {
  font-family: 'Caveat', cursive;
  font-size: 64px;
  color: var(--vert-sauge);
  line-height: 1;
  margin-bottom: 8px;
}
.tagline { color: var(--bois); margin-bottom: 24px; }

/* ── Stats ────────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.kpi {
  background: white;
  border-radius: var(--radius-sm);
  padding: 18px;
  border-left: 5px solid var(--vert-sauge);
  box-shadow: var(--shadow);
}
.kpi__label { font-size: 13px; color: var(--bois); }
.kpi__value { font-size: 28px; font-weight: 700; color: var(--noir); margin-top: 4px; }
.kpi--accent { border-left-color: var(--jaune-soleil); }
.kpi--terra { border-left-color: var(--terracotta); }

/* ── Modal ───────────────────────────────────────────────────────────── */
.modal-wrap {
  position: fixed;
  inset: 0;
  background: rgba(31, 31, 31, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 200;
  animation: fadeIn 0.15s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border-top: 6px solid var(--vert-sauge);
}
.modal__title {
  font-family: 'Caveat', cursive;
  color: var(--vert-sauge);
  font-size: 32px;
  margin-bottom: 16px;
}
.modal__body { display: flex; flex-direction: column; gap: 14px; }
.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* ── Toasts ──────────────────────────────────────────────────────────── */
#toast-host {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow);
  background: white;
  border-left: 4px solid var(--vert-sauge);
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.2s, transform 0.2s;
}
.toast--show { opacity: 1; transform: translateX(0); }
.toast--success { border-left-color: var(--vert-sauge); }
.toast--error { border-left-color: var(--terracotta); background: #fee; }
.toast--info { border-left-color: var(--bleu-ciel); }

/* ── Page Produits ───────────────────────────────────────────────────── */
.cat-row {
  background: white;
  border-radius: var(--radius);
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.cat-row__header {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  cursor: pointer;
  border-left: 8px solid var(--vert-sauge);
  background: white;
  gap: 12px;
}
.cat-row__caret {
  font-size: 14px;
  color: var(--bois);
  transition: transform 0.15s;
  width: 16px;
  text-align: center;
}
.cat-row[open] .cat-row__caret { transform: rotate(90deg); }
.cat-row__name {
  flex: 1;
  font-weight: 600;
  font-size: 17px;
}
.cat-row__count {
  color: var(--bois);
  font-size: 13px;
}
.cat-row__actions { display: flex; gap: 6px; }
.cat-row__actions .btn {
  padding: 6px 12px;
  font-size: 13px;
  min-height: 0;
}
.cat-row__products {
  display: none;
  padding: 8px 18px 18px 42px;
  border-top: 1px solid var(--creme-dark);
  background: var(--creme);
}
.cat-row[open] .cat-row__products { display: block; }

.product-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: white;
  border-radius: var(--radius-sm);
}
.product-row__name { flex: 1; font-weight: 500; }
.product-row__price { font-weight: 600; color: var(--vert-sauge-dark); margin-right: 10px; }
.product-row__opts { color: var(--bois); font-size: 12px; margin-left: 6px; }
.product-row__actions { display: flex; gap: 4px; }
.product-row__actions .btn {
  padding: 4px 10px;
  font-size: 12px;
  min-height: 0;
}
.product-row--inactive { opacity: 0.5; }

.swatch {
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 2px solid var(--creme-dark);
  flex-shrink: 0;
}

.color-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.color-picker label {
  width: 32px; height: 32px;
  border-radius: 8px;
  cursor: pointer;
  border: 3px solid transparent;
  position: relative;
}
.color-picker input { position: absolute; opacity: 0; pointer-events: none; }
.color-picker input:checked + label { border-color: var(--noir); transform: scale(1.1); }

.field-row {
  display: flex;
  gap: 12px;
  align-items: end;
}
.field-row > .field { flex: 1; }

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--bois);
}
.empty p { margin-bottom: 16px; }

/* ── Grille tickets caisse ────────────────────────────────────────────── */
.ticket-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.ticket-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--vert-sauge);
  min-height: 220px;
}

.ticket-card__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px dashed var(--creme-dark);
  padding-bottom: 8px;
}
.ticket-card__customer {
  font-family: 'Caveat', cursive;
  font-size: 28px;
  color: var(--vert-sauge-dark);
  font-weight: 700;
  line-height: 1;
}

.ticket-card__items {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
  color: var(--noir);
  overflow-y: auto;
  max-height: 200px;
}
.ticket-card__line {
  display: flex;
  gap: 6px;
}
.ticket-card__qty {
  color: var(--bois);
  font-weight: 600;
  flex-shrink: 0;
  width: 28px;
}
.ticket-card__name { flex: 1; }
.ticket-card__empty {
  font-size: 13px;
  color: var(--bois);
  font-style: italic;
  text-align: center;
  padding: 20px 0;
}

.ticket-card__actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px dashed var(--creme-dark);
  padding-top: 10px;
}
.ticket-card__actions .btn {
  padding: 10px 12px;
  font-size: 14px;
  min-height: 0;
}

/* Carte "+ Nouveau ticket" */
.ticket-card--new {
  background: var(--vert-sauge);
  color: white;
  border: 2px dashed rgba(255,255,255,0.4);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  font-family: 'Caveat', cursive;
  font-size: 26px;
  font-weight: 700;
  cursor: pointer;
  min-height: 220px;
  transition: background 0.15s, transform 0.05s;
}
.ticket-card--new:hover { background: var(--vert-sauge-dark); }
.ticket-card--new:active { transform: scale(0.98); }
.ticket-card--new__plus {
  font-family: inherit;
  font-size: 64px;
  line-height: 1;
}

.ticket-card__choices {
  display: block;
  font-size: 12px;
  color: var(--bois);
  font-style: italic;
}

/* ── Sélecteur produits ───────────────────────────────────────────────── */
.selector {
  flex: 1;
  display: grid;
  grid-template-columns: 200px 1fr 280px;
  gap: 0;
  background: var(--creme);
  min-height: calc(100vh - 110px);
}

.selector__sidebar {
  background: var(--vert-sauge-dark);
  color: white;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.selector__back {
  align-self: flex-start;
  background: rgba(255,255,255,0.18);
  color: white;
  font-size: 13px;
  padding: 8px 14px;
  min-height: 0;
  margin-bottom: 8px;
}
.selector__back:hover { background: rgba(255,255,255,0.28); }

.selector__cats {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.selector__cat {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.78);
  text-align: left;
  padding: 12px 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.1s, color 0.1s;
}
.selector__cat:hover { color: white; background: rgba(255,255,255,0.06); }
.selector__cat.active {
  background: white;
  color: var(--noir);
}
.selector__cat.active .selector__cat-dot { box-shadow: 0 0 0 2px white; }
.selector__cat-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.selector__main {
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 14px;
  overflow-y: auto;
}

.selector__searchbar {
  position: sticky;
  top: 0;
  background: var(--creme);
  padding-bottom: 6px;
  z-index: 1;
}

.selector__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  align-content: start;
}

.selector__empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: var(--bois);
}

/* Carte produit */
.prod-card {
  background: white;
  border: none;
  border-top: 4px solid var(--bleu-ciel);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow);
  transition: transform 0.05s;
  min-height: 90px;
  font-family: inherit;
}
.prod-card:active { transform: scale(0.97); }
.prod-card__title {
  font-weight: 600;
  font-size: 14px;
  color: var(--noir);
  line-height: 1.2;
}
.prod-card__price {
  font-weight: 700;
  font-size: 18px;
  color: var(--vert-sauge-dark);
  margin-top: auto;
}
.prod-card__opts {
  font-size: 11px;
  color: var(--bois);
  background: var(--creme);
  padding: 2px 6px;
  border-radius: 999px;
  align-self: flex-start;
  margin-top: 2px;
}
.prod-card__sub { color: var(--bois); font-size: 12px; }

.prod-card--free {
  background: transparent;
  border: 2px dashed var(--vert-sauge);
  border-top: 2px dashed var(--vert-sauge);
  color: var(--vert-sauge-dark);
}
.prod-card--free .prod-card__title { color: var(--vert-sauge-dark); }

/* ── Cart panneau droit du sélecteur ─────────────────────────────────── */
.selector__cart {
  background: white;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--creme-dark);
  box-shadow: -2px 0 8px rgba(31,31,31,0.04);
}

.cart__header {
  padding: 14px 16px;
  border-bottom: 1px dashed var(--creme-dark);
}
.cart__customer {
  font-family: 'Caveat', cursive;
  font-size: 30px;
  font-weight: 700;
  color: var(--vert-sauge-dark);
  line-height: 1;
  margin-top: 2px;
}

.cart__items {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cart__empty {
  text-align: center;
  color: var(--bois);
  font-style: italic;
  padding: 32px 12px;
  font-size: 14px;
  line-height: 1.6;
}

.cart-line {
  background: var(--creme);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.cart-line__row1 {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}
.cart-line__name {
  font-weight: 600;
  flex: 1;
}
.cart-line__price {
  font-weight: 700;
  color: var(--vert-sauge-dark);
}
.cart-line__choices {
  font-size: 11px;
  color: var(--bois);
  font-style: italic;
  margin: 2px 0 4px;
}
.cart-line__row2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}
.cart-line__qty {
  display: flex;
  align-items: center;
  gap: 2px;
  background: white;
  border-radius: 999px;
  padding: 1px;
}
.cart-line__btn {
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 14px;
  font-weight: 700;
  background: transparent;
  color: var(--noir);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}
.cart-line__btn:hover { background: var(--vert-sauge); color: white; }
.cart-line__qty-value {
  min-width: 22px;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
}
.cart-line__del {
  width: 26px;
  height: 26px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--terracotta);
  border-radius: 50%;
}
.cart-line__del:hover { background: var(--terracotta); color: white; }

.cart__footer {
  border-top: 1px dashed var(--creme-dark);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: white;
}
.cart__total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 4px;
}
.cart__total strong {
  font-family: 'Caveat', cursive;
  font-size: 32px;
  color: var(--vert-sauge-dark);
  line-height: 1;
}

/* Modal options */
.opt-block {
  background: var(--creme);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
}
.opt-choices {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.opt-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}
.opt-choice input { margin: 0; }
.opt-choice__name { flex: 1; }
.opt-choice__delta {
  font-weight: 600;
  color: var(--terracotta);
  font-size: 13px;
}

/* ── Page Tickets ─────────────────────────────────────────────────────── */
.filters {
  display: grid;
  grid-template-columns: 160px 1fr 140px 140px auto;
  gap: 12px;
  align-items: end;
}
@media (max-width: 960px) {
  .filters { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 540px) {
  .filters { grid-template-columns: 1fr; }
}

.tickets-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tickets-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.tickets-table th {
  text-align: left;
  padding: 12px 14px;
  background: var(--creme);
  color: var(--bois);
  font-weight: 600;
  font-size: 13px;
  border-bottom: 2px solid var(--creme-dark);
  white-space: nowrap;
}
.tickets-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--creme-dark);
}
.tickets-table tr:hover td { background: var(--creme); }
.tickets-table .btn { padding: 6px 12px; font-size: 13px; min-height: 0; }

/* En mobile : la table devient une liste de cards */
.tickets-cards { display: none; }
@media (max-width: 720px) {
  .tickets-table-wrap { display: none; }
  .tickets-cards { display: flex; flex-direction: column; gap: 8px; padding: 8px; }
  .ticket-row {
    background: white;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    border-left: 4px solid var(--vert-sauge);
    box-shadow: var(--shadow);
    cursor: pointer;
  }
  .ticket-row__top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
  }
  .ticket-row__customer {
    font-weight: 700;
    font-size: 16px;
  }
  .ticket-row__total {
    font-weight: 700;
    color: var(--vert-sauge-dark);
    font-size: 16px;
  }
  .ticket-row__bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    font-size: 13px;
    color: var(--bois);
  }
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge--ok { background: #dceadf; color: var(--vert-sauge-dark); }
.badge--cancel { background: #f3d6cb; color: var(--terracotta-dark); }
.badge--open { background: #fbeec0; color: #8a6310; }

.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 16px;
}

/* ── Modal édition ticket ─────────────────────────────────────────────── */
.edit-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--creme);
  border-radius: var(--radius-sm);
  padding: 8px;
  max-height: 380px;
  overflow-y: auto;
}
.edit-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: white;
  border-radius: 6px;
}
.edit-line__qty {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--creme);
  border-radius: 999px;
  padding: 2px;
}
.edit-line__btn {
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 18px;
  font-weight: 700;
  min-height: 0;
  border-radius: 50%;
  background: white;
  color: var(--noir);
}
.edit-line__btn:hover:not(:disabled) {
  background: var(--vert-sauge);
  color: white;
}
.edit-line__qty-value {
  min-width: 24px;
  text-align: center;
  font-weight: 700;
  font-size: 15px;
}
.edit-line__main {
  flex: 1;
  min-width: 0;
}
.edit-line__name {
  font-weight: 500;
  font-size: 14px;
}
.edit-line__choices {
  font-size: 12px;
  color: var(--bois);
  font-style: italic;
}
.edit-line__price {
  font-weight: 600;
  color: var(--vert-sauge-dark);
  font-size: 14px;
}
.edit-line__del {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 18px;
  min-height: 0;
  color: var(--terracotta);
  border-radius: 50%;
}
.edit-line__del:hover:not(:disabled) {
  background: var(--terracotta);
  color: white;
}
.edit-total {
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--creme);
  border-radius: var(--radius-sm);
  font-size: 16px;
}
.edit-total strong {
  font-size: 22px;
  color: var(--vert-sauge-dark);
  font-family: 'Caveat', cursive;
  line-height: 1;
}

/* Bouton ✎ dans la card ticket */
.ticket-card__edit {
  background: transparent;
  border: none;
  color: var(--bois);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 50%;
  transition: background 0.1s;
}
.ticket-card__edit:hover { background: var(--creme); }
.ticket-card__items { cursor: pointer; }

/* ── Modal encaissement ───────────────────────────────────────────────── */
.pay-total {
  text-align: center;
  background: var(--creme);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 14px;
}
.pay-total__amount {
  font-family: 'Caveat', cursive;
  font-size: 56px;
  font-weight: 700;
  color: var(--vert-sauge-dark);
  line-height: 1;
  margin-top: 4px;
}

.pay-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.pay-mode {
  background: white;
  border: 2px solid var(--creme-dark);
  border-radius: var(--radius-sm);
  padding: 18px 12px;
  cursor: pointer;
  text-align: center;
  font-weight: 600;
  font-size: 16px;
  color: var(--noir);
  transition: border-color 0.15s, background 0.15s;
  font-family: inherit;
}
.pay-mode:hover { border-color: var(--vert-sauge); }
.pay-mode.active {
  border-color: var(--vert-sauge);
  background: var(--vert-sauge);
  color: white;
}
.pay-mode__icon {
  font-size: 32px;
  margin-bottom: 4px;
}

.pay-cash { display: flex; flex-direction: column; gap: 12px; }

.pay-quick {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.pay-quick .btn {
  flex: 1;
  min-width: 72px;
  padding: 10px 8px;
  font-size: 14px;
  background: var(--creme);
  color: var(--noir);
  min-height: 0;
}
.pay-quick .btn:hover:not(:disabled) {
  background: var(--creme-dark);
}

.pay-change {
  background: var(--creme);
  border-left: 4px solid var(--vert-sauge);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
}
.pay-change strong {
  font-size: 24px;
  color: var(--vert-sauge-dark);
}
.pay-change--insufficient {
  border-left-color: var(--terracotta);
}
.pay-change--insufficient strong { color: var(--terracotta); }

/* ── Ticket d'impression ──────────────────────────────────────────────── */
#print-area {
  position: absolute;
  left: -9999px;
  top: 0;
  visibility: hidden;
}
.ticket-print {
  font-family: 'Inter', -apple-system, sans-serif;
  width: 80mm;
  padding: 4mm;
  color: #000;
  font-size: 12px;
  line-height: 1.4;
}
.ticket-print__header { text-align: center; }
.ticket-print__brand {
  font-family: 'Caveat', 'Comic Sans MS', cursive;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 2px;
}
.ticket-print__sub {
  font-size: 11px;
  font-style: italic;
}
.ticket-print hr {
  border: none;
  border-top: 1px dashed #000;
  margin: 6px 0;
}
.ticket-print__meta { font-size: 11px; }
.ticket-print__items { font-size: 12px; }
.ticket-print__line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}
.ticket-print__line em { font-style: italic; color: #444; }
.ticket-print__total {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 16px;
  margin: 4px 0;
}
.ticket-print__pay { font-size: 11px; }
.ticket-print__footer {
  text-align: center;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed #000;
  font-style: italic;
  font-size: 11px;
}

@media print {
  body * { visibility: hidden !important; }
  #print-area, #print-area * {
    visibility: visible !important;
  }
  #print-area {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
  }
  .ticket-print {
    width: 80mm;
    margin: 0 auto;
  }
  @page {
    margin: 4mm;
    size: 80mm auto;
  }
}

/* Responsive : <960px : cart en bas. <720px : sidebar en haut horizontale */
@media (max-width: 960px) {
  .selector {
    grid-template-columns: 200px 1fr;
    grid-template-rows: 1fr auto;
  }
  .selector__cart {
    grid-column: 1 / -1;
    grid-row: 2;
    border-left: none;
    border-top: 2px solid var(--vert-sauge);
    flex-direction: row;
    align-items: stretch;
    max-height: 220px;
  }
  .cart__header {
    flex: 0 0 160px;
    border-bottom: none;
    border-right: 1px dashed var(--creme-dark);
  }
  .cart__items {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .cart-line { flex-shrink: 0; min-width: 180px; }
  .cart__footer {
    flex: 0 0 200px;
    border-top: none;
    border-left: 1px dashed var(--creme-dark);
  }
}

@media (max-width: 720px) {
  .selector {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }
  .selector__sidebar {
    flex-direction: row;
    overflow-x: auto;
    padding: 10px;
  }
  .selector__back { flex-shrink: 0; }
  .selector__cats {
    flex-direction: row;
    flex-shrink: 0;
  }
  .selector__cat { white-space: nowrap; }
}
