/* Caisse demo — Berrad colours, paper ticket. Mobile first. */

:root {
  --bg: #F5F2EA; --sand: #EBE6D9; --line: #D9D3C3; --white: #FFFFFF;
  --green: #0F4C3A; --terra: #B8492A; --terra-dark: #9C3B20;
  --ink: #1E2A25; --muted: #4F5B55; --hl: #FFD21F;
  --display: 'El Messiri', Georgia, serif;
  --body: 'Outfit', 'Segoe UI', Arial, sans-serif;
  --mono: 'Space Mono', ui-monospace, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--body); font-size: 16px; line-height: 1.5;
  overflow-x: hidden;
  padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
}
h1, h2, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--terra); outline-offset: 2px; }
[id] { scroll-margin-top: 12px; }

.wrap { width: 100%; max-width: 1120px; margin-inline: auto; padding-inline: 16px; }

.demo-bar { background: var(--green); color: var(--bg); font-size: 14px; }
.demo-bar__in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; min-height: 44px; padding-block: 6px; }
.demo-bar a { color: var(--bg); font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.demo-bar a:hover { text-decoration: underline; }

.top { background: var(--white); border-bottom: 1px solid var(--line); }
.top__in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; padding-block: 12px; }
.top__id { display: flex; align-items: baseline; gap: 10px; }
.top__id h1 { font-family: var(--display); font-weight: 700; font-size: 28px; line-height: 1; color: var(--green); }
.top__id span { color: var(--muted); font-weight: 500; }
.stats { display: flex; gap: 10px; }
.stats div { background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 6px 12px; min-width: 104px; }
.stats dt { font-size: 12px; color: var(--muted); }
.stats dd { font-weight: 700; font-size: 18px; color: var(--green); font-variant-numeric: tabular-nums; }

.app { display: grid; gap: 20px; padding-block: 16px 28px; align-items: start; }
@media (min-width: 900px) { .app { grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; padding-block: 24px 48px; } }

.panel { display: grid; gap: 12px; min-width: 0; }
.row-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.chip {
  flex: none; position: relative;
  min-height: 46px; padding: 8px 16px;
  background: var(--white); border: 1px solid var(--line); border-radius: 4px;
  font-weight: 600; white-space: nowrap; cursor: pointer;
}
.chip:hover { border-color: var(--green); }
.chip[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: var(--white); }
.chip.has-items::after {
  content: ""; position: absolute; top: 6px; inset-inline-end: 6px;
  width: 9px; height: 9px; border-radius: 50%; background: var(--terra);
  box-shadow: 0 0 0 2px var(--white);
}
.chip--cat { border-radius: 999px; }
.chip--cat[aria-pressed="true"] { background: var(--terra); border-color: var(--terra); }

.products { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .products { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1040px) { .products { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.product {
  display: grid; gap: 10px; align-content: space-between; text-align: start;
  min-height: 96px; padding: 12px;
  background: var(--white); border: 1px solid var(--line); border-radius: 4px;
  cursor: pointer; transition: border-color .12s ease, transform .08s ease;
}
.product:hover { border-color: var(--green); }
.product:active { transform: scale(0.97); }
.product__name { font-weight: 600; font-size: 16px; line-height: 1.25; }
.product__foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.product__price { font-family: var(--mono); font-size: 14px; }
.product__stock { font-size: 12px; font-weight: 600; color: var(--muted); }
.product.is-low .product__stock { color: var(--terra-dark); }
.product.is-low { border-color: var(--terra); }
.product[disabled] { opacity: 0.55; cursor: not-allowed; }
.hint { font-size: 14px; color: var(--muted); }

.side { display: grid; gap: 20px; min-width: 0; }
@media (min-width: 900px) { .side { position: sticky; top: 16px; } }

.ticket { filter: drop-shadow(0 12px 18px rgba(30, 42, 37, 0.16)); color: #121212; font-family: var(--mono); font-size: 14px; }
.ticket__paper { background: var(--white); padding: 20px 18px 16px; display: grid; gap: 12px; }
.ticket__head { display: grid; gap: 2px; text-align: center; }
.ticket__brand { font-size: 18px; letter-spacing: 0.04em; }
.ticket__rule { border-top: 2px dashed #121212; }
.ticket__edge {
  height: 12px;
  background: linear-gradient(135deg, var(--white) 50%, transparent 50%), linear-gradient(225deg, var(--white) 50%, transparent 50%);
  background-size: 12px 12px;
}
.lines { display: grid; gap: 10px; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; }
.line__name { font-weight: 700; overflow-wrap: anywhere; }
.line__sum { font-variant-numeric: tabular-nums; }
.qty { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; }
.qty button {
  width: 44px; height: 44px; border: 1.5px solid #121212; border-radius: 4px;
  background: var(--white); font-family: var(--mono); font-size: 20px; line-height: 1; cursor: pointer;
}
.qty button:hover { background: var(--hl); }
.qty span { min-width: 22px; text-align: center; font-weight: 700; }
.qty small { color: #55534D; font-size: 12px; }
.empty { color: #55534D; font-size: 14px; }
.total { display: flex; justify-content: space-between; align-items: baseline; font-size: 18px; }
.total strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.paid:empty { display: none; }
.paid { background: var(--hl); padding: 8px 10px; font-weight: 700; text-align: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 12px 20px; border: 2px solid transparent; border-radius: 4px;
  font-family: var(--body); font-weight: 700; font-size: 17px; text-decoration: none; cursor: pointer;
}
.btn--pay { background: var(--terra); color: var(--white); }
.btn--pay:hover { background: var(--terra-dark); }
.btn--clear { background: transparent; border-color: #121212; color: #121212; min-height: 46px; font-size: 15px; }
.btn--clear:hover { background: var(--sand); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn--cta { background: var(--terra); color: var(--white); }
.btn--cta:hover { background: var(--terra-dark); }

.stock { background: var(--white); border: 1px solid var(--line); border-radius: 4px; padding: 16px 18px; display: grid; gap: 10px; }
.stock h2 { font-family: var(--display); font-size: 21px; font-weight: 700; color: var(--green); }
.stock li { display: flex; justify-content: space-between; gap: 12px; padding-block: 8px; border-bottom: 1px solid var(--line); }
.stock li:last-child { border-bottom: 0; }
.stock li b { color: var(--terra-dark); white-space: nowrap; }

.credit { background: var(--green); color: var(--bg); }
.credit__in { padding-block: 32px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; }
.credit p { max-width: 620px; font-size: 18px; }

.mbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--white); border-top: 1px solid var(--line);
  box-shadow: 0 -6px 18px rgba(30, 42, 37, 0.10);
}
.mbar__sum { display: grid; line-height: 1.25; min-width: 0; }
.mbar__sum > span { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mbar__sum strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.mbar .btn { min-height: 48px; }
@media (min-width: 900px) {
  .mbar { display: none; }
  body { padding-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
