/* Tavo – design tokens from docs/ui.md section 1; dark values from docs/phase2.md section 4.
   Colour tokens are semantic: each one means one thing, so dark mode only swaps values. */
:root {
  color-scheme: light dark;

  /* Page and text */
  --bg: #FAFAFB;
  --surface: #FFFFFF;          /* cards */
  --surface-raised: #FFFFFF;   /* sheets, dialogs */
  --line: #ECE9F0;
  --line-strong: #DDD9E2;
  --chip: #F1EFF4;
  --text: #141118;
  --muted: #4A4552;

  /* Pink */
  --pink: #FF2E88;             /* CTA backgrounds, badges, dots */
  --on-pink: #141118;          /* text on pink: 5.4:1 (white on pink is only 3.5:1) */
  --pink-text: #C2125F;        /* pink text, icons, focus outline */
  --pink-soft: #FFE3EF;        /* placeholders, error banner */

  /* "Dark" emphasis surfaces: status card, Closed card, staff headers, admin sidebar */
  --strong-bg: #141118;
  --strong-border: transparent;
  --strong-text: #FFFFFF;
  --strong-dim: #D9D4E0;
  --strong-hover: #2B2631;     /* hover and pills on a strong surface */
  --strong-active-bg: #FFFFFF; /* the selected tab on a strong surface */
  --strong-active-text: #141118;

  /* Dark buttons and selected chips ("Към плащане", cart button, "+") */
  --btn-dark-bg: #141118;
  --btn-dark-text: #FFFFFF;

  /* Switch track when off: on a strong surface / on a card */
  --toggle-off: #5A5363;
  --toggle-off-surface: #DDD9E2;

  --topbar-bg: rgba(250, 250, 251, 0.96);
  --bg-clear: rgba(250, 250, 251, 0);   /* fade-out end of the bottom bar */
  --backdrop: rgba(20, 17, 24, 0.55);

  --warn-bg: #FFF4D6; --warn-text: #5A4300;
  --ok-bg: #E3F5E9;   --ok-text: #145C2E;

  --radius-s: 12px; --radius-m: 16px; --radius-l: 20px;

  --page-max: 560px;
  --bar-max: 560px;      /* fixed bottom bars and sheets keep the phone width */
  --gutter: 16px;
  --topbar-h: 64px;
  --tabs-h: 56px;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* Dark mode follows the device setting (no switch). Contrast of every text/background pair
   is ≥ 4.5:1 – the list is in PROJECT-NOTES.md (Step 11). */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F0D12;
    --surface: #1A171F;
    --surface-raised: #221E28;
    --line: #2C2833;
    --line-strong: #3A3542;
    --chip: #26222C;
    --text: #F4F2F7;
    --muted: #B4AEBD;

    --pink-text: #FF6FAE;
    --pink-soft: #3A1A2A;

    --strong-bg: #26222C;
    --strong-border: #3A3542;
    --strong-text: #F4F2F7;
    --strong-hover: #3A3542;
    --strong-active-bg: #F4F2F7;

    --btn-dark-bg: #F4F2F7;
    --btn-dark-text: #141118;

    --toggle-off: #7A7385;
    --toggle-off-surface: #7A7385;

    --topbar-bg: rgba(15, 13, 18, 0.96);
    --bg-clear: rgba(15, 13, 18, 0);
    --backdrop: rgba(0, 0, 0, 0.7);

    --warn-bg: #3A2F0A; --warn-text: #FFD98A;
    --ok-bg: #12301E;   --ok-text: #8FE0AE;
  }
}

*, *::before, *::after { box-sizing: border-box; }

/* The hidden attribute must win over component display rules (e.g. .btn, .card). */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.45;
}

body.has-cartbar { padding-bottom: 96px; }
body.has-fixed-cta { padding-bottom: 104px; }

h1, h2, h3 { margin: 0; font-weight: 800; line-height: 1.2; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
p { margin: 0; }
a { color: inherit; }
img { max-width: 100%; display: block; }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 3px solid var(--pink-text); outline-offset: 2px; }
/* On dark surfaces the pink outline is too faint. */
.dark-card :focus-visible, .on-dark :focus-visible { outline-color: var(--strong-text); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Checkout honeypot (bot protection): off-screen, not display:none – some bots skip hidden fields. */
.honeypot { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 16px var(--gutter) 24px;
}

.stack > * + * { margin-top: 16px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.price { white-space: nowrap; font-weight: 700; text-align: right; }

/* ---------- Logo (ui.md section 2) ---------- */
.logo {
  font-family: 'Archivo', sans-serif;
  font-stretch: 125%;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text);
  text-decoration: none;
  font-size: 22px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.logo-dot { color: var(--pink); }
.logo--large { font-size: 40px; }
.on-dark .logo { color: var(--strong-text); }

/* ---------- TopBar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--topbar-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  height: var(--topbar-h);
  padding: 0 var(--gutter);
  display: flex; align-items: center; gap: 10px;
}

.address-picker {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 12px;
  background: var(--chip); border: 0; border-radius: 999px;
  cursor: pointer; text-align: left; font-weight: 700; font-size: 15px;
}
.address-picker-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.address-picker svg { flex: none; }

.cart-button {
  position: relative; flex: none;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--btn-dark-bg); color: var(--btn-dark-text);
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none;
}
.cart-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: var(--pink); color: var(--on-pink);
  font-size: 13px; font-weight: 800; line-height: 22px; text-align: center;
  border: 2px solid var(--bg);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  border-radius: var(--radius-m); border: 0;
  font-weight: 800; font-size: 16px; text-decoration: none; cursor: pointer;
}
/* Dark text on pink (see --on-pink). */
.btn-primary { background: var(--pink); color: var(--on-pink); font-size: 18px; }
.btn-dark { background: var(--btn-dark-bg); color: var(--btn-dark-text); font-size: 18px; }
.btn-outline { background: var(--surface); color: var(--text); border: 2px solid var(--text); }
.btn-block { width: 100%; }
.btn-big { min-height: 58px; }
.btn-split { justify-content: space-between; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
/* Faded pink on a dark page leaves dark text unreadable; use a plain grey button instead. */
@media (prefers-color-scheme: dark) {
  .btn[disabled], .btn[aria-disabled="true"] {
    opacity: 1; background: var(--chip); color: var(--muted); border-color: var(--chip); box-shadow: none;
  }
}

.link-button {
  background: none; border: 0; padding: 0 4px; min-height: 44px;
  color: var(--pink-text); font-weight: 800; cursor: pointer; text-decoration: underline;
}
/* A link (unlike a button) does not center its text in the 44px height by itself. */
a.link-button { display: inline-flex; align-items: center; }

.round-button {
  width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; cursor: pointer; text-decoration: none;
  background: var(--surface); color: var(--text);
  box-shadow: 0 1px 4px rgba(20, 17, 24, 0.18);
}
.round-button--dark { background: var(--btn-dark-bg); color: var(--btn-dark-text); box-shadow: none; }
.round-button--plain { box-shadow: none; background: var(--chip); }

/* ---------- Fixed bottom bars ---------- */
.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, var(--bg-clear));
}
.bottom-bar-inner { max-width: var(--bar-max); margin: 0 auto; }

.cartbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 58px; padding: 0 20px;
  border-radius: var(--radius-m);
  background: var(--pink); color: var(--on-pink); text-decoration: none;
  font-weight: 800; font-size: 18px;
  box-shadow: 0 6px 18px rgba(255, 46, 136, 0.18);
}
.cartbar-label { display: flex; flex-direction: column; padding: 8px 0; }
.cartbar-note { font-size: 14px; font-weight: 700; }

/* ---------- Search & chips ---------- */
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-m); padding: 0 14px; min-height: 52px;
}
.search svg { flex: none; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; min-height: 50px; font-size: 16px; outline: none; }
.search input::placeholder, .input::placeholder { color: var(--muted); opacity: 1; }
.search:focus-within { outline: 3px solid var(--pink-text); outline-offset: 2px; }

.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px var(--gutter) 6px;
  margin: 0 calc(-1 * var(--gutter)); scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center;
  min-height: 44px; padding: 0 16px; border-radius: 999px;
  background: var(--chip); color: var(--text); text-decoration: none; font-weight: 700;
}
.chip[aria-current="true"] { background: var(--btn-dark-bg); color: var(--btn-dark-text); }

/* ---------- Notices ---------- */
.expected-time { color: var(--muted); font-size: 16px; }
.banner { border-radius: var(--radius-m); padding: 14px 16px; }
.banner-warn { background: var(--warn-bg); color: var(--warn-text); }

.dark-card {
  background: var(--strong-bg); color: var(--strong-text);
  box-shadow: inset 0 0 0 1px var(--strong-border);
  border-radius: var(--radius-l); padding: 20px;
}
.dark-card h2 { font-size: 22px; }
.dark-card p + p, .dark-card h2 + p { margin-top: 8px; }
.dark-card .dim { color: var(--strong-dim); font-size: 15px; }
.dark-card .link-button { color: var(--strong-text); padding: 0; }
.dark-card p.closed-hours-link { margin-top: 0; }
.week-hours { list-style: none; margin: 0; padding: 0; }
.week-hours li { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.week-hours li:last-child { border-bottom: 0; }
.week-hours li > span:first-child { font-weight: 800; }

/* ---------- Restaurant cards ---------- */
.restaurant-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 16px; }
.restaurant-card {
  display: block; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-l); overflow: hidden;
}
/* Closed: dim only the picture; text keeps full contrast. */
.restaurant-card.is-closed .placeholder-img, .restaurant-card.is-closed img { opacity: 0.45; }
.restaurant-card.is-closed h3 { color: var(--muted); }
.restaurant-card-body { padding: 12px 16px 16px; }
.restaurant-card h3 { font-size: 18px; }
.restaurant-card .meta { color: var(--muted); font-size: 14px; margin-top: 6px; }
.status-note { color: var(--pink-text); font-weight: 800; font-size: 14px; margin-top: 4px; }

.placeholder-img {
  background: var(--pink-soft); color: var(--pink-text);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Archivo', sans-serif; font-stretch: 125%; font-weight: 800;
}
.restaurant-card .placeholder-img, .restaurant-card img { height: 120px; width: 100%; object-fit: cover; font-size: 40px; }

/* ---------- Dish search results ---------- */
.dish-results { list-style: none; margin: 0; padding: 0; }
.dish-result a {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  min-height: 56px; padding: 10px 0; border-bottom: 1px solid var(--line);
  text-decoration: none;
}

/* ---------- Welcome ---------- */
.welcome { text-align: left; padding-top: 32px; }
.welcome .tagline { font-size: 24px; font-weight: 800; margin-top: 20px; line-height: 1.25; }
.village-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.village-button {
  min-height: 56px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-m);
  background: var(--surface); font-weight: 800; font-size: 16px; cursor: pointer;
}
.village-button:hover { border-color: var(--text); }

/* ---------- Restaurant page ---------- */
.restaurant-hero { position: relative; margin: -16px calc(-1 * var(--gutter)) 0; }
.restaurant-hero .placeholder-img, .restaurant-hero img { height: 170px; width: 100%; object-fit: cover; font-size: 56px; }
.restaurant-hero .round-button { position: absolute; top: 12px; left: var(--gutter); }

.menu-tabs {
  position: sticky; top: var(--topbar-h); z-index: 15;
  background: var(--bg);
  margin: 0 calc(-1 * var(--gutter)); padding: 6px var(--gutter);
  border-bottom: 1px solid var(--line);
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
}
.menu-tabs::-webkit-scrollbar { display: none; }
.menu-tabs a { flex: none; }

.menu-section { scroll-margin-top: calc(var(--topbar-h) + var(--tabs-h) + 8px); }
.menu-section h2 { margin: 8px 0 4px; }

.menu-item {
  display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center;
  padding: 14px 0; border-bottom: 1px solid var(--line);
  scroll-margin-top: calc(var(--topbar-h) + var(--tabs-h) + 8px);
}
.menu-item.is-unavailable .menu-item-media { opacity: 0.45; }
.menu-item.is-unavailable h3 { color: var(--muted); }
.menu-item-text { min-width: 0; }
.menu-item-desc {
  color: var(--muted); font-size: 14px; overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
.menu-item-price { font-weight: 800; margin-top: 4px; }
.menu-item-media { position: relative; width: 88px; height: 88px; }
.menu-item-media .placeholder-img, .menu-item-media img { width: 88px; height: 88px; border-radius: var(--radius-s); object-fit: cover; font-size: 26px; }
.menu-item-media > form, .menu-item-media > .add-button { position: absolute; right: -6px; bottom: -6px; }
.add-button {
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--btn-dark-bg); color: var(--btn-dark-text);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(20, 17, 24, 0.25);
}

/* ---------- Sheets (bottom dialogs) ---------- */
dialog.sheet {
  border: 0; padding: 0; margin: auto auto 0;
  width: 100%; max-width: var(--bar-max); max-height: 92vh;
  border-radius: var(--radius-l) var(--radius-l) 0 0;
  background: var(--surface-raised); color: var(--text);
  overflow: auto;
}
dialog.sheet::backdrop { background: var(--backdrop); }
dialog.sheet[open] { animation: sheet-up 0.18s ease-out; }
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { dialog.sheet[open] { animation: none; } }

.sheet-header {
  position: sticky; top: 0; z-index: 1; background: var(--surface-raised);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px var(--gutter);
  border-bottom: 1px solid var(--line);
}
.sheet-body { padding: 16px var(--gutter); }
.sheet-footer {
  position: sticky; bottom: 0; background: var(--surface-raised);
  padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  display: flex; gap: 12px; align-items: center;
}
.sheet-hero .placeholder-img, .sheet-hero img { height: 180px; width: 100%; object-fit: cover; font-size: 56px; }

/* ---------- Forms ---------- */
.field { display: block; }
.field + .field { margin-top: 14px; }
.field-label { display: block; font-weight: 800; margin-bottom: 6px; }
.input, .select {
  width: 100%; min-height: 52px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  background: var(--surface); font-size: 16px; font-weight: 600;
}
.input:focus, .select:focus { outline: 3px solid var(--pink-text); outline-offset: 1px; }

.choice-list { list-style: none; margin: 0; padding: 0; }
.choice {
  display: flex; align-items: center; gap: 12px;
  min-height: 52px; padding: 8px 0; border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.choice input { width: 22px; height: 22px; accent-color: var(--text); flex: none; margin: 0; }
.choice-text { flex: 1; min-width: 0; }
.choice-sub { display: block; color: var(--muted); font-size: 14px; }
/* "Друга сума": the field under its choice, lined up with the choice text. */
.choice:has(+ .other-amount) { border-bottom: 0; }
.other-amount { padding: 0 0 12px 34px; }
.other-amount .input { max-width: 180px; }

.group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 18px; }
.group-tag { font-size: 14px; color: var(--muted); }

/* ---------- Stepper ---------- */
.stepper {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--chip); border-radius: 999px; padding: 2px;
}
.stepper button {
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: transparent; font-size: 22px; font-weight: 800; line-height: 1;
}
.stepper button:hover { background: var(--line-strong); }
.stepper output, .stepper .count { min-width: 24px; text-align: center; font-weight: 800; }

/* ---------- Cart ---------- */
.page-header { display: flex; align-items: center; gap: 12px; }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-l); padding: 16px;
}
.cart-line {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.cart-line:last-child { border-bottom: 0; padding-bottom: 0; }
.cart-line-options { grid-column: 1 / -1; color: var(--muted); font-size: 14px; margin-top: -4px; }
.cart-line-controls { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; }
.summary-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.summary-row.total { font-weight: 800; font-size: 18px; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; }

.progress { height: 8px; border-radius: 999px; background: var(--chip); overflow: hidden; margin-top: 8px; }
.progress > span { display: block; height: 100%; background: var(--pink); }

/* ---------- "Твоите поръчки" (phase2.md section 8) ---------- */
.active-orders { display: grid; gap: 12px; }
.active-order .dim { font-weight: 800; }
.active-order h2 { margin-top: 4px; }
.reorder-list, .order-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.reorder-card { display: flex; flex-direction: column; gap: 4px; }
.reorder-summary { color: var(--muted); font-size: 15px; }
.reorder-card-action { margin-top: auto; padding-top: 8px; }
.order-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.order-card-head h2 { font-size: 18px; }
.order-card-head a { text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.order-card-head a:hover { text-decoration: underline; }
.order-card { display: flex; flex-direction: column; gap: 4px; }
.order-card-meta { font-weight: 700; }
.order-card-action { margin-top: auto; padding-top: 8px; }
.pill {
  flex: none; display: inline-flex; align-items: center;
  padding: 4px 12px; border-radius: 999px; font-size: 14px; font-weight: 800;
}
.pill--active { background: var(--ok-bg); color: var(--ok-text); }
.pill--done { background: var(--chip); color: var(--text); }
.pill--problem { background: var(--pink-soft); color: var(--text); }
.choice-buttons { display: flex; flex-wrap: wrap; gap: 12px; }
.btn-plain { background: transparent; color: var(--text); text-decoration: underline; padding: 0 12px; }
.topbar-link { display: none; }

/* ---------- Footer ---------- */
.site-footer {
  max-width: var(--page-max); margin: 0 auto; padding: 8px var(--gutter) 24px;
  display: flex; flex-wrap: wrap; column-gap: 16px; font-size: 14px;
}
.site-footer a, .site-footer span { color: var(--muted); min-height: 44px; display: inline-flex; align-items: center; }

/* ---------- Plain text pages ---------- */
.prose h1 { margin-bottom: 12px; }
.prose p + p { margin-top: 12px; }

.saved-address { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.saved-address .choice { flex: 1; border-bottom: 0; }
.sheet-subtitle { margin: 20px 0 12px; }

/* ---------- Utilities ---------- */
.plain-fieldset { border: 0; padding: 0; margin: 16px 0 0; min-width: 0; }
.plain-fieldset legend { width: 100%; padding: 0; }
.grow { flex: 1; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-32 { margin-top: 32px; }

/* ---------- Checkout ---------- */
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.textarea { min-height: 72px; padding: 12px 14px; resize: vertical; }
.field-error { display: block; color: var(--pink-text); font-weight: 800; font-size: 14px; margin-top: 6px; }
.input[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--pink-text); border-width: 2px; }
.banner-error { background: var(--pink-soft); color: var(--text); }

/* Address sheet: optional exact location */
.location-field { margin-bottom: 16px; }
.location-added { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 700; }
.location-added .link-button { margin-left: auto; }
.location-field .field-error:empty { display: none; }

/* Promo code (phase2.md section 7) */
.summary-note { display: block; color: var(--muted); font-size: 14px; }
.promo-card { padding-top: 8px; padding-bottom: 8px; }
.promo-details > summary { list-style: none; display: inline-flex; align-items: center; padding: 0; }
.promo-details > summary::-webkit-details-marker { display: none; }
.promo-row { display: flex; align-items: flex-end; gap: 8px; margin: 8px 0; }
.promo-row .btn { flex: none; }
.promo-input { text-transform: uppercase; }
.promo-applied { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; column-gap: 12px; }
.promo-applied p { padding: 10px 0; }

/* ---------- Tracking ---------- */
.tracking-header { justify-content: space-between; }
.tracking-title { font-size: 18px; }
.status-steps { list-style: none; margin: 0; padding: 4px 0; }
.status-steps li {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 44px; color: var(--muted);
}
.status-steps li.is-done { color: var(--text); }
.status-steps li + li::before {
  content: ""; position: absolute; left: 7px; top: -14px; height: 28px; width: 2px; background: var(--line-strong);
}
.status-dot {
  position: relative; z-index: 1; flex: none;
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--line-strong); background: var(--surface);
}
.is-done .status-dot { background: var(--pink); border-color: var(--pink); }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute; left: 8px; top: -100px; z-index: 100;
  background: var(--btn-dark-bg); color: var(--btn-dark-text); padding: 12px 16px; border-radius: var(--radius-s);
  font-weight: 800; text-decoration: none;
}
.skip-link:focus { top: 8px; }

/* =====================================================================
   Tablet and desktop layouts (docs/phase2.md section 3).
   Everything above is the phone layout; below are only min-width rules,
   plus the few parts that exist only on bigger screens (hidden here).
   ===================================================================== */
.topbar-search, .cart-button-text, .cart-panel, .desktop-only { display: none; }
.two-column > * + * { margin-top: 16px; }

/* ---------- Tablet: 768–1099px ---------- */
@media (min-width: 768px) {
  :root { --page-max: 1200px; --gutter: 24px; }

  .page--narrow, .page--cart { max-width: 640px; }

  /* TopBar: logo · wider address pill · search · "Количка · 23,40 €" */
  .topbar-inner { gap: 16px; }
  .address-picker { flex: 1; max-width: 280px; }
  .topbar-search { display: block; flex: 1; min-width: 0; }
  .topbar-search .search { min-height: 44px; }
  .topbar-search .search input { min-height: 42px; }
  .home-search { display: none; }
  .cart-button { width: auto; padding: 0 16px; gap: 8px; border-radius: 999px; font-weight: 800; }
  .cart-button-text { display: inline; white-space: nowrap; }
  .topbar-link {
    display: inline-flex; align-items: center; flex: none; min-height: 44px; padding: 0 4px;
    font-weight: 800; text-decoration: none; white-space: nowrap;
  }
  .topbar-link:hover, .topbar-link[aria-current="page"] { text-decoration: underline; text-underline-offset: 4px; }

  /* "Твоите поръчки": cards side by side */
  .active-orders, .reorder-list, .order-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page--orders { max-width: 960px; }

  /* Welcome: centered card, villages in 3 columns */
  .welcome {
    max-width: 640px; margin: 48px auto 0; padding: 40px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l);
  }
  .village-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  /* Home: restaurant grid, 16:9 images, hover lift */
  .restaurant-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .restaurant-list > li { display: flex; }
  .restaurant-card { flex: 1; transition: box-shadow 0.15s ease, transform 0.15s ease; }
  .restaurant-card .placeholder-img, .restaurant-card img { height: auto; aspect-ratio: 16 / 9; font-size: 56px; }
  .restaurant-card:hover { box-shadow: 0 8px 24px rgba(20, 17, 24, 0.12); transform: translateY(-2px); }
  @media (prefers-reduced-motion: reduce) {
    .restaurant-card { transition: none; }
    .restaurant-card:hover { transform: none; }
  }

  /* Restaurant: menu items as cards, 2 columns */
  .menu-section { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .menu-section h2 { grid-column: 1 / -1; }
  .menu-item {
    padding: 12px 16px 12px 12px; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius-m);
  }

  /* Sheets become centered dialogs */
  dialog.sheet { margin: auto; max-height: 85vh; border-radius: var(--radius-l); }
  .sheet-footer { padding-bottom: 12px; }
}

/* ---------- Desktop: ≥ 1100px ---------- */
@media (min-width: 1100px) {
  :root { --gutter: 32px; }

  .address-picker { flex: 0 1 360px; max-width: none; }

  .page--cart { max-width: var(--page-max); }
  .desktop-only { display: revert; }

  /* The top-bar cart button and the cart panel / summary cards replace the fixed bars. */
  .bottom-bar--customer { display: none; }
  body.has-cartbar, body.has-fixed-cta { padding-bottom: 0; }

  .restaurant-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .active-orders, .reorder-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .page--orders { max-width: var(--page-max); }
  .order-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

  /* Cart and checkout: content left, sticky summary right */
  .two-column { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 32px; align-items: start; }
  .two-column > * + * { margin-top: 0; }
  .side-column { position: sticky; top: calc(var(--topbar-h) + 16px); }

  /* Restaurant: category list · menu · cart panel. The nav and the panel span all rows
     (--rows is set on the element) so they can stay sticky for the whole page. */
  .restaurant-page {
    display: grid; grid-template-columns: 220px minmax(0, 1fr) 340px;
    column-gap: 32px; align-items: start;
  }
  .restaurant-page > * { grid-column: 2; }
  .restaurant-page > .menu-tabs, .restaurant-page > .cart-panel {
    grid-row: 1 / span var(--rows); margin-top: 0;
    position: sticky; top: calc(var(--topbar-h) + 16px);
    max-height: calc(100vh - var(--topbar-h) - 32px); overflow-y: auto;
  }
  .restaurant-hero { margin: 0; border-radius: var(--radius-l); overflow: hidden; }
  .restaurant-hero .placeholder-img, .restaurant-hero img { height: 240px; }

  .menu-tabs {
    grid-column: 1; flex-direction: column; gap: 4px;
    margin: 0; padding: 0; border: 0; background: none;
  }
  .menu-tabs .chip { background: none; border-radius: var(--radius-s); }
  .menu-tabs .chip:hover { background: var(--chip); }
  .menu-tabs .chip[aria-current] { background: var(--btn-dark-bg); color: var(--btn-dark-text); }
  .menu-section, .menu-item { scroll-margin-top: calc(var(--topbar-h) + 16px); }

  .cart-panel { display: block; grid-column: 3; }
  .cart-panel-restaurant { font-size: 15px; margin-top: 12px; }
  .cart-panel-summary { margin-top: 12px; }
}

/* ---------- Wide desktop: ≥ 1440px ---------- */
@media (min-width: 1440px) {
  .restaurant-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.cart-notice { margin-bottom: 16px; }

/* Integer percentages used by the cart progress and report bars; no inline style attributes. */
.percent-0 { width: 0%; }
.percent-1 { width: 1%; }
.percent-2 { width: 2%; }
.percent-3 { width: 3%; }
.percent-4 { width: 4%; }
.percent-5 { width: 5%; }
.percent-6 { width: 6%; }
.percent-7 { width: 7%; }
.percent-8 { width: 8%; }
.percent-9 { width: 9%; }
.percent-10 { width: 10%; }
.percent-11 { width: 11%; }
.percent-12 { width: 12%; }
.percent-13 { width: 13%; }
.percent-14 { width: 14%; }
.percent-15 { width: 15%; }
.percent-16 { width: 16%; }
.percent-17 { width: 17%; }
.percent-18 { width: 18%; }
.percent-19 { width: 19%; }
.percent-20 { width: 20%; }
.percent-21 { width: 21%; }
.percent-22 { width: 22%; }
.percent-23 { width: 23%; }
.percent-24 { width: 24%; }
.percent-25 { width: 25%; }
.percent-26 { width: 26%; }
.percent-27 { width: 27%; }
.percent-28 { width: 28%; }
.percent-29 { width: 29%; }
.percent-30 { width: 30%; }
.percent-31 { width: 31%; }
.percent-32 { width: 32%; }
.percent-33 { width: 33%; }
.percent-34 { width: 34%; }
.percent-35 { width: 35%; }
.percent-36 { width: 36%; }
.percent-37 { width: 37%; }
.percent-38 { width: 38%; }
.percent-39 { width: 39%; }
.percent-40 { width: 40%; }
.percent-41 { width: 41%; }
.percent-42 { width: 42%; }
.percent-43 { width: 43%; }
.percent-44 { width: 44%; }
.percent-45 { width: 45%; }
.percent-46 { width: 46%; }
.percent-47 { width: 47%; }
.percent-48 { width: 48%; }
.percent-49 { width: 49%; }
.percent-50 { width: 50%; }
.percent-51 { width: 51%; }
.percent-52 { width: 52%; }
.percent-53 { width: 53%; }
.percent-54 { width: 54%; }
.percent-55 { width: 55%; }
.percent-56 { width: 56%; }
.percent-57 { width: 57%; }
.percent-58 { width: 58%; }
.percent-59 { width: 59%; }
.percent-60 { width: 60%; }
.percent-61 { width: 61%; }
.percent-62 { width: 62%; }
.percent-63 { width: 63%; }
.percent-64 { width: 64%; }
.percent-65 { width: 65%; }
.percent-66 { width: 66%; }
.percent-67 { width: 67%; }
.percent-68 { width: 68%; }
.percent-69 { width: 69%; }
.percent-70 { width: 70%; }
.percent-71 { width: 71%; }
.percent-72 { width: 72%; }
.percent-73 { width: 73%; }
.percent-74 { width: 74%; }
.percent-75 { width: 75%; }
.percent-76 { width: 76%; }
.percent-77 { width: 77%; }
.percent-78 { width: 78%; }
.percent-79 { width: 79%; }
.percent-80 { width: 80%; }
.percent-81 { width: 81%; }
.percent-82 { width: 82%; }
.percent-83 { width: 83%; }
.percent-84 { width: 84%; }
.percent-85 { width: 85%; }
.percent-86 { width: 86%; }
.percent-87 { width: 87%; }
.percent-88 { width: 88%; }
.percent-89 { width: 89%; }
.percent-90 { width: 90%; }
.percent-91 { width: 91%; }
.percent-92 { width: 92%; }
.percent-93 { width: 93%; }
.percent-94 { width: 94%; }
.percent-95 { width: 95%; }
.percent-96 { width: 96%; }
.percent-97 { width: 97%; }
.percent-98 { width: 98%; }
.percent-99 { width: 99%; }
.percent-100 { width: 100%; }
