:root {
  --accent: #d6336c;
  --accent-dark: #a61e4d;
  --accent-soft: #fce4ec;
  --text: #1a1a1a;
  --muted: #666666;
  --line: #e6e6e6;
  --bg: #ffffff;
  --low: #b35c00;
  --out: #c92a2a;
  --radius: 10px;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 18px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
h2 { font-size: 20px; margin: 0 0 12px; }
h3 { font-size: 18px; margin: 24px 0 8px; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 8px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
.top h1 { margin: 0; font-size: 20px; color: var(--accent-dark); }
.sync { border: 0; background: none; padding: 4px 0; font-size: 15px; color: var(--muted); cursor: pointer; }
.sync.error { color: var(--out); }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 18px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent); color: #fff; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--accent-dark); }
.btn.small { min-height: 40px; padding: 0 12px; font-size: 16px; }
.btn:disabled { opacity: .5; cursor: default; }

.field { display: block; margin: 0 0 16px; }
.field > span { display: block; margin-bottom: 6px; font-size: 15px; color: var(--muted); }
.field input, .field select, .field textarea, .search input, .toolbar input, .toolbar select { width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-bottom: 8px; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.error-text { color: var(--out); font-size: 15px; margin: 4px 0 12px; }

.panel { max-width: 720px; margin: 0 auto; padding: 16px; }
.center { max-width: 360px; margin: 12vh auto 0; padding: 0 16px; }
.pin-input { font-size: 28px; letter-spacing: 8px; text-align: center; }

/* Vente */
.search { padding: 12px 16px 8px; }
.cats { display: flex; gap: 8px; overflow-x: auto; padding: 0 16px 8px; scrollbar-width: none; }
.chip { flex: none; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 20px; background: #fff; cursor: pointer; }
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-dark); font-weight: 600; }
.list { list-style: none; margin: 0; padding: 0 0 220px; }
.item { display: flex; width: 100%; align-items: center; gap: 12px; min-height: 64px; padding: 10px 16px; border: 0; border-bottom: 1px solid var(--line); background: #fff; text-align: left; cursor: pointer; }
.item:active { background: var(--accent-soft); }
.item-name { flex: 1; }
.item-price { font-weight: 600; }
.item-stock { min-width: 44px; text-align: right; font-size: 15px; color: var(--muted); }
.low { color: var(--low) !important; }
.out { color: var(--out) !important; font-weight: 600; }
.empty { padding: 24px 16px; color: var(--muted); text-align: center; list-style: none; }

.sheet { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; background: rgba(0, 0, 0, .35); }
.sheet-panel { width: 100%; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); background: #fff; border-radius: 16px 16px 0 0; }
.sizes { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 10px; margin-bottom: 12px; }
.size { min-height: 64px; border: 1px solid var(--accent); border-radius: var(--radius); background: #fff; font-weight: 600; cursor: pointer; }
.size small { display: block; font-weight: 400; font-size: 14px; color: var(--muted); }

.bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: #fff; border-top: 2px solid var(--accent); box-shadow: 0 -4px 16px rgba(0, 0, 0, .06); }
.bar-summary { display: flex; width: 100%; justify-content: space-between; align-items: center; min-height: 44px; padding: 0; border: 0; background: none; cursor: pointer; }
.bar-summary strong { font-size: 22px; }
.bar-detail { max-height: 40vh; overflow-y: auto; margin: 4px 0 8px; }
.cart-lines { list-style: none; margin: 0; padding: 0; }
.cart-line { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.cart-line span { flex: 1; }
.qty { width: 44px; min-height: 44px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; font-size: 22px; cursor: pointer; }
.bar-pay { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 8px; }
.pay { min-height: 56px; padding: 0 8px; font-size: 18px; }
.size.active { background: var(--accent-soft); color: var(--accent-dark); }
.misc-item .item-name { color: var(--accent-dark); font-weight: 600; }

.toast { position: fixed; left: 16px; right: 16px; top: 64px; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 16px; border-radius: var(--radius); background: var(--text); color: #fff; }
.toast .btn.ghost { color: #fff; border-color: #fff; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 16px; padding: 10px 12px; border-radius: var(--radius); background: var(--accent-soft); font-size: 15px; }

/* Admin */
.tabs { position: sticky; top: 56px; z-index: 4; display: flex; overflow-x: auto; background: #fff; border-bottom: 1px solid var(--line); }
.tab { flex: none; min-height: 48px; padding: 0 16px; border: 0; border-bottom: 3px solid transparent; background: none; cursor: pointer; }
.tab.active { border-bottom-color: var(--accent); color: var(--accent-dark); font-weight: 600; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.toolbar input, .toolbar select { flex: 1 1 200px; width: auto; }
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row-main { flex: 1 1 180px; min-width: 0; }
.row-sub { font-size: 15px; color: var(--muted); }
.variant-row { display: grid; grid-template-columns: 1fr 100px 44px; gap: 8px; align-items: center; margin-bottom: 8px; }
.variant-row input { min-height: 44px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); }
table.recap { width: 100%; border-collapse: collapse; margin: 12px 0; }
.recap th, .recap td { padding: 10px 6px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: middle; }
.recap th:first-child, .recap td:first-child { text-align: left; }
.recap input { width: 100%; min-height: 44px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; text-align: right; }
.diff-zero { color: var(--muted); }
.diff-bad { color: var(--out); font-weight: 700; }
.cancelled { text-decoration: line-through; color: var(--muted); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-dark); font-size: 13px; }
dialog { width: min(92vw, 520px); max-height: 90vh; border: 0; border-radius: 14px; padding: 16px; }
dialog::backdrop { background: rgba(0, 0, 0, .35); }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 16px; }
