:root {
  --bg: #FBF6EF;
  --surface: #FFFFFF;
  --surface-2: #F5EEE4;
  --ink: #221C16;
  --muted: #74685C;
  --line: #EADFD1;
  --brand: #B4441F;
  --brand-dark: #93361A;
  --brand-soft: #FBE7DC;
  --herb: #2F6B43;
  --herb-soft: #E3F1E7;
  --warn-bg: #FFF3D6;
  --warn-ink: #7A4E00;
  --danger: #B42318;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(60, 35, 15, .06), 0 6px 20px rgba(60, 35, 15, .07);
  --shadow-lg: 0 20px 60px rgba(40, 22, 8, .22);
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Lora', Georgia, serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 130px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 var(--font); -webkit-font-smoothing: antialiased;
}
body.locked { overflow: hidden; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* --- горна лента --- */
.top { background: var(--bg); }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; padding-bottom: 6px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; background: var(--brand); color: #fff;
  display: grid; place-items: center; font: 700 22px/1 var(--serif);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text b { font: 700 22px/1.05 var(--serif); }
.brand-text small { font-size: 12px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.top-address { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); text-align: right; }
.top-address svg { width: 18px; height: 18px; color: var(--brand); }

/* --- начало --- */
.hero { padding: 10px 0 14px; }
.hero h1 { font: 700 clamp(26px, 6vw, 40px)/1.1 var(--serif); margin: 6px 0 14px; letter-spacing: -.01em; }
.mode { display: inline-flex; background: var(--surface-2); padding: 4px; border-radius: 999px; gap: 4px; max-width: 100%; }
.mode button {
  display: flex; align-items: center; gap: 8px; border: 0; background: transparent;
  padding: 10px 16px; border-radius: 999px; font-weight: 700; font-size: 15px; color: var(--muted); white-space: nowrap;
}
.mode button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.mode button[aria-checked="true"] svg { color: var(--brand); }
.perks { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 14px; color: var(--muted); }
.perks li { display: flex; align-items: center; gap: 7px; }
.perks b { color: var(--ink); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.dot.ok { background: var(--herb); }
.mode-note { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.banner { display: block; margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; text-decoration: none; }
.banner.warn { background: var(--warn-bg); color: var(--warn-ink); }
.banner.info { background: var(--herb-soft); color: var(--herb); }
.banner.info span { font-weight: 500; }

/* --- категории --- */
.cats { position: sticky; top: 0; z-index: 20; background: rgba(251, 246, 239, .94); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.cats-inner { display: flex; align-items: center; gap: 10px; padding-top: 10px; padding-bottom: 10px; }
.search { display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 12px; height: 40px; flex: 0 0 220px; }
.search svg { color: var(--muted); width: 18px; height: 18px; }
.search input { border: 0; outline: 0; background: transparent; width: 100%; font-size: 15px; min-width: 0; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; flex: 1; scroll-behavior: smooth; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* --- меню --- */
.layout { display: grid; grid-template-columns: 1fr; gap: 24px; padding-top: 8px; padding-bottom: 120px; }
.cat-section { padding-top: 18px; }
.cat-section h2 { font: 700 24px/1.2 var(--serif); margin: 0 0 12px; }
.cat-section h2 small { font: 500 14px var(--font); color: var(--muted); margin-left: 6px; }
.dishes { display: grid; grid-template-columns: 1fr; gap: 12px; }
.dish {
  position: relative; display: flex; gap: 14px; align-items: stretch; background: var(--surface); border-radius: var(--radius);
  padding: 12px; box-shadow: var(--shadow); border: 1px solid transparent; text-align: left; width: 100%; cursor: pointer;
  transition: transform .12s ease, border-color .12s ease;
}
.dish:active { transform: scale(.99); }
.dish.in-cart { border-color: var(--brand); }
.dish-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 2px 0; }
.dish-name { font-weight: 700; font-size: 16px; line-height: 1.3; }
.dish-desc { font-size: 13.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dish-meta { margin-top: auto; display: flex; align-items: baseline; gap: 8px; padding-top: 6px; }
.dish-price { font-weight: 800; font-size: 16px; }
.dish-weight { font-size: 13px; color: var(--muted); }
.dish-photo { position: relative; flex: none; width: 116px; height: 116px; border-radius: 14px; overflow: hidden; background: var(--surface-2); }
.dish-photo img { width: 100%; height: 100%; object-fit: cover; }
.dish-photo.none { display: grid; place-items: center; color: var(--muted); font: 700 32px var(--serif); }
.dish-add {
  position: absolute; right: 6px; bottom: 6px; width: 36px; height: 36px; border-radius: 50%; border: 0;
  background: var(--surface); color: var(--brand); display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
}
.dish-add svg { width: 20px; height: 20px; stroke-width: 2.4; }
.dish-qty {
  position: absolute; right: 6px; bottom: 6px; left: 6px; height: 36px; border-radius: 999px; background: var(--surface);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18); display: flex; align-items: center; justify-content: space-between; padding: 0 2px;
}
.dish-qty button { width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--brand); display: grid; place-items: center; }
.dish-qty button svg { width: 18px; height: 18px; stroke-width: 2.4; }
.dish-qty span { font-weight: 800; font-size: 15px; }
.dish.soldout { cursor: default; }
.dish.soldout .dish-photo img { filter: grayscale(1); opacity: .55; }
.soldout-tag { position: absolute; left: 6px; bottom: 6px; background: rgba(34, 28, 22, .82); color: #fff; font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 999px; }
.empty { padding: 40px 0; text-align: center; color: var(--muted); }
.skeleton { display: grid; gap: 12px; padding-top: 20px; }
.skeleton div { height: 140px; border-radius: var(--radius); background: linear-gradient(90deg, #f1e8dc, #f8f2ea, #f1e8dc); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* --- количка (десктоп) --- */
.cart-side { display: none; }
.cart-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.cart-card h3 { margin: 0 0 12px; font: 700 20px var(--serif); }
.cart-empty { text-align: center; color: var(--muted); padding: 20px 6px; font-size: 14px; }
.cart-empty svg { width: 40px; height: 40px; margin: 0 auto 8px; display: block; color: #d8c8b5; }

.lines { list-style: none; padding: 0; margin: 0; }
.line { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.line img { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; flex: none; background: var(--surface-2); }
.line-info { flex: 1; min-width: 0; }
.line-name { font-weight: 600; font-size: 14.5px; line-height: 1.3; }
.line-price { font-size: 13.5px; color: var(--muted); }
.stepper { display: flex; align-items: center; gap: 2px; background: var(--surface-2); border-radius: 999px; flex: none; }
.stepper button { width: 32px; height: 32px; border: 0; background: transparent; border-radius: 50%; display: grid; place-items: center; color: var(--ink); }
.stepper button svg { width: 16px; height: 16px; stroke-width: 2.4; }
.stepper span { min-width: 18px; text-align: center; font-weight: 800; font-size: 14px; }
.stepper .rm { color: var(--danger); }

.progress { margin: 12px 0 4px; font-size: 13.5px; }
.progress-bar { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.progress-bar i { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width .25s ease; }
.progress.reached { color: var(--herb); font-weight: 600; }
.progress.reached .progress-bar i { background: var(--herb); }

.totals { margin: 12px 0 0; display: grid; gap: 6px; font-size: 14.5px; }
.totals div { display: flex; justify-content: space-between; gap: 12px; }
.totals div span:last-child { white-space: nowrap; }
.totals .free { color: var(--herb); font-weight: 700; }
.totals .grand { font-size: 19px; font-weight: 800; padding-top: 8px; border-top: 1px solid var(--line); margin-top: 4px; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; border: 0; border-radius: 14px;
  padding: 15px 18px; font-weight: 800; font-size: 16px; background: var(--brand); color: #fff; text-decoration: none;
}
.btn:hover { background: var(--brand-dark); }
.btn:disabled { background: #d9cbbd; color: #fff; cursor: not-allowed; }
.btn.ghost { background: var(--surface-2); color: var(--ink); }
.btn.ghost:hover { background: #ede3d6; }
.btn .spin { width: 18px; height: 18px; border: 2.5px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- лента за количката (телефон) --- */
.cart-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--safe-b)); z-index: 30;
  display: flex; align-items: center; gap: 12px; border: 0; border-radius: 16px; padding: 14px 16px;
  background: var(--brand); color: #fff; font-weight: 800; font-size: 16px; box-shadow: 0 10px 30px rgba(147, 54, 26, .38);
  animation: rise .25s ease;
}
.cart-bar-count { background: rgba(255, 255, 255, .22); min-width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 14px; padding: 0 6px; }
.cart-bar-label { flex: 1; text-align: left; }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } }

/* --- панел --- */
.sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(28, 18, 10, .5); animation: fade .2s ease; }
.sheet-panel {
  position: relative; width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh; background: var(--bg);
  border-radius: 24px 24px 0 0; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; outline: none;
  animation: up .28s cubic-bezier(.2, .8, .2, 1);
}
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 20px 18px calc(20px + var(--safe-b)); overscroll-behavior: contain; }
.sheet-x { position: absolute; top: 12px; right: 12px; z-index: 2; width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .92); display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
@keyframes fade { from { opacity: 0; } }

.sheet h2 { font: 700 24px/1.2 var(--serif); margin: 0 0 4px; padding-right: 40px; }
.sheet h3 { font-size: 15px; margin: 22px 0 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

/* детайли на ястие */
.dish-hero { position: relative; margin: -20px -18px 16px; height: 260px; overflow: hidden; border-radius: 24px 24px 0 0; background: var(--surface-2); }
.dish-hero .bg { position: absolute; inset: -20px; background-size: cover; background-position: center; filter: blur(22px) saturate(1.2); opacity: .85; }
.dish-hero img { position: relative; height: 220px; width: 220px; object-fit: cover; margin: 20px auto 0; border-radius: 20px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.dish-detail-meta { display: flex; gap: 10px; align-items: baseline; margin: 6px 0 10px; }
.dish-detail-meta b { font-size: 20px; }
.dish-detail-desc { color: var(--muted); margin: 0 0 16px; }
.add-row { display: flex; gap: 10px; align-items: center; margin-top: 18px; }
.add-row .stepper { height: 52px; padding: 0 6px; }
.add-row .stepper button { width: 40px; height: 40px; }
.add-row .stepper span { min-width: 26px; font-size: 17px; }
.add-row .btn { flex: 1; }

/* поръчка */
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label { font-weight: 700; font-size: 14px; }
.field label small { font-weight: 500; color: var(--muted); }
.field input, .field textarea {
  width: 100%; border: 1.5px solid var(--line); background: var(--surface); border-radius: 12px; padding: 13px 14px; font-size: 16px; outline: none;
}
.field textarea { min-height: 76px; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field.err input, .field.err textarea { border-color: var(--danger); }
.field .msg { color: var(--danger); font-size: 13px; font-weight: 600; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); margin: 2px 0 6px; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.mode.full { display: flex; width: 100%; }
.mode.full button { flex: 1; justify-content: center; padding: 11px 8px; font-size: 14.5px; }
.pickup-box { background: var(--surface); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14.5px; margin-top: 12px; border: 1px solid var(--line); }
.form-error { background: #FDECEA; color: var(--danger); border-radius: 12px; padding: 12px 14px; font-weight: 600; font-size: 14px; margin: 14px 0 0; }
.submit-wrap { position: sticky; bottom: calc(-20px - var(--safe-b)); margin: 18px -18px calc(-20px - var(--safe-b)); padding: 12px 18px calc(14px + var(--safe-b)); background: linear-gradient(rgba(251, 246, 239, 0), var(--bg) 22%); }
.pay-note { text-align: center; font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* потвърждение */
.done { text-align: center; padding: 10px 0 4px; }
.done-icon { width: 72px; height: 72px; border-radius: 50%; background: var(--herb-soft); color: var(--herb); display: grid; place-items: center; margin: 6px auto 14px; }
.done-icon svg { width: 36px; height: 36px; stroke-width: 2.6; }
.done h2 { padding: 0; }
.order-no { display: inline-block; margin: 10px 0 6px; background: var(--surface); border: 1.5px dashed var(--brand); color: var(--brand); padding: 10px 18px; border-radius: 12px; font-size: 24px; font-weight: 800; letter-spacing: .04em; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: 14px; background: var(--brand-soft); color: var(--brand-dark); }
.status-pill.completed { background: var(--herb-soft); color: var(--herb); }
.status-pill.cancelled { background: #FDECEA; color: var(--danger); }
.done-summary { text-align: left; background: var(--surface); border-radius: var(--radius); padding: 6px 16px 14px; margin: 18px 0; box-shadow: var(--shadow); }

.toast {
  position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 14px;
  box-shadow: var(--shadow-lg); max-width: calc(100% - 32px); animation: rise .2s ease;
}

.foot { padding: 24px 16px 140px; font-size: 14px; border-top: 1px solid var(--line); }
.foot p { margin: 4px 0; }

/* --- по-големи екрани --- */
@media (min-width: 700px) {
  .dishes { grid-template-columns: 1fr 1fr; }
  .sheet { align-items: center; padding: 24px; }
  .sheet-panel { border-radius: 24px; max-height: 88vh; }
  .submit-wrap { bottom: -20px; margin-bottom: -20px; }
}
@media (min-width: 1024px) {
  .layout { grid-template-columns: 1fr 340px; align-items: start; }
  .cart-side { display: block; position: sticky; top: 76px; padding-top: 26px; }
  .cart-side .lines { max-height: 42vh; overflow-y: auto; }
  .cart-bar { display: none !important; }
  .foot { padding-bottom: 40px; }
}
@media (max-width: 520px) {
  .search { flex: 0 0 44px; padding: 0 12px; transition: flex-basis .2s ease; }
  .search:focus-within, .search.has-value { flex-basis: 60%; }
  .top-address span { max-width: 140px; }
  .hero .mode { display: flex; width: 100%; }
  .hero .mode button { flex: 1; justify-content: center; padding: 10px 8px; }
  .mode .long { display: none; }
  .dish-photo { width: 104px; height: 104px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
