:root {
  --red: #d12323;
  --red-dark: #a91a1a;
  --green: #5f8a1d;
  --green-bg: #eef5e1;
  --ink: #232323;
  --muted: #5d5a54;
  --cream: #fbf7ef;
  --card: #ffffff;
  --line: #e6dccb;
  --radius: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }
button, a, input, select, textarea, label { touch-action: manipulation; }
body {
  margin: 0; background: var(--cream); color: var(--ink);
  font-family: "Jost", system-ui, sans-serif; font-size: 19px; line-height: 1.4;
  padding-bottom: calc(110px + var(--safe-b));
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1 { font-size: 30px; line-height: 1.15; margin: 4px 0 6px; }
h2 { font-size: 23px; margin: 28px 0 12px; }
.muted { color: var(--muted); }
#view { padding: 16px; max-width: 720px; margin: 0 auto; outline: none; }

/* Top bar */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px; background: #fff; border-bottom: 1px solid var(--line);
}
.top-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-size: 21px; }
.top-call {
  width: 52px; height: 52px; border-radius: 50%; background: var(--green-bg); display: grid; place-items: center;
}
.top-call svg { width: 26px; height: 26px; fill: var(--green); }

/* Buttons */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  min-height: 62px; padding: 12px 20px; border-radius: 16px; border: 0;
  font-weight: 600; font-size: 21px; text-decoration: none; text-align: center;
}
.btn-red { background: var(--red); color: #fff; }
.btn-red:active { background: var(--red-dark); }
.btn-green { background: var(--green); color: #fff; }
.btn-wa { background: #25d366; color: #fff; }
.btn-ghost { background: #fff; border: 2px solid var(--ink); }
.btn-light { background: var(--green-bg); color: var(--green); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stack > * + * { margin-top: 12px; }

/* Cards */
.card { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: 0 2px 0 var(--line); }
.card + .card { margin-top: 12px; }
.repeat { border: 3px solid var(--green); }
.repeat .label { color: var(--green); font-weight: 700; font-size: 17px; text-transform: uppercase; letter-spacing: .04em; }
.repeat ul { list-style: none; padding: 0; margin: 10px 0 16px; }
.repeat li { padding: 4px 0; border-bottom: 1px dashed var(--line); display: flex; justify-content: space-between; gap: 10px; }
.repeat li b { white-space: nowrap; }

.history-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; text-decoration: none;
}
.history-item .when { font-weight: 600; font-size: 20px; }
.history-item .chev { font-size: 30px; color: var(--muted); }

/* Catalog */
.searchbar { position: sticky; top: calc(69px + env(safe-area-inset-top, 0px)); z-index: 10; background: var(--cream); padding: 8px 0 4px; margin: -8px 0 0; }
.search {
  width: 100%; min-height: 56px; border-radius: 14px; border: 2px solid var(--line); background: #fff;
  padding: 10px 16px 10px 48px; font-size: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%235d5a54' d='M15.5 14h-.8l-.3-.3A6.5 6.5 0 1 0 14 15.5l.3.3v.8l5 5 1.5-1.5zm-6 0a4.5 4.5 0 1 1 0-9 4.5 4.5 0 0 1 0 9z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 14px center; background-size: 26px;
}
.search:focus { outline: none; border-color: var(--green); }
.cats { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 6px; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cat {
  flex: none; min-height: 50px; padding: 8px 16px; border-radius: 999px; border: 2px solid var(--line);
  background: #fff; font-weight: 600; font-size: 18px; white-space: nowrap;
}
.cat[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

.banner { background: var(--green-bg); border-radius: var(--radius); padding: 16px; margin: 8px 0 4px; }
.banner p { margin: 0 0 12px; font-weight: 500; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 12px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.tile {
  position: relative; display: flex; flex-direction: column; text-align: left; padding: 0; overflow: hidden;
  background: #fff; border: 3px solid transparent; border-radius: var(--radius); box-shadow: 0 2px 0 var(--line);
}
.tile.in { border-color: var(--green); }
.pic {
  aspect-ratio: 4 / 3; width: 100%; display: grid; place-items: center; background: #f6f1e6; font-size: 64px; line-height: 1;
  position: relative;
}
.pic img { width: 100%; height: 100%; object-fit: cover; }
.peeled { position: absolute; left: 8px; bottom: 8px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 600; padding: 2px 8px; border-radius: 8px; }
.tile-body { padding: 10px 12px 12px; }
.tile-name { font-weight: 600; font-size: 19px; line-height: 1.2; }
.tile-price { color: var(--muted); font-size: 16px; margin-top: 2px; }
.tile-last { font-size: 15px; color: var(--green); font-weight: 500; margin-top: 4px; }
.qty-badge {
  position: absolute; top: 8px; right: 8px; background: var(--green); color: #fff; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; font-size: 18px;
}
.empty { text-align: center; padding: 40px 10px; color: var(--muted); }

/* Bottom cart bar */
.cartbar {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--safe-b)); z-index: 30; max-width: 696px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 70px; padding: 10px 20px; border-radius: 18px; background: var(--red); color: #fff; text-decoration: none;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); font-weight: 600; font-size: 20px;
}
.cartbar small { display: block; font-weight: 400; font-size: 16px; opacity: .9; }
.cartbar .go { font-size: 21px; white-space: nowrap; }

/* Sheet (quantity keypad) */
.sheet {
  border: 0; padding: 0; margin: auto 0 0; width: 100%; max-width: 100%; max-height: 96dvh;
  border-radius: 24px 24px 0 0; background: #fff;
}
@media (min-width: 720px) { .sheet { margin: auto; max-width: 520px; border-radius: 24px; } }
.sheet::backdrop { background: rgba(0,0,0,.45); }
.sheet-inner { padding: 16px 16px calc(16px + var(--safe-b)); }
.sheet-head { display: flex; gap: 14px; align-items: center; }
.sheet-head .pic { width: 72px; flex: none; border-radius: 14px; font-size: 48px; overflow: hidden; }
.sheet-head h3 { margin: 0; font-size: 24px; line-height: 1.15; }
.sheet-close { margin-left: auto; align-self: flex-start; width: 48px; height: 48px; border-radius: 50%; border: 0; background: #f1ece2; font-size: 26px; }
.display {
  display: flex; align-items: baseline; justify-content: center; gap: 10px; margin: 12px 0 10px;
  background: var(--cream); border-radius: 16px; padding: 6px 10px; font-weight: 700;
}
.display .num {
  width: 5.5ch; min-width: 0; border: 0; background: transparent; padding: 0; text-align: right;
  font: inherit; font-size: 46px; line-height: 1.1; font-weight: 700; color: var(--ink);
}
.display .num:focus { outline: none; }
.display:focus-within { box-shadow: 0 0 0 3px var(--green); }
.display { cursor: text; }
.display .unit { font-size: 26px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 10px; }
.chip { min-height: 46px; padding: 6px 14px; border-radius: 999px; border: 2px solid var(--line); background: #fff; font-weight: 600; font-size: 18px; }
.chip-last { border-color: var(--green); color: var(--green); background: var(--green-bg); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.key { min-height: 52px; border-radius: 14px; border: 0; background: #f1ece2; font-size: 28px; font-weight: 600; }
.key:active { background: #e3dac9; }
.note-in {
  width: 100%; min-height: 52px; margin: 10px 0; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--line); font-size: 18px;
}
.sheet-actions { display: grid; grid-template-columns: auto 1fr; gap: 10px; position: sticky; bottom: calc(-16px - var(--safe-b)); background: #fff; padding: 8px 0 calc(16px + var(--safe-b)); margin-bottom: calc(-16px - var(--safe-b)); }
.sheet-actions .btn-remove { width: auto; padding: 0 18px; background: #fff; border: 2px solid var(--red); color: var(--red); font-size: 18px; }

/* Cart */
.line { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "pic main del" "row row row"; gap: 10px 12px; align-items: start; cursor: pointer; width: 100%; background: #fff; border: 0; border-radius: var(--radius); padding: 10px; box-shadow: 0 2px 0 var(--line); text-align: left; }
.line + .line { margin-top: 10px; }
.line .pic { width: 64px; flex: none; border-radius: 12px; font-size: 38px; overflow: hidden; }
.line-main { flex: 1; min-width: 0; }
.line-name { font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.line-note { font-size: 16px; color: var(--muted); font-style: italic; overflow-wrap: anywhere; margin-top: 2px; }
.line-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 10px; margin-top: 4px; }
.line-qty { font-size: 20px; white-space: nowrap; }
.line-price { font-size: 16px; color: var(--muted); white-space: nowrap; }
.line:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.stepper { display: inline-flex; align-items: center; gap: 8px; }
.stp {
  width: 44px; height: 44px; flex: none; border-radius: 50%; border: 2px solid var(--green); background: #fff;
  color: var(--green); font-size: 26px; font-weight: 600; line-height: 1; display: grid; place-items: center; padding: 0;
}
.stp:active { background: var(--green-bg); }
.stp:disabled { border-color: var(--line); color: #b9b2a6; }
.line-row .line-qty { min-width: 3.5ch; text-align: center; }
.line-del {
  flex: none; align-self: center; width: 46px; height: 46px; border-radius: 12px; border: 2px solid #f1c9c9;
  background: #fff; display: grid; place-items: center; padding: 0;
}
.line-del svg { width: 24px; height: 24px; fill: var(--red); }
.line-del:active { background: #fdecec; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.step { min-height: 46px; border-radius: 12px; border: 2px solid var(--green); background: var(--green-bg); color: var(--green); font-weight: 700; font-size: 19px; padding: 0; }
.step-minus { border-color: #f1c9c9; background: #fff; color: var(--red); }
.step:active { filter: brightness(.95); }
.field { display: block; margin-top: 16px; }
.field > span { display: block; font-weight: 600; margin-bottom: 6px; }
.field input, .field textarea, .field select {
  display: block; min-width: 0; max-width: 100%; -webkit-appearance: none; appearance: none;
  width: 100%; min-height: 56px; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--line); background: #fff; font-size: 19px;
}
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seg button { min-height: 60px; border-radius: 14px; border: 2px solid var(--line); background: #fff; font-weight: 600; font-size: 17px; line-height: 1.15; padding: 4px; }
.seg button[aria-pressed="true"] { border-color: var(--green); background: var(--green-bg); color: var(--green); }
.total { display: flex; justify-content: space-between; align-items: baseline; margin: 20px 0 6px; font-size: 22px; font-weight: 700; }
.small { font-size: 16px; }

/* Done */
.done-icon { width: 92px; height: 92px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-size: 54px; margin: 16px auto 8px; }
.center { text-align: center; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 48px; font-weight: 600; text-decoration: none; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 14px; font-weight: 500; z-index: 40;
  transition: .25s; pointer-events: none; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.cartbar[hidden] { display: none; }

.field select {
  padding-right: 44px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23232323' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") right 12px center / 26px no-repeat;
}
.field input[type="date"] { text-align: left; line-height: 34px; }
.field input[type="date"]::-webkit-date-and-time-value { text-align: left; }
.seg button small { display: block; font-weight: 500; font-size: 15px; opacity: .85; }
.seg button { text-transform: capitalize; }
.total { flex-wrap: wrap; gap: 4px 12px; }
@media (max-width: 359px) {
  #view { padding: 12px; }
  .seg button { font-size: 16px; }
  .line .pic { width: 52px; }
  .total { font-size: 20px; }
}

.line > .pic { grid-area: pic; }
.line-main { grid-area: main; align-self: center; }
.line-del { grid-area: del; align-self: start; }
.line > .line-row { grid-area: row; margin-top: 0; padding-top: 10px; border-top: 1px dashed var(--line); }
.toast { width: max-content; }
.add-more { margin-top: 14px; }

/* Individual pricing note */
.price-note { margin: 20px 0 6px; padding: 14px 16px; border-radius: var(--radius); background: var(--green-bg); font-size: 17px; line-height: 1.4; }
.price-note b { display: block; font-size: 19px; margin-bottom: 2px; }

