/* Limon Bistro — QR menu demo. Mobile-first, warm and calm. */

:root {
  --ink: #1f2a1c;
  --ink-2: #4b5646;
  --muted: #7a8274;
  --bg: #f7f4ec;
  --card: #ffffff;
  --line: #e7e2d4;
  --lemon: #f4d03f;
  --lemon-deep: #e0b416;
  --leaf: #3f6b35;
  --danger: #c4452f;
  --radius: 18px;
  --shadow: 0 1px 2px rgb(31 42 28 / 0.06), 0 8px 24px rgb(31 42 28 / 0.08);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 140px; }
body {
  margin: 0;
  font-family: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
  min-height: 100vh;
  overflow-x: hidden;
}
body.locked { overflow: hidden; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--lemon-deep); outline-offset: 2px; }
.muted { color: var(--muted); }
small { font-size: 0.82rem; }

/* ---- Demo chrome ---------------------------------------------------------- */
.demo-strip {
  display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: space-between; align-items: center;
  padding: 8px 16px; font-size: 0.8rem; background: var(--ink); color: #dfe5d8;
}
.demo-strip strong { color: var(--lemon); }
.demo-strip a { color: #fff; text-decoration: none; font-weight: 600; }
.demo-strip a:hover { text-decoration: underline; }

.mode-switch {
  display: flex; gap: 6px; padding: 10px 16px; overflow-x: auto; scrollbar-width: none;
  background: #ebe6d8; border-bottom: 1px solid var(--line);
}
.mode-switch::-webkit-scrollbar { display: none; }
.mode-switch a {
  flex: none; padding: 7px 14px; border-radius: 999px; text-decoration: none;
  font-size: 0.88rem; font-weight: 600; color: var(--ink-2);
}
.mode-switch a:hover { background: rgb(255 255 255 / 0.6); }
.mode-switch a[aria-current="page"] { background: var(--ink); color: #fff; }

main { max-width: 760px; margin: 0 auto; padding: 0 16px 120px; }
body[data-view="kitchen"] main, body[data-view="qr"] main { max-width: 1200px; }

.kicker {
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--leaf);
}

/* ---- Buttons --------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 14px; border: 1px solid transparent;
  font-weight: 700; text-decoration: none; transition: transform 0.15s, background 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:hover { background: #2c3a28; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { background: #f1ede2; }
.btn.block { width: 100%; }
.btn.grow { flex: 1; }
.link {
  background: none; border: 0; padding: 4px 6px; font-weight: 600; color: var(--leaf);
  text-decoration: underline; text-underline-offset: 3px;
}
.pill {
  padding: 9px 14px; border-radius: 999px; border: 1px solid rgb(255 255 255 / 0.25);
  background: rgb(255 255 255 / 0.12); color: #fff; font-weight: 600; font-size: 0.9rem;
}
.pill:hover { background: rgb(255 255 255 / 0.22); }

/* ---- Venue header ---------------------------------------------------------- */
.venue {
  position: relative; overflow: hidden;
  margin: 16px 0 0; padding: 24px 20px 20px; border-radius: 24px;
  color: #fff; background: radial-gradient(120% 140% at 100% 0%, #4c7a3f 0%, var(--ink) 60%);
  display: grid; gap: 18px;
}
.venue::after {
  content: ""; position: absolute; right: -46px; top: -46px; width: 130px; height: 130px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fbe88a, var(--lemon) 45%, var(--lemon-deep));
  opacity: 0.9; box-shadow: 0 0 0 14px rgb(244 208 63 / 0.15);
}
.venue > * { position: relative; z-index: 1; }
.venue .kicker { color: var(--lemon); }
.venue h1 { font-size: clamp(1.9rem, 7vw, 2.6rem); font-weight: 800; letter-spacing: -0.02em; margin: 2px 0 6px; }
.venue .muted { color: #c9d3c2; max-width: 30ch; }
.venue-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Sticky search + categories ----------------------------------------- */
.sticky-bar {
  position: sticky; top: 0; z-index: 10;
  margin: 0 -16px; padding: 12px 16px 10px;
  background: rgb(247 244 236 / 0.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.search {
  display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 46px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
}
.search svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 1rem; }
.cats { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cat {
  flex: none; padding: 7px 14px; border-radius: 999px; text-decoration: none; font-size: 0.9rem; font-weight: 600;
  color: var(--ink-2); background: var(--card); border: 1px solid var(--line); transition: background 0.2s, color 0.2s;
}
.cat.active { background: var(--lemon); border-color: var(--lemon-deep); color: var(--ink); }

/* ---- Menu items ------------------------------------------------------------ */
.menu-section { padding-top: 22px; }
.menu-section h2 { font-size: 1.25rem; font-weight: 800; margin-bottom: 10px; }
.items { display: grid; gap: 10px; }
.item {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  width: 100%; padding: 12px; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  transition: transform 0.15s, box-shadow 0.15s;
}
.item:hover { box-shadow: var(--shadow); }
.item:active { transform: scale(0.99); }
.tile {
  display: grid; place-items: center; width: 60px; height: 60px; border-radius: 16px; flex: none;
  background: linear-gradient(140deg, var(--a), var(--b)); color: #fff;
  box-shadow: inset 0 -6px 12px rgb(0 0 0 / 0.12);
}
.tile svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.item-text { display: grid; gap: 3px; min-width: 0; }
.item-text strong { font-size: 1rem; font-weight: 700; }
.item-text .muted { font-size: 0.86rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.tags span {
  padding: 2px 8px; border-radius: 999px; font-size: 0.72rem; font-weight: 600;
  background: #eef3e8; color: var(--leaf);
}
.item-price { display: grid; justify-items: end; gap: 8px; font-weight: 700; white-space: nowrap; }
.add {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px;
  background: var(--lemon); color: var(--ink); font-size: 1.2rem; font-weight: 700; line-height: 1;
}
.empty { padding: 40px 0; text-align: center; color: var(--muted); }

/* ---- Floating cart bar ------------------------------------------------------ */
.cart-bar {
  position: fixed; z-index: 20; left: 50%; bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%); width: min(728px, calc(100% - 32px));
  display: flex; align-items: center; gap: 12px; height: 58px; padding: 0 18px;
  border: 0; border-radius: 18px; background: var(--ink); color: #fff; font-weight: 700; font-size: 1rem;
  box-shadow: 0 12px 30px rgb(31 42 28 / 0.35);
  animation: rise 0.3s ease-out;
}
.cart-bar strong { margin-left: auto; }
.badge {
  display: grid; place-items: center; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px;
  background: var(--lemon); color: var(--ink); font-size: 0.9rem;
}

/* ---- Bottom sheets ------------------------------------------------------------ */
.overlay {
  position: fixed; inset: 0; z-index: 30; background: rgb(20 26 18 / 0.45);
  animation: fade 0.2s ease-out;
}
.sheet {
  position: fixed; z-index: 31; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(560px, 100%); max-height: 88vh; overflow-y: auto; overscroll-behavior: contain;
  padding: 20px 18px max(18px, env(safe-area-inset-bottom));
  background: var(--card); border-radius: 24px 24px 0 0; box-shadow: 0 -10px 40px rgb(0 0 0 / 0.2);
  animation: sheet-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet::before {
  content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: -8px auto 14px;
}
.sheet-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.sheet-head > div { flex: 1; min-width: 0; }
.sheet-head h2 { font-size: 1.3rem; font-weight: 800; line-height: 1.2; }
.sheet-head .muted { font-size: 0.92rem; margin-top: 4px; }
.close {
  flex: none; width: 36px; height: 36px; border-radius: 50%; border: 0; background: #f1ede2; font-size: 1.4rem; line-height: 1;
}
.opt-group { border: 0; margin: 0 0 14px; padding: 0; }
.opt-group legend { font-weight: 700; margin-bottom: 8px; padding: 0; }
.opt-group legend small { font-weight: 500; margin-left: 6px; }
.opt {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 6px;
  border: 1px solid var(--line); border-radius: 14px; cursor: pointer;
}
.opt:has(input:checked) { border-color: var(--leaf); background: #f3f7ee; }
.opt input { width: 20px; height: 20px; margin: 0; accent-color: var(--leaf); }
.opt span:first-of-type { flex: 1; }
.note { display: grid; gap: 6px; margin-bottom: 16px; font-weight: 700; }
.note input {
  height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: 14px; font-weight: 400; background: #fcfbf7;
}
.sheet-foot { display: flex; gap: 10px; align-items: center; position: sticky; bottom: 0; background: var(--card); padding-top: 6px; }
.qty { display: flex; align-items: center; gap: 4px; background: #f1ede2; border-radius: 14px; padding: 4px; }
.qty button { width: 40px; height: 40px; border: 0; border-radius: 10px; background: var(--card); font-size: 1.2rem; font-weight: 700; }
.qty span { min-width: 26px; text-align: center; font-weight: 700; }
.qty.small { padding: 3px; border-radius: 12px; }
.qty.small button { width: 30px; height: 30px; font-size: 1rem; }
.qty.small span { min-width: 20px; }

.cart-lines { list-style: none; margin: 0 0 12px; padding: 0; }
.cart-lines li {
  display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center;
  padding: 12px 0; border-bottom: 1px dashed var(--line);
}
.cart-lines.readonly li { grid-template-columns: 1fr auto; }
.cart-lines li > div:first-child { display: grid; gap: 2px; min-width: 0; }
.line-total { font-weight: 700; min-width: 64px; text-align: right; }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.1rem; margin: 6px 0 4px; }
.cart-total strong { font-size: 1.35rem; }
.small-note { font-size: 0.86rem; margin-bottom: 14px; }

/* ---- Order tracking --------------------------------------------------------- */
.panel-card {
  margin-top: 20px; padding: 24px 20px; background: var(--card); border: 1px solid var(--line);
  border-radius: 24px; box-shadow: var(--shadow); display: grid; gap: 10px;
}
.track h1 { font-size: clamp(1.6rem, 6vw, 2.1rem); font-weight: 800; letter-spacing: -0.01em; }
.track-steps {
  list-style: none; margin: 12px 0 8px; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; font-size: 0.82rem; font-weight: 600; color: var(--muted);
}
.track-steps li { display: grid; justify-items: center; gap: 8px; position: relative; }
.track-steps li::before {
  content: ""; position: absolute; top: 13px; right: 50%; width: 100%; height: 3px; background: var(--line); z-index: 0;
}
.track-steps li:first-child::before { display: none; }
.track-steps li.done::before, .track-steps li.current::before { background: var(--leaf); }
.track-steps span {
  position: relative; z-index: 1; width: 28px; height: 28px; border-radius: 50%;
  background: var(--card); border: 3px solid var(--line);
}
.track-steps li.done { color: var(--leaf); }
.track-steps li.done span { background: var(--leaf); border-color: var(--leaf); }
.track-steps li.done span::after {
  content: ""; position: absolute; left: 7px; top: 3px; width: 6px; height: 11px;
  border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg);
}
.track-steps li.current { color: var(--ink); }
.track-steps li.current span { border-color: var(--leaf); background: var(--lemon); animation: pulse 1.6s ease-in-out infinite; }
.hint {
  margin-top: 8px; padding: 12px 14px; border-radius: 14px; font-size: 0.88rem;
  background: #fbf3cf; color: #5d4d0c;
}
.track .btn { justify-self: start; }

/* ---- Kitchen display ------------------------------------------------------------ */
.kitchen, .qr-page { padding-top: 20px; }
.k-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.k-head h1 { font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 800; }
.k-head .muted { margin-top: 4px; }
.k-stats { display: flex; align-items: center; gap: 12px; font-size: 0.92rem; color: var(--ink-2); }
.calls { display: grid; gap: 8px; margin-bottom: 16px; }
.call {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 12px 16px; border-radius: 14px;
  background: #fff4d1; border: 1px solid #f1d77a; animation: rise 0.3s ease-out;
}
.call small { color: var(--muted); }
.call .link { margin-left: auto; }
.k-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.k-col { background: #ece7d9; border-radius: 20px; padding: 12px; display: grid; gap: 10px; }
.k-col h2 { display: flex; align-items: center; justify-content: space-between; font-size: 1rem; font-weight: 800; padding: 4px 6px; }
.count {
  display: grid; place-items: center; min-width: 26px; height: 26px; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: 0.82rem;
}
.ticket {
  background: var(--card); border-radius: 16px; padding: 14px; display: grid; gap: 10px;
  border-left: 5px solid var(--leaf); box-shadow: 0 1px 2px rgb(0 0 0 / 0.06); animation: rise 0.3s ease-out;
}
.ticket.late { border-left-color: var(--danger); }
.ticket.late header span { color: var(--danger); font-weight: 700; }
.ticket header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ticket header strong { font-size: 1.15rem; }
.ticket header span { font-size: 0.82rem; color: var(--muted); }
.ticket ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ticket li small { display: block; color: var(--muted); margin-left: 22px; }
.ticket .btn { min-height: 42px; }
.note-line { color: #8a5a00 !important; font-style: italic; }
.k-empty { text-align: center; color: var(--muted); padding: 18px 0; font-size: 0.9rem; }

/* ---- Table QR cards ---------------------------------------------------------------- */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.qr-card {
  display: grid; justify-items: center; gap: 6px; padding: 18px 14px 16px; text-align: center; text-decoration: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 20px; transition: box-shadow 0.15s, transform 0.15s;
  position: relative; overflow: hidden;
}
.qr-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 6px; background: linear-gradient(90deg, var(--lemon), var(--leaf)); }
.qr-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.qr { display: block; width: 150px; aspect-ratio: 1; }
.qr svg { width: 100%; height: 100%; display: block; }
.qr-missing { display: grid; place-items: center; width: 100%; height: 100%; background: #eee; border-radius: 8px; }
.qr-card strong { font-size: 1.15rem; font-weight: 800; }
.qr-card small { color: var(--muted); }

/* ---- Toast --------------------------------------------------------------------- */
.toast {
  position: fixed; z-index: 50; left: 50%; top: 16px; transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px;
  background: var(--ink); color: #fff; font-weight: 600; box-shadow: 0 10px 30px rgb(0 0 0 / 0.25);
  animation: drop 0.25s ease-out;
}
.toast[hidden] { display: none; }
.noscript { padding: 40px 0; text-align: center; }

/* ---- Motion --------------------------------------------------------------------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.cart-bar { animation-name: rise-x; }
@keyframes rise-x { from { opacity: 0; transform: translate(-50%, 14px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes sheet-in { from { transform: translate(-50%, 100%); } }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -10px); } }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgb(244 208 63 / 0.35); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---- Larger screens --------------------------------------------------------------- */
@media (min-width: 720px) {
  .venue { grid-template-columns: 1fr auto; align-items: end; padding: 32px 28px 26px; }
  .venue::after { right: -30px; top: -50px; width: 200px; height: 200px; }
  .items { grid-template-columns: 1fr 1fr; }
  .sheet { bottom: auto; top: 50%; transform: translate(-50%, -50%); border-radius: 24px; max-height: 84vh; }
  .sheet::before { display: none; }
  @keyframes sheet-in { from { opacity: 0; transform: translate(-50%, -46%); } }
}
@media (max-width: 860px) {
  .k-board { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .tile { width: 50px; height: 50px; }
  .tile svg { width: 24px; height: 24px; }
}

/* ---- Print: just the QR cards ------------------------------------------------------ */
@media print {
  .demo-strip, .mode-switch, .qr-page .btn, .qr-page .muted, .toast { display: none !important; }
  body { background: #fff; }
  main { max-width: none; padding: 0; }
  .qr-grid { grid-template-columns: repeat(3, 1fr); gap: 10mm; }
  .qr-card { break-inside: avoid; border: 1px solid #999; box-shadow: none; transform: none; }
  .qr { width: 45mm; }
}
