/* Elsie Cosmetics — charte de l'application de caisse */
:root {
  --nude: #F6E7DF;
  --nude-2: #EBCFC2;
  --nude-3: #F1E4DD;
  --line: #E2C6B9;
  --line-soft: #F1DDD3;
  --paper: #FFFBF8;
  --terra: #A35F48;
  --terra-dark: #7E4330;
  --terra-light: #E9B9A3;
  --brown: #3A2318;
  --ink: #1A1210;
  --muted: #6E5248;
  --muted-light: #D9BBAE;
  --ok: #2F7D4F;
  --warn-bg: #F7E2C2; --warn: #7A4700;
  --bad-bg: #F5D5D2; --bad: #8E2A2A;
  --script: 'Great Vibes', 'Brush Script MT', cursive;
  --serif: 'Bodoni Moda', 'Didot', 'Bodoni 72', Georgia, serif;
  --sans: 'Jost', 'Futura', 'Century Gothic', 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', 'Consolas', monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--nude); color: var(--ink); font-family: var(--sans); font-size: 15px;
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; overflow: hidden;
}
input, textarea, select { user-select: text; -webkit-user-select: text; }
button { font-family: var(--sans); cursor: pointer; color: inherit; }
button:disabled { cursor: default; opacity: .45; }
a { color: var(--terra-dark); }
.hidden { display: none !important; }

/* ---------- Structure ---------- */
#app { height: 100vh; display: flex; }
.nav {
  width: 88px; flex: none; background: var(--brown); display: flex; flex-direction: column;
  align-items: center; padding: 16px 0; gap: 8px;
}
.nav .mono { font-family: var(--script); font-size: 44px; line-height: 1; color: var(--terra-light); margin-bottom: 14px; }
.nav button {
  width: 66px; height: 64px; border: none; border-radius: 16px; background: transparent; color: var(--muted-light);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 10.5px; letter-spacing: 1px;
}
.nav button.on { background: var(--terra); color: #FFF6F1; }
.nav .spacer { flex: 1; }
.nav .sync { font-size: 10px; color: var(--muted-light); text-align: center; padding: 0 6px; line-height: 1.3; }
.nav .sync .dot { display: inline-block; width: 8px; height: 8px; border-radius: 4px; background: #5FBF86; margin-bottom: 4px; }
.nav .sync.off .dot { background: #E0A64B; }

.view { flex: 1; min-width: 0; display: flex; height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 0 26px 20px; }
.topbar { height: 82px; flex: none; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; flex-direction: column; line-height: 1; flex: none; }
.brand .script { font-family: var(--script); font-size: 40px; color: var(--terra); }
.brand .caps { font-family: var(--serif); font-size: 12px; letter-spacing: 6px; margin-top: -2px; }
.kicker { font-size: 11px; letter-spacing: 4px; color: var(--terra-dark); text-transform: uppercase; }
.title { font-family: var(--serif); font-size: 27px; }
.muted { color: var(--muted); }
.serif { font-family: var(--serif); }

/* ---------- Éléments ---------- */
.search {
  flex: 1; min-width: 0; height: 52px; display: flex; align-items: center; gap: 12px; background: var(--paper);
  border-radius: 26px; padding: 0 20px; box-shadow: 0 1px 0 var(--line);
}
.search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font: 16px var(--sans); color: var(--ink); }
.ratebox {
  flex: none; height: 52px; display: flex; flex-direction: column; justify-content: center; padding: 0 16px;
  border-radius: 14px; background: var(--ink); color: var(--nude); border: none; text-align: left;
}
.ratebox small { font-size: 10px; letter-spacing: 3px; color: var(--muted-light); }
.ratebox b { font-family: var(--serif); font-weight: 400; font-size: 17px; }
.seg { flex: none; display: flex; padding: 4px; gap: 4px; border-radius: 26px; background: var(--nude-2); }
.seg button {
  min-width: 70px; min-height: 44px; padding: 0 14px; border: none; border-radius: 22px; background: transparent;
  color: var(--terra-dark); font-size: 15px; font-weight: 600;
}
.seg button.on { background: var(--brown); color: var(--nude); }
.seg.small button { min-width: 0; min-height: 34px; font-size: 13px; padding: 0 12px; }

.pills { flex: none; display: flex; gap: 10px; padding: 2px 0 14px; overflow-x: auto; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pill {
  flex: none; min-height: 44px; padding: 0 20px; border-radius: 22px; font-size: 15px;
  border: 1px solid var(--line); background: transparent; color: var(--brown);
}
.pill.on { border-color: var(--brown); background: var(--brown); color: var(--nude); }

.btn {
  min-height: 52px; padding: 0 22px; border-radius: 16px; border: 1px solid var(--terra); background: transparent;
  color: var(--terra-dark); font-size: 16px;
}
.btn.primary { border: none; background: var(--terra); color: #FFF6F1; font-weight: 600; letter-spacing: 2px; }
.btn.dark { border: none; background: var(--ink); color: var(--nude); font-weight: 600; letter-spacing: 2px; }
.btn.ghost { border: 1px dashed #C99A86; }
.btn.small { min-height: 40px; font-size: 14px; padding: 0 14px; border-radius: 12px; }
.btn.block { width: 100%; }
.linkbtn { border: none; background: none; color: var(--terra-dark); font-size: 14px; min-height: 44px; padding: 0 6px; text-decoration: underline; }

.card { background: var(--paper); border-radius: 22px; padding: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field input, .field select, .field textarea {
  min-height: 50px; border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; font: 17px var(--sans);
  color: var(--ink); background: var(--paper); outline: none;
}
.field textarea { padding: 10px 14px; min-height: 80px; }
.field input:focus, .field select:focus { border-color: var(--terra); box-shadow: 0 0 0 2px rgba(163,95,72,.18); }
.field .hint { font-size: 12px; color: var(--terra-dark); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }

.tag { font-size: 11px; padding: 3px 8px; border-radius: 10px; white-space: nowrap; background: var(--nude-3); color: var(--muted); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.ok { background: #DDEFE3; color: var(--ok); }

.swatch { flex: none; border-radius: 50%; box-shadow: inset 0 -6px 12px rgba(0,0,0,.14); display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); color: rgba(255,255,255,.9); font-size: 16px; }
.thumb { flex: none; border-radius: 12px; object-fit: cover; background: var(--nude-2); }

/* ---------- Caisse ---------- */
.products {
  flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  grid-auto-rows: 236px; gap: 14px; padding: 8px 6px 6px 0; align-content: start;
}
.tile {
  position: relative; border: none; text-align: left; background: var(--paper); border-radius: 18px; padding: 12px;
  display: flex; flex-direction: column; gap: 6px; color: var(--ink); box-shadow: 0 1px 0 var(--line);
  transition: transform .08s ease;
}
.tile:active { transform: scale(.97); }
.tile .visual { flex: none; height: 104px; border-radius: 12px; background: var(--nude); display: flex; align-items: center; justify-content: center; overflow: hidden; margin-bottom: 2px; }
.tile .visual.photo { background: #fff; }
.tile .visual img { width: 100%; height: 100%; object-fit: contain; }
.tile .line { font-size: 10px; letter-spacing: 2px; color: var(--terra-dark); text-transform: uppercase; }
.tile .name { font-size: 14px; font-weight: 500; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .bottom { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.tile .price { font-family: var(--serif); font-size: 18px; font-weight: 600; white-space: nowrap; }
.tile .badge {
  position: absolute; top: -6px; right: -6px; min-width: 28px; height: 28px; border-radius: 14px; background: var(--terra);
  color: #FFF6F1; font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; border: 3px solid var(--nude); padding: 0 4px;
}
.empty { padding: 40px; text-align: center; color: var(--muted); grid-column: 1 / -1; }

.side { width: 400px; flex: none; background: var(--paper); display: flex; flex-direction: column; border-left: 1px solid var(--nude-2); min-height: 0; }
.side-head { padding: 20px 24px 12px; display: flex; align-items: flex-start; justify-content: space-between; }
.side-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 24px; }
.cartline { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.cartline .info { flex: 1; min-width: 0; }
.cartline .n { font-size: 14px; font-weight: 500; line-height: 1.2; }
.cartline .u { font-size: 12px; color: var(--muted); }
.qty { display: flex; align-items: center; gap: 5px; }
.qty button { width: 38px; height: 38px; border-radius: 19px; border: 1px solid var(--line); background: var(--paper); font-size: 18px; color: var(--terra-dark); }
.qty button.plus { border: none; background: var(--nude-2); }
.qty span { width: 24px; text-align: center; font-weight: 600; }
.cartline .t { width: 84px; text-align: right; font-family: var(--serif); font-size: 15px; font-weight: 600; white-space: nowrap; }

.paybox { padding: 16px 24px 20px; background: var(--ink); color: var(--nude); border-radius: 26px 26px 0 0; }
.paybox .row { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted-light); }
.paybox .total { display: flex; align-items: baseline; justify-content: space-between; margin-top: 8px; gap: 10px; }
.paybox .total b { font-family: var(--serif); font-weight: 400; font-size: 40px; line-height: 1; white-space: nowrap; }
.paybox .sub { text-align: right; font-size: 16px; color: var(--terra-light); margin-top: 4px; }
.paybox .go {
  width: 100%; margin-top: 14px; min-height: 64px; border: none; border-radius: 18px; background: var(--terra); color: #FFF6F1;
  font-size: 18px; font-weight: 600; letter-spacing: 3px; display: flex; align-items: center; justify-content: center; gap: 12px;
}
.paybox .alt { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin-top: 12px; }
.paybox .alt button { min-height: 44px; border-radius: 14px; border: 1px solid #4A3A33; background: transparent; color: var(--muted-light); font-size: 14px; }

/* ---------- Pavé numérique ---------- */
.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: minmax(56px, 1fr); gap: 10px; }
.keypad button {
  border: none; border-radius: 16px; font-family: var(--serif); font-size: 26px; background: var(--paper); color: var(--ink);
  box-shadow: 0 1px 0 var(--line);
}
.keypad button.sp { background: var(--nude-2); color: var(--terra-dark); font-family: var(--sans); font-size: 18px; }

/* ---------- Écrans plein (connexion, ouverture) ---------- */
.splash { display: flex; width: 100%; height: 100vh; }
.splash .left {
  width: 40%; max-width: 520px; flex: none; background: var(--brown); color: var(--nude); padding: 52px; display: flex; flex-direction: column;
}
.splash .left .script { font-family: var(--script); font-size: 84px; line-height: 1; color: var(--terra-light); }
.splash .left .caps { font-family: var(--serif); font-size: 22px; letter-spacing: 11px; margin-top: 2px; }
.splash .left .slogan { display: inline-block; margin-top: 16px; background: var(--ink); font-size: 11px; letter-spacing: 6px; padding: 6px 12px; align-self: flex-start; }
.splash .right { flex: 1; min-width: 0; padding: 44px 48px; display: flex; gap: 32px; overflow-y: auto; }
.userlist { display: flex; flex-direction: column; gap: 10px; }
.userbtn {
  display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 0 16px; border-radius: 18px; border: 1px solid var(--line);
  background: var(--paper); text-align: left; font-size: 17px;
}
.userbtn.on { border: 2px solid var(--terra); }
.avatar { width: 44px; height: 44px; border-radius: 22px; background: var(--nude-2); display: flex; align-items: center; justify-content: center; font-weight: 600; color: var(--terra-dark); flex: none; }
.pinview { display: flex; gap: 14px; justify-content: center; margin: 8px 0 18px; }
.pinview i { width: 18px; height: 18px; border-radius: 9px; border: 2px solid var(--terra); }
.pinview i.f { background: var(--terra); }
.bigrate {
  background: var(--paper); border-radius: 22px; padding: 18px 22px; border: 2px solid var(--terra); display: flex; flex-direction: column; gap: 4px;
}
.bigrate .v { font-family: var(--serif); font-size: 56px; font-weight: 600; line-height: 1.1; }

/* ---------- Listes / tableaux ---------- */
.list { display: flex; flex-direction: column; }
.list .it { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.list button.it { border: none; border-bottom: 1px solid var(--line-soft); background: none; text-align: left; width: 100%; padding: 11px 8px; border-radius: 0; font-size: 15px; }
.list button.it.on { background: var(--nude-3); border-radius: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 400; font-size: 12px; color: var(--muted); padding: 8px 6px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 6px; border-bottom: 1px solid var(--line-soft); }
.table td.n { text-align: right; font-variant-numeric: tabular-nums; }
.scroll { overflow-y: auto; min-height: 0; }

/* ---------- Fenêtres ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(26,18,16,.55); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal { background: var(--nude); border-radius: 26px; padding: 26px; width: min(760px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.narrow { width: min(460px, 100%); }
.modal h2 { font-family: var(--serif); font-weight: 400; font-size: 28px; margin: 4px 0 16px; }
.modal .actions { display: flex; gap: 12px; margin-top: 20px; justify-content: flex-end; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--paper); font-size: 15px; }

#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: var(--nude);
  padding: 14px 22px; border-radius: 16px; font-size: 15px; z-index: 80; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 80vw;
}
#toast.bad { background: var(--bad); }

/* ---------- Ticket 58 mm (impression) ---------- */
#receipt { display: none; }
@media print {
  @page { size: 58mm auto; margin: 0; }
  html, body { height: auto; overflow: visible; background: #fff; }
  body > *:not(#receipt) { display: none !important; }
  #receipt { display: block; }
}
.rcpt { width: 48mm; margin: 0 auto; padding: 3mm 0 6mm; color: #000; background: #fff; font-family: var(--mono); font-size: 10.5px; line-height: 1.4; }
.rcpt .c { text-align: center; }
.rcpt .logo { font-family: var(--script); font-size: 34px; line-height: 1; }
.rcpt .caps { font-family: var(--serif); font-size: 10px; letter-spacing: 5px; }
.rcpt .slogan { background: #000; color: #fff; font-size: 7.5px; letter-spacing: 2px; padding: 2px 0; margin-top: 5px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.rcpt .addr { font-size: 8.5px; line-height: 1.35; margin-top: 6px; }
.rcpt hr { border: none; border-top: 1px dashed #000; margin: 6px 0; }
.rcpt .r { display: flex; justify-content: space-between; gap: 4px; }
.rcpt .big { font-size: 14px; font-weight: 600; }
.rcpt .sm { font-size: 8.5px; }

/* ---------- Petits écrans (téléphone du gérant) ---------- */
@media (max-width: 820px) {
  body { overflow: auto; }
  #app { flex-direction: column-reverse; height: auto; min-height: 100vh; }
  .nav { width: 100%; flex-direction: row; justify-content: space-around; padding: 6px; position: sticky; bottom: 0; z-index: 10; }
  .nav .mono, .nav .spacer, .nav .sync { display: none; }
  .nav button { width: auto; flex: 1; height: 56px; }
  .view { flex-direction: column; height: auto; }
  .main { padding: 0 14px 16px; }
  .side { width: 100%; border-left: none; }
  .splash { flex-direction: column; height: auto; }
  .splash .left { width: 100%; max-width: none; padding: 28px; }
  .splash .left .script { font-size: 56px; }
  .splash .right { flex-direction: column; padding: 20px; }
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { height: auto; padding: 14px 0; flex-wrap: wrap; }
}
