:root {
  --ink: #321713;
  --muted: #896e65;
  --red: #c63f2c;
  --red-dark: #9e2f20;
  --gold: #eab14c;
  --cream: #fff8ea;
  --paper: #fffdf8;
  --line: #ebded1;
  --green: #3d8b64;
  --shadow: 0 20px 60px rgba(77, 35, 24, 0.12);
  --radius: 24px;
}

* { box-sizing: border-box; }

/* Allow scrolling and two-finger zoom, but not double-tap zoom while ordering. */
html { scroll-behavior: smooth; touch-action: manipulation; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 5%, rgba(234, 177, 76, 0.18), transparent 26%),
    linear-gradient(180deg, #fdf8ee 0%, #f7f2e9 100%);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  min-height: 100vh;
}

button, input { font: inherit; }
/* Also cover controls inside independently scrolling cart and calculator panels. */
button, input, a { touch-action: manipulation; }
button { color: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid rgba(198, 63, 44, 0.24); outline-offset: 2px; }

.topbar {
  padding: 14px 4vw;
  background: rgba(255, 253, 248, 0.93);
  border-bottom: 1px solid rgba(200, 177, 157, 0.42);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
}

.summary-row, .cart-head, .dialog-head, .dialog-actions, .manage-actions {
  display: flex;
  align-items: center;
}

.brand-wrap { display: grid; grid-template-columns: 60px minmax(0, 1fr) auto; align-items: center; column-gap: 14px; row-gap: 3px; max-width: 1426px; margin: 0 auto; }
.brand-wrap h1 { grid-column: 2 / -1; grid-row: 1; margin: 0 0 2px; font-size: 25px; font-weight: 850; letter-spacing: .02em; line-height: 1.25; }
.brand-wrap .brand-mark { grid-row: 1 / 4; align-self: start; margin-top: 2px; }
.store-address, .store-phone { display: flex; align-items: center; gap: 6px; margin: 0; min-width: 0; color: #6f5c54; font-size: 13px; line-height: 1.5; }
.store-address { grid-column: 2 / -1; grid-row: 2; }
.store-phone { grid-column: 2; grid-row: 3; }
.store-address svg, .store-phone svg { width: 16px; height: 18px; flex: 0 0 16px; color: var(--ink); }
.store-phone a { color: inherit; text-decoration: none; font-variant-numeric: tabular-nums; white-space: nowrap; }
.call-button { grid-column: 3; grid-row: 3; display: inline-flex; justify-content: center; align-items: center; min-height: 36px; padding: 0 14px; border: 1px solid var(--red); border-radius: 12px; color: var(--red); background: var(--paper); font-size: 13px; font-weight: 750; text-decoration: none; white-space: nowrap; }
.call-button:hover { background: #fff1e6; }
.eyebrow { margin: 0 0 3px; color: var(--red); font-size: 10px; font-weight: 800; letter-spacing: 0.18em; }

.brand-mark {
  width: 52px;
  height: 52px;
  position: relative;
  border-radius: 16px;
  background: var(--red);
  box-shadow: inset 0 -4px 0 rgba(77, 20, 11, 0.15);
}

.bun-line { position: absolute; left: 10px; right: 10px; bottom: 10px; height: 15px; border-radius: 18px 18px 8px 8px; background: #ffe2a7; }
.bun-line::before, .bun-line::after { content: ""; position: absolute; top: 2px; width: 2px; height: 9px; background: rgba(143, 77, 39, .38); transform: rotate(18deg); }
.bun-line::before { left: 10px; }
.bun-line::after { right: 10px; transform: rotate(-18deg); }
.steam { position: absolute; width: 8px; height: 13px; border-left: 2px solid #ffe2a7; border-radius: 50%; top: 7px; transform: rotate(15deg); }
.steam-a { left: 20px; }
.steam-b { left: 31px; top: 9px; height: 10px; }

.app-shell {
  max-width: 1550px;
  margin: 0 auto;
  padding: 22px 4vw 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 34px;
  align-items: start;
}

.catalog { min-width: 0; }
.catalog-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.catalog-toolbar .search-box { flex: 1; min-width: 0; }
.quick-calc-entry { display: inline-flex; align-items: center; justify-content: center; gap: 7px; flex-shrink: 0; min-height: 46px; padding: 0 14px; border: 1px solid var(--red); border-radius: 14px; background: #fff1e6; color: var(--red-dark); cursor: pointer; font-size: 17px; font-weight: 800; }
.quick-calc-entry svg { width: 21px; height: 24px; }
.quick-calc-entry:hover { background: #ffe7d5; }
.cart-head h2, .dialog-head h2, .success-card h2 { margin: 4px 0 0; font-size: clamp(26px, 3vw, 38px); letter-spacing: -.04em; }

.search-box { width: 100%; position: relative; display: flex; align-items: center; }
.search-box > svg { position: absolute; left: 15px; width: 21px; height: 21px; color: var(--muted); pointer-events: none; }
.search-box input { width: 100%; min-width: 0; height: 44px; border: 1px solid var(--line); background: var(--paper); border-radius: 14px; padding: 0 16px 0 45px; color: var(--ink); font-size: 16px; }
.search-box input::placeholder { color: #ac9990; }

.category-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; padding: 2px 2px 10px; }
.category-tabs::-webkit-scrollbar { display: none; }
.category-tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 0; min-height: 78px; border: 1px solid var(--line); background: rgba(255, 253, 248, .8); border-radius: 15px; padding: 8px 4px; cursor: pointer; font-size: 16px; font-weight: 800; white-space: nowrap; transition: .18s ease; }
.category-tab:hover { border-color: #d8b99d; }
.category-tab.active { background: var(--ink); color: #fff9ee; border-color: var(--ink); box-shadow: 0 8px 20px rgba(50, 23, 19, .16); }

.menu-image-hint { margin: 0 0 12px; color: #746055; font-size: 13px; line-height: 1.6; }
.food-picture { display: block; width: 100%; height: 100%; border-radius: 12px; background-color: #fffaf1; background-repeat: no-repeat; background-size: 400% 300%; background-position: var(--food-x) var(--food-y); }
.food-buns { background-image: url('./assets/menu-buns-v1.webp'); }
.food-breakfast { background-image: url('./assets/menu-breakfast-v1.webp'); background-size: 400% 320%; }
.category-picture { width: 38px; height: 38px; border-radius: 10px; }
.category-all-icon { width: 38px; height: 38px; padding: 7px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; color: currentColor; }
.category-all-icon i { border: 2px solid currentColor; border-radius: 3px; }
.product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.product-card {
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, .9);
  border-radius: 16px;
  padding: 12px;
  min-height: 124px;
  min-width: 0;
  column-gap: 12px;
  row-gap: 8px;
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  grid-template-rows: minmax(28px, auto) auto;
  align-content: center;
  box-shadow: 0 4px 16px rgba(64, 32, 22, .035);
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
  position: relative;
  overflow: hidden;
}
.product-card:hover { border-color: #d9bca0; transform: translateY(-2px); box-shadow: 0 12px 25px rgba(64, 32, 22, .07); }
.product-card.in-cart { border-color: rgba(198, 63, 44, .58); background: #fffaf1; }
.product-picture-button { grid-column: 1; grid-row: 1 / 3; width: 88px; height: 88px; align-self: center; border: 0; padding: 0; border-radius: 12px; background: #fffaf1; cursor: pointer; }
.product-picture-button:hover { box-shadow: 0 0 0 2px rgba(198, 63, 44, .32); }
.product-name { grid-column: 2; font-size: 18px; font-weight: 800; line-height: 1.5; overflow-wrap: anywhere; align-self: end; }
.product-meta { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.product-price { color: var(--red); font-weight: 850; font-size: 21px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.add-button, .quantity-control button { border: 0; background: var(--red); color: white; border-radius: 50%; width: 44px; height: 44px; cursor: pointer; font-size: 26px; line-height: 1; display: grid; place-items: center; box-shadow: 0 5px 12px rgba(198,63,44,.23); transition: .15s ease; }
.add-button:hover, .quantity-control button:hover { background: var(--red-dark); }
.quantity-control { display: flex; align-items: center; gap: 4px; margin-left: auto; flex-shrink: 0; }
.quantity-control button { width: 44px; height: 44px; font-size: 24px; }
.quantity-control button:first-child { background: #f2e8dd; color: var(--ink); box-shadow: none; }
.quantity-control input, .mini-stepper input {
  appearance: textfield;
  border: 1px solid #dfcfc0;
  background: white;
  color: var(--ink);
  border-radius: 8px;
  width: 34px;
  height: 32px;
  padding: 0 2px;
  text-align: center;
  font-size: 16px;
  font-weight: 800;
}
.quantity-control input::-webkit-inner-spin-button,
.quantity-control input::-webkit-outer-spin-button,
.mini-stepper input::-webkit-inner-spin-button,
.mini-stepper input::-webkit-outer-spin-button { appearance: none; margin: 0; }

.cart-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: calc(100vh - 175px);
  max-height: calc(100vh - 155px);
  position: sticky;
  top: 140px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cart-head { justify-content: space-between; padding: 23px 24px 17px; border-bottom: 1px solid var(--line); }
.cart-head h2 { font-size: 25px; }
.text-button { border: 0; background: transparent; cursor: pointer; font-weight: 700; color: var(--red); padding: 7px; }
.danger-text { color: #b86f60; }
.cart-items { overflow-y: auto; padding: 7px 20px; flex: 1; }
.cart-item { padding: 14px 2px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; border-bottom: 1px dashed #eadbcd; }
.cart-item-main strong { display: block; font-size: 17px; margin-bottom: 4px; }
.cart-item-main span { color: var(--muted); font-size: 12px; }
.cart-item-side { text-align: right; }
.cart-item-side > strong { display: block; font-size: 15px; margin-bottom: 8px; }
.mini-stepper { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.mini-stepper button { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: white; cursor: pointer; display: grid; place-items: center; padding: 0; font-size: 22px; font-weight: 800; }
.mini-stepper button:last-child { border-color: var(--red); color: var(--red); }
.mini-stepper input { width: 44px; height: 44px; }
.quantity-control input { width: 40px; height: 44px; font-size: 18px; }
.cart-empty { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; color: var(--muted); gap: 7px; min-height: 230px; }
.cart-empty strong { color: var(--ink); }
.cart-empty span { font-size: 13px; }
.basket-icon { color: var(--gold); font-size: 53px; line-height: 1; transform: rotate(180deg); }
.cart-footer { border-top: 1px solid var(--line); padding: 17px 22px 22px; background: #fffaf1; }
.order-note { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; margin-bottom: 16px; font-size: 13px; color: var(--muted); }
.order-note input { min-width: 0; border: 0; border-bottom: 1px solid #dfcfbf; background: transparent; padding: 7px 4px; outline: 0; color: var(--ink); }
.cart-memory-hint { margin: -5px 0 13px; color: #746055; font-size: 12px; line-height: 1.5; }
.summary-row { justify-content: space-between; color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.grand-total { display: flex; align-items: baseline; gap: 8px; }
.grand-total strong { color: var(--red); font-size: 28px; letter-spacing: -.04em; }
.checkout-button { width: 100%; border: 0; border-radius: 15px; min-height: 53px; background: var(--red); color: white; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 12px; font-weight: 800; font-size: 16px; box-shadow: 0 9px 22px rgba(198,63,44,.22); transition: .17s ease; }
.checkout-button:hover:not(:disabled) { background: var(--red-dark); transform: translateY(-1px); }
.checkout-button:disabled { opacity: .38; cursor: not-allowed; box-shadow: none; }
.compact { width: auto; min-width: 140px; padding: 0 24px; }

.hidden { display: none !important; }
.no-results { padding: 70px 20px; text-align: center; color: var(--muted); }
.empty-icon { font-size: 58px; color: var(--gold); }
.mobile-cart-bar, .mobile-backdrop { display: none; }

.app-dialog { border: 0; padding: 0; border-radius: 26px; width: min(550px, calc(100% - 28px)); background: transparent; color: var(--ink); box-shadow: var(--shadow); }
.app-dialog::backdrop { background: rgba(45, 27, 22, .48); backdrop-filter: blur(5px); }
.wide-dialog { width: min(760px, calc(100% - 28px)); }
.dialog-card { background: var(--paper); border-radius: 26px; padding: 27px; max-height: min(86vh, 900px); overflow-y: auto; }
.dialog-head { justify-content: space-between; margin-bottom: 22px; }
.dialog-head h2 { font-size: 27px; }
.close-button { border: 0; background: #f5ece3; color: var(--muted); width: 38px; height: 38px; border-radius: 50%; font-size: 25px; cursor: pointer; display: grid; place-items: center; }
.amount-hero { background: var(--ink); color: #fff8e9; border-radius: 20px; min-height: 130px; display: flex; flex-direction: column; align-items: center; justify-content: center; margin-bottom: 23px; background-image: radial-gradient(circle at 90% 0, rgba(234,177,76,.34), transparent 38%); }
.amount-hero span { font-size: 13px; color: #d8c5b8; margin-bottom: 3px; }
.amount-hero strong { font-size: 42px; letter-spacing: -.04em; }
.payment-fieldset { border: 0; margin: 0 0 21px; padding: 0; }
.payment-fieldset legend { font-weight: 800; margin-bottom: 12px; }
.payment-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.payment-options button { display: flex; flex-direction: column; gap: 7px; align-items: center; border: 1px solid var(--line); background: white; border-radius: 15px; padding: 13px 6px; cursor: pointer; font-size: 13px; font-weight: 700; transition: .17s ease; }
.payment-options b { width: 28px; height: 28px; background: #f3e9df; border-radius: 9px; display: grid; place-items: center; color: var(--red); }
.payment-options strong { font-size: 15px; }
.payment-options small { color: var(--muted); font-size: 11px; font-weight: 500; }
.payment-options button:hover { border-color: var(--red); background: #fff5ea; transform: translateY(-1px); }
.confirm-button { margin-top: 8px; }

.qr-payment-card { text-align: center; }
.qr-payment-card .dialog-head { text-align: left; }
.qr-payment-brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin: -5px 0 14px; }
.qr-payment-brand > b { width: 39px; height: 39px; border-radius: 12px; display: grid; place-items: center; background: #28a867; color: white; font-size: 18px; }
.qr-payment-brand.alipay > b { background: #1677ff; }
.qr-payment-brand div { text-align: left; }
.qr-payment-brand span { display: block; color: var(--muted); font-size: 12px; }
.qr-payment-brand strong { display: block; color: var(--red); font-size: 26px; line-height: 1.1; }
.qr-code-shell { width: min(340px, 82vw); min-height: 290px; margin: 0 auto; padding: 14px; background: white; border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 10px 28px rgba(50,23,19,.1); display: grid; place-items: center; }
.qr-code-shell.has-image { min-height: 0; padding: 0; overflow: hidden; }
.qr-code-shell img { display: block; width: 100%; height: auto; max-height: 58vh; object-fit: contain; border-radius: 16px; -webkit-touch-callout: default; -webkit-user-select: auto; user-select: auto; pointer-events: auto; }
.qr-original-link { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; margin-top: 10px; padding: 0 18px; border: 1px solid var(--line); border-radius: 12px; color: var(--red); background: white; font-size: 14px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.qr-original-link:focus-visible { outline: 3px solid rgba(198, 63, 44, .24); outline-offset: 2px; }
.qr-original-link + .qr-hint { margin-top: 6px; }
.qr-missing { display: flex; flex-direction: column; align-items: center; gap: 7px; color: var(--muted); }
.qr-missing strong { color: var(--ink); }
.qr-missing span { font-size: 12px; }
.qr-placeholder { width: 80px; height: 80px; border-radius: 16px; display: grid; place-items: center; background: #f6eee4; color: #b69d8a; font-size: 48px; line-height: 1; margin-bottom: 4px; }
.upload-button { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 15px; margin-top: 6px; border-radius: 11px; background: var(--ink); color: white; font-size: 12px; font-weight: 800; cursor: pointer; }
.upload-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.qr-hint { margin: 15px auto 0; max-width: 360px; color: var(--muted); font-size: 12px; line-height: 1.6; }

.success-card { text-align: center; }
.success-check { width: 66px; height: 66px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; color: white; background: var(--green); font-size: 32px; box-shadow: 0 10px 26px rgba(61,139,100,.25); }
.success-card h2 { font-size: 29px; }
.success-amount { display: block; color: var(--red); font-size: 35px; margin: 7px 0 20px; }
.receipt-preview { background: #faf4ea; border-radius: 15px; padding: 15px; text-align: left; font-size: 13px; }
.receipt-line { display: flex; justify-content: space-between; gap: 15px; padding: 4px 0; }
.receipt-line.muted { color: var(--muted); font-size: 12px; }
.receipt-line.total { border-top: 1px dashed #d9c9bb; padding-top: 10px; margin-top: 6px; font-weight: 800; }
.dialog-actions { gap: 10px; margin-top: 20px; }
.secondary-button { min-height: 49px; border: 1px solid var(--line); background: white; border-radius: 14px; padding: 0 19px; font-weight: 800; cursor: pointer; white-space: nowrap; }

.quick-calc-dialog { width: min(580px, calc(100% - 24px)); max-height: calc(100dvh - 24px); }
.quick-calc-card { display: flex; flex-direction: column; max-height: min(880px, calc(100dvh - 24px)); background: var(--paper); }
.quick-calc-header { padding: 22px 24px 14px; flex-shrink: 0; }
.quick-calc-header .dialog-head { margin-bottom: 10px; }
.quick-calc-header .close-button { width: 44px; height: 44px; flex-shrink: 0; }
.quick-calc-header p:not(.eyebrow) { margin: 0; color: #746055; font-size: 15px; line-height: 1.6; }
.quick-price-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 24px 10px; }
.quick-price-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.quick-price-row:last-child { border-bottom: 0; }
.quick-price-info label { display: block; font-size: 15px; cursor: text; }
.quick-price-info label strong { font-size: 30px; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.quick-price-info > span { display: block; margin-top: 3px; color: #746055; font-size: 15px; line-height: 1.5; }
.quick-price-controls .mini-stepper { gap: 5px; }
.quick-price-controls input { width: 54px; font-size: 20px; }
.quick-price-controls button:disabled { opacity: .35; cursor: default; }
.quick-line-subtotal { display: block; margin-top: 6px; text-align: right; color: #746055; font-size: 14px; font-variant-numeric: tabular-nums; }
.has-quantity .quick-price-info strong, .has-quantity .quick-line-subtotal { color: var(--red); }
.quick-calc-footer { flex-shrink: 0; padding: 16px 24px 22px; border-top: 1px solid var(--line); background: #fff8ec; }
.quick-total-row { display: flex; align-items: baseline; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; font-size: 17px; }
.quick-total-row > strong { font-size: 34px; color: var(--red); font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.quick-existing-summary { margin: 0 0 8px; color: #8d432c; font-size: 14px; line-height: 1.5; }
.quick-receipt-hint { margin: 5px 0 0; color: #746055; font-size: 13px; line-height: 1.5; }
.quick-calc-footer .dialog-actions { margin-top: 14px; }
.quick-calc-footer .checkout-button { min-width: 0; font-size: 18px; }
.quick-calc-footer .secondary-button { font-size: 16px; padding: 0 14px; }

.daily-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.daily-stats > div { background: #faf4ea; border-radius: 16px; padding: 16px; }
.daily-stats span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.daily-stats strong { font-size: 23px; }
.history-list { display: grid; gap: 10px; }
.history-card { border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.history-top { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.history-top strong:last-child { color: var(--red); }
.history-meta, .history-products { color: var(--muted); font-size: 12px; line-height: 1.6; }
.empty-history { color: var(--muted); text-align: center; padding: 46px 10px; }

.setting-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.setting-title h3 { margin: 0; font-size: 16px; }
.setting-title span { color: var(--muted); font-size: 11px; }
.product-setting-title { margin-top: 22px; }
.qr-setting-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.qr-setting-card { border: 1px solid var(--line); border-radius: 16px; padding: 12px; display: grid; grid-template-columns: 58px minmax(0, 1fr); align-items: center; gap: 12px; }
.qr-setting-preview { width: 58px; height: 58px; border-radius: 11px; border: 1px solid #eadbcd; background: #faf4eb; display: grid; place-items: center; overflow: hidden; color: #b69d8a; font-size: 29px; }
.qr-setting-preview img { width: 100%; height: 100%; object-fit: contain; background: white; }
.qr-setting-info strong { display: block; font-size: 14px; margin-bottom: 4px; }
.qr-setting-info small { display: block; color: var(--muted); font-size: 11px; margin-bottom: 7px; }
.qr-setting-info .upload-button { margin: 0; min-height: 31px; padding: 0 11px; background: #f2e7dc; color: var(--ink); }
.manage-list { display: grid; gap: 7px; max-height: 50vh; overflow-y: auto; padding-right: 4px; }
.manage-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px 62px; align-items: center; gap: 10px; border-bottom: 1px solid #eee2d6; padding: 9px 3px; }
.manage-row small { display: block; color: var(--muted); margin-top: 3px; }
.price-editor { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; padding-left: 8px; background: white; }
.price-editor input { width: 100%; min-width: 0; border: 0; padding: 8px 6px; outline: 0; }
.stock-toggle { position: relative; display: block; width: 50px; height: 28px; }
.stock-toggle input { opacity: 0; width: 0; height: 0; }
.stock-toggle span { position: absolute; inset: 0; background: #d9cfc6; border-radius: 99px; cursor: pointer; transition: .2s; }
.stock-toggle span::before { content: ""; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px; border-radius: 50%; background: white; transition: .2s; box-shadow: 0 2px 5px rgba(0,0,0,.15); }
.stock-toggle input:checked + span { background: var(--green); }
.stock-toggle input:checked + span::before { transform: translateX(22px); }
.manage-actions { justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); margin-top: 17px; padding-top: 17px; }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 25px); padding: 11px 18px; border-radius: 99px; background: var(--ink); color: white; font-size: 13px; opacity: 0; pointer-events: none; z-index: 100; transition: .22s ease; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.print-receipt { display: none; }
.printer-entry { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 10px; margin: 24px 0 10px; font-size: 12px; color: var(--muted); }
.printer-description, .printer-help p { font-size: 13px; line-height: 1.7; color: var(--muted); }
.printer-status { padding: 12px; border-radius: 12px; background: #f7eddf; line-height: 1.6; font-size: 14px; overflow-wrap: anywhere; }
.printer-auth { display: grid; gap: 10px; text-align: left; }
.printer-auth input { min-width: 0; width: 100%; font-size: 16px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: white; }
.printer-auth small { color: var(--muted); line-height: 1.6; }
.printer-controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.printer-controls .secondary-button { padding: 0 12px; font-size: 13px; }
.printer-help { margin: 18px 0; font-size: 14px; }
.printer-help summary { cursor: pointer; }
.cloud-print-result { margin: 14px 0 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fffaf1; text-align: left; overflow-wrap: anywhere; }
.cloud-print-result p { font-size: 13px; line-height: 1.6; margin: 4px 0 10px; color: var(--muted); }
.cloud-print-result strong { font-size: 14px; }
.cloud-print-result[data-state="printed"] { background: #eff8ee; border-color: #b8d7b2; }
.cloud-print-result[data-state="unknown"], .cloud-print-result[data-state="rejected"] { border-color: #db9875; }
.cloud-print-actions { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.printer-job-list { display: grid; gap: 10px; }
.printer-job-list .cloud-print-result { margin: 0; }
.printer-card h3 { margin-bottom: 6px; }

@media (max-width: 1120px) {
  .product-grid { grid-template-columns: minmax(0, 1fr); }
  .app-shell { grid-template-columns: minmax(0, 1fr) 350px; gap: 24px; }
}

@media (max-width: 820px) {
  body { padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px)); }
  .topbar { position: static; padding: 10px 16px; }
  .brand-wrap { grid-template-columns: 52px minmax(0, 1fr) auto; column-gap: 10px; }
  .brand-wrap h1 { font-size: 23px; }
  .store-address, .store-phone { font-size: 12px; }
  .call-button { padding: 0 10px; font-size: 12px; }
  .app-shell { display: block; padding: 12px 16px 16px; }
  .catalog-toolbar { margin-bottom: 10px; }
  .category-tabs { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; padding: 0 0 10px; }
  .category-tab { padding: 8px 4px; font-size: 16px; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .product-card { padding: 12px; min-height: 124px; border-radius: 14px; }
  .product-meta { gap: 6px; }
  .quantity-control { gap: 4px; }
  .cart-panel { position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; top: auto; max-height: 88vh; min-height: 56vh; border-radius: 26px 26px 0 0; transform: translateY(110%); transition: transform .28s ease; }
  .cart-panel.open { transform: translateY(0); }
  .cart-footer { padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px)); }
  .mobile-backdrop { position: fixed; display: block; z-index: 40; inset: 0; background: rgba(43,27,23,.43); opacity: 0; pointer-events: none; transition: opacity .25s; }
  .mobile-backdrop.open { opacity: 1; pointer-events: auto; }
  .mobile-cart-bar { position: fixed; z-index: 30; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; left: 16px; right: 16px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: white; border-radius: 18px; min-height: 76px; padding: 10px 12px 10px 18px; box-shadow: 0 12px 30px rgba(50,23,19,.22); }
  .mobile-cart-summary { display: flex; align-items: center; gap: 18px; min-width: 0; min-height: 52px; padding: 0; border: 0; background: transparent; text-align: left; cursor: pointer; }
  .mobile-cart-summary:disabled { cursor: default; }
  .mobile-bag { position: relative; width: 32px; height: 36px; flex: 0 0 32px; }
  .mobile-bag svg { display: block; width: 100%; height: 100%; }
  .mobile-cart-count { position: absolute; top: -6px; right: -10px; background: var(--red); min-width: 23px; height: 23px; padding: 0 4px; border-radius: 99px; display: grid; place-items: center; font-size: 11px; font-weight: 800; }
  .mobile-cart-info { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
  .mobile-cart-info > span { color: #dccac0; font-size: 12px; }
  .mobile-cart-info strong { color: #ffd88d; font-size: clamp(18px, 6vw, 25px); line-height: 1.2; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
  .mobile-checkout-button { border: 0; border-radius: 13px; background: var(--red); color: white; min-height: 48px; min-width: 108px; padding: 0 20px; font-size: 17px; font-weight: 800; cursor: pointer; }
  .mobile-checkout-button:disabled { opacity: .5; cursor: not-allowed; }
  .toast { bottom: calc(102px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 640px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .product-card { grid-template-columns: 56px minmax(0, 1fr); grid-template-rows: 1fr auto 44px; align-content: stretch; gap: 4px 7px; padding: 9px; min-height: 128px; }
  .product-card:hover { transform: none; }
  .product-picture-button { grid-column: 1; grid-row: 1 / 3; width: 56px; height: 56px; }
  .product-name { grid-column: 2; grid-row: 1; font-size: 18px; line-height: 1.35; }
  .product-meta { display: contents; }
  .product-price { grid-column: 2; grid-row: 2; align-self: start; font-size: 20px; }
  .product-card .add-button, .product-card .quantity-control { grid-column: 1 / -1; grid-row: 3; justify-self: end; align-self: end; }
  .product-card .quantity-control { margin-left: 0; }
}

@media (max-width: 480px) {
  .category-tab { font-size: 16px; }
  .dialog-card { padding: 22px 18px; }
  .daily-stats { grid-template-columns: 1fr; }
  .daily-stats > div { display: flex; justify-content: space-between; align-items: center; padding: 12px 15px; }
  .daily-stats span { margin: 0; }
  .daily-stats strong { font-size: 19px; }
  .manage-row { grid-template-columns: minmax(0, 1fr) 92px 52px; }
  .qr-setting-grid { grid-template-columns: 1fr; }
  .qr-code-shell { width: min(270px, 78vw); }
}

@media (max-width: 380px) {
  .quick-calc-entry { gap: 5px; padding: 0 10px; font-size: 16px; }
  .quick-calc-entry svg { display: none; }
  .quick-calc-header { padding: 18px 14px 12px; }
  .quick-price-list { padding-left: 14px; padding-right: 14px; }
  .quick-price-row { gap: 7px; }
  .quick-price-info label strong { font-size: 27px; }
  .quick-price-controls .mini-stepper { gap: 4px; }
  .quick-price-controls input { width: 48px; }
  .quick-calc-footer { padding: 12px 14px 18px; }
  .quick-calc-footer .dialog-actions { gap: 8px; }
  .quick-calc-footer .secondary-button { padding: 0 10px; }
  .topbar { padding: 10px 14px; }
  .brand-wrap { grid-template-columns: 44px minmax(0, 1fr) auto; column-gap: 8px; }
  .brand-mark { width: 44px; height: 44px; border-radius: 13px; }
  .brand-wrap h1 { font-size: 21px; }
  .store-address, .store-phone { font-size: 11px; }
  .call-button { padding: 0 8px; min-height: 34px; font-size: 11px; }
  .app-shell { padding-left: 14px; padding-right: 14px; }
  .product-card { grid-template-columns: 48px minmax(0, 1fr); column-gap: 6px; }
  .product-picture-button { width: 48px; height: 48px; }
  .mobile-cart-bar { left: 14px; right: 14px; padding-left: 14px; gap: 8px; }
  .mobile-checkout-button { min-width: 90px; padding: 0 14px; }
}

@media (max-width: 360px) {
  .app-shell { padding-left: 10px; padding-right: 10px; }
  .product-grid { gap: 6px; }
  .product-card { grid-template-columns: 44px minmax(0, 1fr); column-gap: 5px; padding: 6px; }
  .product-picture-button { width: 44px; height: 44px; }
  .quantity-control input { width: 36px; font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .product-card, .category-tab, .add-button, .quantity-control button { transition: none; }
}

@media print {
  body { padding: 0; background: white; }
  body > *:not(.print-receipt) { display: none !important; }
  .print-receipt { display: block !important; width: 72mm; margin: 0 auto; padding: 4mm; font-family: sans-serif; color: #000; font-size: 11pt; }
  .print-receipt h1 { text-align: center; font-size: 16pt; margin: 0 0 2mm; }
  .print-receipt p { text-align: center; margin: 1mm 0; }
  .print-receipt table { border-collapse: collapse; width: 100%; margin: 4mm 0; }
  .print-receipt td { padding: 1.5mm 0; border-bottom: 1px dashed #aaa; }
  .print-receipt td:last-child { text-align: right; }
  .print-receipt .print-total { text-align: right; font-weight: bold; font-size: 14pt; }
}
