/* «Стерх»: холодно-белый фон, фирменный голубой на всём, что нажимается, тепло дают фото блюд. */

/* ---------- токены ---------- */
:root {
  --sky: #f2f6f9;          /* фон экрана */
  --snow: #ffffff;         /* карточки, шторки */
  --ink: #16283a;          /* основной текст */
  --ink-2: #5e6e7d;        /* подписи */
  --crane: #5a93be;        /* фирменный голубой: логотип, полоса приёма */
  --crane-deep: #2d6a99;   /* кнопки и ссылки: белый текст читается */
  --crane-tint: #e3eef6;   /* фон степпера, выбранного, заглушек */
  --on-accent: #ffffff;
  --crest: #c8402b;        /* срочно, ошибка */
  --crest-tint: #fbe6e2;
  --meadow: #2e7d55;       /* успех */
  --meadow-tint: #e0f1e8;
  --line: #dde5ec;
  --shadow: 0 6px 20px rgba(22, 40, 58, .16);
  --r-photo: 18px;
  --r-field: 12px;
  --r-sheet: 24px;
  --tabbar: 62px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --sky: #0f1720; --snow: #18232f; --ink: #e8eef3; --ink-2: #94a3b1;
    --crane: #7fb0d6; --crane-deep: #7fb0d6; --crane-tint: #1e3244; --on-accent: #0f1720;
    --crest: #f0715b; --crest-tint: #3a211d; --meadow: #5bbe8a; --meadow-tint: #1a3327;
    --line: #26333f; --shadow: 0 6px 20px rgba(0, 0, 0, .45);
  }
}

/* ---------- основа ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.sheet-open { overflow: hidden; }
body {
  margin: 0; background: var(--sky); color: var(--ink);
  font: 400 16px/1.375 Onest, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; text-align: inherit; }
button:disabled { cursor: default; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 26px; line-height: 30px; font-weight: 700; letter-spacing: -.01em; text-wrap: balance; }
h2 { font-size: 20px; line-height: 24px; font-weight: 650; }
a { color: var(--crane-deep); }
:focus-visible { outline: 2px solid var(--crane-deep); outline-offset: 2px; }
.icon { display: inline-flex; flex: none; }

.page { max-width: 640px; margin: 0 auto; padding: 0 16px calc(var(--tabbar) + var(--safe-bottom) + 40px); min-height: 100dvh; }
.page > h1 { padding-top: 20px; margin-bottom: 12px; }   /* раздел управления */
.page h2 { margin: 24px 0 12px; }
.legal { padding-top: 16px; padding-bottom: 40px; }
.legal p { margin: 8px 0; }
.muted { color: var(--ink-2); font-size: 14px; line-height: 18px; }
.center { text-align: center; }
.hint { color: var(--ink-2); font-size: 13px; line-height: 17px; margin-top: 10px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; } .right { margin-left: auto; }
.between { justify-content: space-between; }
.price { font-weight: 600; white-space: nowrap; font-size: 17px; line-height: 22px; }
.price.big { font-size: 20px; line-height: 24px; font-weight: 700; }
.total { font-weight: 700; }

/* ---------- шапка меню ---------- */
.top { padding: 14px 0 14px; }
.top.plain { padding-top: 20px; }
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; min-height: 48px; }
.brand-logo { width: 56px; height: 50px; object-fit: contain; flex: none; }
.brand-name { font-size: 20px; font-weight: 700; color: var(--crane-deep); letter-spacing: .01em; }
.brand-orders { margin-left: auto; }
.icon-btn {
  position: relative; width: 44px; height: 44px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--crane-deep); background: var(--crane-tint);
}
.dot { position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--crest); box-shadow: 0 0 0 2px var(--crane-tint); }

/* полоса приёма заказов */
.intake { margin-top: 12px; }
.intake-text { display: flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 14px; line-height: 18px; font-weight: 450; }
.intake-bar { height: 4px; border-radius: 2px; background: var(--line); margin-top: 8px; overflow: hidden; }
.intake-fill { display: block; height: 100%; border-radius: 2px; background: var(--crane); transition: width .6s ease; }
.intake.urgent .intake-text { color: var(--crest); }
.intake.urgent .intake-fill { background: var(--crest); }
.intake.closed { background: var(--crane-tint); border-radius: var(--r-field); padding: 12px 14px; }
.intake.closed .intake-text { color: var(--ink); align-items: flex-start; }
.intake.closed .intake-bar { display: none; }

/* ---------- категории ---------- */
.cats, .chips, .slots { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.cats::-webkit-scrollbar, .chips::-webkit-scrollbar, .slots::-webkit-scrollbar { display: none; }
.cats {
  position: sticky; top: 0; z-index: 4; margin: 0 -16px; padding: 8px 16px;
  background: color-mix(in srgb, var(--sky) 92%, transparent); backdrop-filter: blur(10px);
}
.chips { padding: 4px 0 12px; }
.slots { margin: 0 -20px; padding: 2px 20px 4px; }
.chip {
  flex: none; min-height: 44px; padding: 0 16px; border-radius: 999px; background: var(--snow);
  font-size: 15px; font-weight: 500; white-space: nowrap; color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}
.chip.on { background: var(--crane-deep); color: var(--on-accent); box-shadow: none; font-weight: 600; }
.cat { scroll-margin-top: 64px; }
.cat h2 { margin: 20px 0 12px; }

/* ---------- блюда ---------- */
.dishes { display: grid; gap: 12px; }
.dish { display: grid; position: relative; min-width: 0; }
.dish-text { min-width: 0; cursor: pointer; }
.dish-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.dish-name { font-size: 17px; line-height: 22px; font-weight: 600; margin: 0; }
.name-btn { font: inherit; color: inherit; text-align: left; }
.dish-meta { color: var(--ink-2); font-size: 14px; line-height: 18px; margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.low { color: var(--crest); font-size: 14px; line-height: 18px; font-weight: 500; margin-top: 4px; }

/* с фото: снимок — главный, кнопка лежит на нём */
.dish.with-photo { margin-bottom: 8px; }
.dish-photo { grid-area: 1 / 1; display: block; width: 100%; aspect-ratio: 4 / 3; border-radius: var(--r-photo);
  overflow: hidden; background: var(--crane-tint); }
.dish-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dish.with-photo .dish-control { grid-area: 1 / 1; align-self: end; justify-self: end; margin: 10px; z-index: 1; }
.dish.with-photo .dish-text { padding: 10px 2px 0; }
.dish.with-photo .stepper { background: var(--snow); box-shadow: var(--shadow); }
.dish.with-photo .add { box-shadow: var(--shadow); }

/* без фото: компактная строка */
.dish.plain { grid-template-columns: 1fr auto; align-items: center; gap: 12px; background: var(--snow);
  border-radius: var(--r-photo); padding: 14px 12px 14px 16px; }
.dish.plain .price { display: block; margin-top: 6px; }

.dish.off .dish-photo img { filter: grayscale(1); opacity: .55; }
.dish.off .dish-text { opacity: .55; }
.pill { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border-radius: 999px;
  font-size: 13px; font-weight: 600; white-space: nowrap; }
.muted-pill { background: var(--snow); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 999px;
  background: var(--crane-deep); color: var(--on-accent); font-weight: 600; text-align: center;
  transition: transform .1s ease, opacity .15s ease;
}
.btn:active { transform: scale(.98); }
.btn.block { display: flex; width: 100%; min-height: 54px; font-size: 17px; }
.btn.ghost { background: transparent; color: var(--crane-deep); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.danger { background: transparent; color: var(--crest); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.small { min-height: 44px; padding: 0 16px; font-size: 15px; }
.btn:disabled { opacity: .5; }
.add { width: 48px; height: 48px; border-radius: 50%; background: var(--crane-deep); color: var(--on-accent);
  display: inline-flex; align-items: center; justify-content: center; transition: transform .1s ease; }
.add:active { transform: scale(.92); }
.stepper { display: inline-flex; align-items: center; border-radius: 999px; background: var(--crane-tint);
  animation: grow .18s ease; }
.stepper button { width: 44px; height: 48px; border-radius: 999px; color: var(--crane-deep);
  display: inline-flex; align-items: center; justify-content: center; }
.stepper button:disabled { opacity: .35; }
.stepper-value { min-width: 22px; text-align: center; font-weight: 600; }
@keyframes grow { from { transform: scale(.85); opacity: .5; } }
.line-btn { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 48px;
  color: var(--crane-deep); font-weight: 500; border-top: 1px solid var(--line); margin-top: 8px; }

/* ---------- формы ---------- */
label.field { display: block; margin: 14px 0 0; font-size: 14px; color: var(--ink-2); }
input[type=text], input[type=number], input[type=time], input[type=date], select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px; min-height: 48px;
  border: 1.5px solid var(--line); border-radius: var(--r-field); background: var(--snow); color: var(--ink); font-size: 16px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--crane-deep); }
input[aria-invalid=true] { border-color: var(--crest); }
input.mini { width: 92px; display: inline-block; margin: 0; padding: 8px 10px; min-height: 40px; }
textarea { min-height: 72px; resize: vertical; }
input[type=checkbox] { width: 24px; height: 24px; flex: none; accent-color: var(--crane-deep); }
.field-error { display: block; color: var(--crest); font-size: 14px; line-height: 18px; margin-top: 6px; }
.notice { display: flex; gap: 10px; align-items: flex-start; background: var(--crest-tint); color: var(--ink);
  border-radius: var(--r-field); padding: 12px 14px; margin-bottom: 14px; font-size: 15px; line-height: 20px; }
.notice .icon { color: var(--crest); margin-top: 1px; }

/* ---------- нижняя панель ---------- */
#bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; }
#bottom.has-cart { padding: 10px 16px calc(10px + var(--safe-bottom));
  background: linear-gradient(to top, var(--sky) 62%, transparent); }
.cart-btn { max-width: 608px; margin: 0 auto; padding: 0 20px 0 8px; box-shadow: var(--shadow); text-align: left; }
.cart-count { min-width: 38px; height: 38px; padding: 0 8px; border-radius: 999px; display: inline-flex;
  align-items: center; justify-content: center; background: color-mix(in srgb, var(--on-accent) 18%, transparent); }
.tabbar { display: flex; background: var(--snow); border-top: 1px solid var(--line); padding-bottom: var(--safe-bottom); }
.tabbar button { position: relative; flex: 1; height: var(--tabbar); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.tabbar button.on { color: var(--crane-deep); font-weight: 600; }
.tabbar .dot { top: 8px; right: calc(50% - 18px); box-shadow: 0 0 0 2px var(--snow); }
/* кнопка «Сохранить» в разделе управления — над вкладками */
.cartbar { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar) + var(--safe-bottom)); padding: 10px 16px; z-index: 5;
  background: linear-gradient(to top, var(--sky) 62%, transparent); }
.cartbar .btn { max-width: 608px; margin: 0 auto; box-shadow: var(--shadow); }

/* ---------- шторка ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 30; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(8, 16, 26, .45); opacity: 0; transition: opacity .24s ease; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto; max-height: 92dvh;
  display: flex; flex-direction: column; background: var(--snow);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0; box-shadow: var(--shadow);
  transform: translateY(100%); transition: transform .24s cubic-bezier(.2, .8, .2, 1);
}
.sheet-wrap.in .sheet-backdrop { opacity: 1; }
.sheet-wrap.in .sheet { transform: none; }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 8px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 20px; flex: none; }
.sheet-title { flex: 1; min-width: 0; font-size: 20px; line-height: 24px; margin: 0; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px 20px 16px; flex: 1; }
.sheet-foot { padding: 12px 20px calc(14px + var(--safe-bottom)); border-top: 1px solid var(--line); flex: none; }
.sheet-foot:empty { display: none; }
.sheet-photo { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r-photo);
  background: var(--crane-tint); margin-bottom: 14px; }
.dish-full { margin-top: 10px; color: var(--ink-2); }
.block-title { font-size: 17px; line-height: 22px; font-weight: 600; margin: 20px 0 10px; }
.cart-items { list-style: none; margin: 12px 0 0; padding: 0; }
.cart-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart-name { font-weight: 500; }
.guests { margin-top: 16px; min-height: 48px; }
.total-row { margin-bottom: 10px; }

/* ---------- карточки, заказы ---------- */
.card { background: var(--snow); border-radius: var(--r-photo); padding: 14px 16px; margin-bottom: 12px; }
.banner { background: var(--crane-tint); border-radius: var(--r-field); padding: 12px 14px; margin: 12px 0; font-size: 14px; }
.photo { width: 96px; height: 96px; flex: none; border-radius: 14px; object-fit: cover; background: var(--crane-tint); }
.photo.small { width: 56px; height: 56px; border-radius: 12px; }
.arow { display: flex; align-items: center; gap: 12px; width: 100%; }
.arow.off { opacity: .5; }
.order-title { font-size: 18px; line-height: 22px; margin: 0 !important; }
.order.now { box-shadow: inset 0 0 0 1.5px var(--crane); }
.order-when { font-weight: 600; margin-top: 6px; }
.order-note { margin: 10px 0; color: var(--ink); background: var(--crane-tint); border-radius: var(--r-field); padding: 10px 12px; font-size: 15px; }
.order-list { margin: 6px 0; font-size: 15px; }
.order.past .btn { margin-top: 10px; }
.section-title { color: var(--ink-2); font-size: 15px !important; font-weight: 600; }
.items { margin: 10px 0; padding: 0; list-style: none; font-size: 15px; }
.items li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.badge { font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--line); white-space: nowrap; }
.badge.awaiting_payment { background: var(--crane-tint); color: var(--crane-deep); }
.badge.paid, .badge.accepted, .badge.cooking { background: var(--meadow-tint); color: var(--meadow); }
.badge.served { background: var(--line); color: var(--ink-2); }
.badge.cancelled, .badge.expired { background: var(--crest-tint); color: var(--crest); }

/* шаги статуса: Оплачен → Принят → Готовится → Подан */
.steps { display: flex; list-style: none; margin: 14px 0 10px; padding: 0; }
.steps li { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 12px; line-height: 14px; color: var(--ink-2); text-align: center; }
.steps li::before { content: ""; position: absolute; top: 11px; right: 50%; width: 100%; height: 2px; background: var(--line); }
.steps li:first-child::before { display: none; }
.steps li.done::before, .steps li.now::before { background: var(--meadow); }
.step-dot { position: relative; width: 24px; height: 24px; border-radius: 50%; background: var(--snow);
  box-shadow: inset 0 0 0 2px var(--line); display: inline-flex; align-items: center; justify-content: center; color: var(--on-accent); }
.steps li.done .step-dot, .steps li.now .step-dot { background: var(--meadow); box-shadow: none; }
.steps li.now { color: var(--ink); font-weight: 600; }

/* ---------- раздел управления ---------- */
.gap-top { margin-top: 10px; } .gap-bottom { margin-bottom: 12px; } .gap-left { margin-left: 8px; }
input.flat { margin: 0; }
.counters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 4px 0 10px; }
.counter { background: var(--snow); border-radius: 14px; padding: 10px 6px; text-align: center; display: flex; flex-direction: column; }
.counter b { font-size: 22px; line-height: 26px; color: var(--crane-deep); }
.counter span { font-size: 12px; line-height: 16px; color: var(--ink-2); }
.counter.zero b { color: var(--ink-2); font-weight: 500; }
.h2-note { color: var(--ink-2); font-size: 14px; font-weight: 450; margin-left: 8px; }
.qty { font-weight: 600; white-space: nowrap; }
.day-details { margin: 10px 0 0; font-size: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.fold { margin-top: 20px; }
.fold summary { min-height: 44px; display: flex; align-items: center; color: var(--crane-deep); font-weight: 500; cursor: pointer; }
.fold[open] summary { margin-bottom: 8px; }
.confirm-text { font-size: 16px; line-height: 22px; }
.btn.danger-solid { background: var(--crest); color: #fff; }
/* переключатель вместо галочки */
input[type=checkbox].switch { appearance: none; -webkit-appearance: none; width: 48px; height: 28px; border-radius: 999px;
  background: var(--line); position: relative; cursor: pointer; transition: background .15s ease; margin: 0; }
input.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s ease; }
input.switch:checked { background: var(--crane-deep); }
input.switch.stop:checked { background: var(--crest); }
input.switch:checked::after { transform: translateX(20px); }

/* ---------- пусто, загрузка, сообщения ---------- */
.empty { text-align: center; color: var(--ink-2); padding: 48px 16px; }
.empty h2 { color: var(--ink); margin: 0 0 8px !important; }
.empty .btn { margin-top: 20px; }
.empty-mark { width: 160px; height: 160px; object-fit: contain; opacity: .35; margin-bottom: 4px; }
.fatal { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.footer { text-align: center; margin-top: 28px; font-size: 14px; }
.skeleton { padding: 20px 16px; max-width: 640px; margin: 0 auto; }
.sk { background: var(--line); border-radius: 12px; animation: pulse 1.2s ease-in-out infinite alternate; }
.sk.title { height: 30px; width: 70%; margin: 62px 0 14px; }
.sk.bar { height: 18px; width: 55%; margin-bottom: 22px; }
.sk.chipline { height: 44px; border-radius: 999px; margin-bottom: 24px; }
.sk.card { height: 96px; border-radius: 18px; margin-bottom: 12px; }
@keyframes pulse { from { opacity: 1; } to { opacity: .45; } }

#toast { position: fixed; left: 50%; bottom: calc(var(--tabbar) + var(--safe-bottom) + 24px); transform: translateX(-50%);
  background: var(--ink); color: var(--sky); padding: 12px 16px; border-radius: 14px; font-size: 15px; line-height: 20px;
  width: max-content; max-width: min(92%, 420px); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 40; text-align: center; }
#toast.show { opacity: 1; }

@media (min-width: 600px) {
  .dishes { grid-template-columns: 1fr 1fr; gap: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
