:root {
  --bg: #f7f6f4;
  --surface: #ffffff;
  --surface-2: #efeeeb;
  --text: #1a1917;
  --muted: #6b6862;
  --line: rgba(26, 25, 23, 0.1);
  --accent: #e2541b;
  --accent-ink: #ffffff;
  --accent-soft: #fbece4;
  --accent-text: #c4440f; /* акцент для текста — чуть темнее, чтобы читался на белом */
  --ok: #1f8a4c;
  --ok-soft: #e1f3e8;
  --warn: #b26a00;
  --warn-soft: #fdf0d8;
  --danger: #c0352b;
  /* Скругления. Значения для squircle — в блоке @supports (corner-shape) ниже. */
  --r-sm: 10px;
  --r-md: 12px;
  --radius: 14px;
  --r-lg: 16px;
  --r-xl: 18px;
  --r-2xl: 20px;
  --shadow: 0 1px 2px rgba(20, 18, 14, 0.06), 0 4px 12px rgba(20, 18, 14, 0.05);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121211;
    --surface: #1a1a19;
    --surface-2: #232322;
    --text: #efede8;
    --muted: #9c9a94;
    --line: rgba(239, 237, 232, 0.1);
    --accent: #ff6a2c;
    --accent-soft: #2b201a;
    --accent-text: #ff7a42;
    --ok: #4cc27d;
    --ok-soft: #173323;
    --warn: #f0a83a;
    --warn-soft: #3a2b12;
    --danger: #ff6b5e;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
}

a { color: var(--accent-text); }

.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }

h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.015em; text-wrap: balance; }
h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }
h3 { font-size: 16px; font-weight: 600; }

.muted { color: var(--muted); }
.small { font-size: 14px; }
.hidden { display: none !important; }

/* ---------- кнопки и поля ---------- */

button, .btn {
  font: inherit;
  border: 0;
  border-radius: var(--r-md);
  padding: 12px 16px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
}
button:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); font-weight: 500; }
.btn-ok { background: var(--ok); color: #fff; font-weight: 600; }
.btn-ghost { background: transparent; border: 1px solid var(--line); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 14px; border-radius: var(--r-sm); }

label { display: block; font-size: 14px; color: var(--muted); margin: 12px 0 6px; }

input, textarea, select {
  font: inherit;
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}
textarea { min-height: 72px; resize: vertical; }
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
/* у полей ввода фокус — тот же бордер, меняющий цвет (без второй обводки) */
input:focus, textarea:focus, select:focus { outline: none; }

.checkbox { display: flex; gap: 10px; align-items: center; color: var(--text); font-size: 16px; }
.checkbox input { width: 20px; height: 20px; }

.segmented { display: flex; gap: 6px; background: var(--surface-2); padding: 4px; border-radius: var(--r-md); }
.segmented button { flex: 1; background: transparent; min-height: 40px; }
.segmented button[aria-pressed='true'] { background: var(--surface); box-shadow: var(--shadow); font-weight: 600; }

.error { color: var(--danger); font-size: 14px; margin-top: 10px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.badge {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }

/* ---------- шапка заведения ---------- */

/* Горизонтальный отступ задаёт .wrap — здесь меняем только вертикальный, иначе текст прилипает к краям. */
.venue-head { padding-top: 24px; padding-bottom: 8px; }
.venue-head p { margin: 6px 0 0; }
.venue-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.closed-banner {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--warn-soft);
  color: var(--warn);
  font-weight: 600;
}

/* ---------- категории ---------- */

.cats {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.cats-inner {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-top: 10px;
  padding-bottom: 10px;
  scroll-padding: 0 16px;
  scrollbar-width: none;
}
.cats-inner::-webkit-scrollbar { display: none; }
.cats a {
  flex: none;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
}
.cats a.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- меню ---------- */

.menu-section { padding-top: 20px; scroll-margin-top: 60px; }
.menu-section h2 { margin-bottom: 10px; }

.items { display: grid; gap: 10px; }

.item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}
.item.with-photo { grid-template-columns: 84px 1fr auto; }
.item img {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.item-name { font-weight: 600; }
.item-desc { color: var(--muted); font-size: 14px; margin-top: 2px; }
.item-price { margin-top: 6px; font-weight: 500; font-variant-numeric: tabular-nums; }
.item.unavailable { opacity: 0.55; }

.menu-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0 12px; }
.menu-count { font-size: 15px; }
.view-toggle {
  display: flex; gap: 2px; width: max-content; margin: 0;
  background: var(--surface-2); border-radius: var(--r-md); padding: 3px;
}
.view-toggle button { min-height: 36px; min-width: 40px; padding: 0; background: transparent; color: var(--muted); }
.view-toggle button.active { background: var(--surface); color: var(--accent-text); }
.view-toggle .icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Список без фото: название и вес слева, цена и кнопка справа — карточка ниже и не пустая в середине */
.items:not(.items-grid) .item:not(.with-photo) {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "name price" "desc qty";
  align-items: center;
  column-gap: 16px;
  row-gap: 4px;
}
.items:not(.items-grid) .item:not(.with-photo) > div:first-child { display: contents; }
.items:not(.items-grid) .item:not(.with-photo) .item-name { grid-area: name; font-size: 17px; align-self: end; }
.items:not(.items-grid) .item:not(.with-photo) .item-desc { grid-area: desc; margin: 0; align-self: start; }
.items:not(.items-grid) .item:not(.with-photo) .item-price { grid-area: price; margin: 0; text-align: right; align-self: end; font-size: 17px; color: var(--accent-text); }
.items:not(.items-grid) .item:not(.with-photo) .qty-slot { grid-area: qty; justify-self: end; align-self: center; }

/* Сетка: две карточки в ряд, фото сверху */
.items-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
.items-grid .item, .items-grid .item.with-photo {
  grid-template-columns: 1fr; align-items: start; align-content: start; gap: 8px; padding: 8px;
}
.items-grid .item-photo { width: 100%; aspect-ratio: 1; }
.items-grid .item img { width: 100%; height: 100%; aspect-ratio: 1; }
.items-grid .item-desc {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.items-grid .qty-slot { align-self: end; }
.items-grid .add-btn, .items-grid .qty { width: 100%; justify-content: center; }
.items-grid .qty { justify-content: space-between; }
@media (min-width: 720px) { .items-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.qty {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: 3px;
}
.qty button { min-height: 36px; min-width: 36px; padding: 0; background: var(--surface); font-size: 20px; line-height: 1; }
.qty span { min-width: 24px; text-align: center; font-weight: 600; }
.add-btn { min-height: 40px; padding: 8px 14px; background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }

/* ---------- нижняя панель корзины ---------- */

.cart-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.cart-bar button { width: 100%; max-width: 688px; margin: 0 auto; display: flex; justify-content: space-between; box-shadow: var(--shadow); }
.page-pad { height: 96px; }

/* ---------- окно корзины ---------- */

dialog.sheet {
  border: 0;
  padding: 0;
  width: 100%;
  max-width: 720px;
  max-height: 92vh;
  margin: auto auto 0;
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  background: var(--bg);
  color: var(--text);
}
@media (min-width: 760px) {
  dialog.sheet { margin: auto; border-radius: var(--r-2xl); }
}
dialog.sheet::backdrop { background: rgba(0, 0, 0, 0.45); }
.sheet-head {
  position: sticky;
  top: 0;
  background: var(--bg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  z-index: 1;
}
.sheet-body { padding: 8px 16px 24px; }

.cart-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.cart-line .name { font-weight: 600; }

.totals { margin: 16px 0; display: grid; gap: 6px; }
.totals div { display: flex; justify-content: space-between; }
.totals .grand { font-size: 18px; font-weight: 600; }

/* ---------- статус заказа ---------- */

.steps { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 0; }
.steps li { display: flex; gap: 12px; align-items: flex-start; padding-bottom: 14px; position: relative; }
.steps li::before {
  content: '';
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-top: 4px;
  border: 2px solid var(--line);
  background: var(--surface);
}
.steps li:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 7px;
  top: 20px;
  bottom: 0;
  width: 2px;
  background: var(--line);
}
.steps li.done::before { background: var(--ok); border-color: var(--ok); }
.steps li.current::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.steps li.current { font-weight: 600; }
.steps li.todo { color: var(--muted); }

.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.space-between { justify-content: space-between; }

/* ---------- логотип zakazo ---------- */

.brand-logo { display: block; height: 32px; width: auto; color: var(--text); margin-bottom: 20px; }
.brand-logo-tile { fill: #17130f; }
.brand-logo-z { fill: #f3e7d3; }
@media (prefers-color-scheme: dark) {
  .brand-logo-tile { fill: #2a2a28; } /* на тёмном фоне плитка чуть светлее, иначе сливается */
}

/* ---------- панель заведения ---------- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
}
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button {
  background: transparent;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  padding: 10px 12px;
  white-space: nowrap;
}
.tabs button[aria-selected='true'] { border-bottom-color: var(--accent); color: var(--accent-text); font-weight: 600; }

/* ---------- карточка заказа ---------- */
.order-card { display: grid; gap: 14px; padding: 18px; }
.order-card.status-new { border-color: var(--accent); }
.order-card.status-done, .order-card.status-cancelled { background: transparent; }
.order-card.status-cancelled .oc-items, .order-card.status-cancelled .oc-total { opacity: .55; }
.oc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.oc-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.oc-num { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.oc-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.oc-tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 13px; line-height: 1.4; }
.oc-tag .icon { width: 14px; height: 14px; }
.oc-tag-when { background: var(--accent-soft); color: var(--accent-text); font-weight: 500; }
.oc-hint { margin: -6px 0 0; }
.oc-items { margin: 0; padding: 12px 0; list-style: none; display: grid; gap: 8px; border-block: 1px dashed var(--line); }
.oc-items li { display: grid; grid-template-columns: 36px 1fr; align-items: baseline; }
.oc-qty { color: var(--muted); font-variant-numeric: tabular-nums; }
.oc-name { font-weight: 500; overflow-wrap: anywhere; }
.oc-total { display: flex; align-items: baseline; justify-content: space-between; margin-top: -2px; }
.oc-total strong { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.oc-client { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r-md); background: var(--surface-2); }
.oc-ava { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--surface); color: var(--text); font-weight: 600; }
.oc-who { display: grid; min-width: 0; flex: 1; }
.oc-who strong { font-weight: 500; overflow-wrap: anywhere; }
.oc-call { flex: none; background: var(--surface); }
.oc-line { display: flex; align-items: flex-start; gap: 8px; color: var(--muted); }
.oc-line .icon { margin-top: 2px; }
.oc-note { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: var(--r-md); background: var(--warn-soft); color: var(--warn); }
.oc-note .icon { margin-top: 2px; flex: none; }
.order-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.order-actions button:first-child:not(.btn-danger) { flex: 1; }

.menu-admin-item { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.menu-admin-item:last-child { border-bottom: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 480px) { .grid-2 { grid-template-columns: 1fr; } }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: var(--r-md);
  z-index: 50;
  box-shadow: var(--shadow);
  max-width: calc(100% - 32px);
}

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }

/* ---------- «Ваш заказ» в меню и на главной ---------- */

.my-orders { display: grid; gap: 8px; }
.my-orders:empty { display: none; }
.my-orders:not(:empty) { padding-bottom: 12px; }
.my-order {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--text);
  text-decoration: none;
  transition: transform var(--t-fast, 140ms) ease-out;
}
.my-order:active { transform: scale(0.98); }
.my-order-text { flex: 1; min-width: 0; }
.my-order-arrow { font-size: 22px; color: var(--accent-text); line-height: 1; }
.my-order-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.8s ease-out infinite;
}
.my-order.status-done, .my-order.status-cancelled { background: var(--surface); border: 1px solid var(--line); }
.my-order.status-done .my-order-dot { background: var(--ok); animation: none; }
.my-order.status-cancelled .my-order-dot { background: var(--muted); animation: none; }

/* ---------- фото, логотип, цвет ---------- */

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

/* Логотип заведения: картинка или первая буква на фирменном цвете */
.venue-logo {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: var(--r-lg);
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 24px;
}
.venue-logo.has-image { background: none; }
.venue-logo img { width: 100%; height: 100%; object-fit: contain; }
.venue-logo-sm { width: 36px; height: 36px; border-radius: var(--r-sm); font-size: 16px; }
.venue-title { display: flex; gap: 14px; align-items: center; }
.venue-title h1 { min-width: 0; overflow-wrap: anywhere; }

/* Выбор фото блюда */
.photo-picker { display: flex; gap: 14px; align-items: center; margin: 8px 0 4px; }
.photo-drop {
  position: relative;
  flex: none;
  width: 112px;
  height: 112px;
  padding: 0;
  border-radius: var(--radius);
  border: 1.5px dashed var(--line);
  background: var(--surface-2);
  overflow: hidden;
}
.photo-drop img { width: 100%; height: 100%; object-fit: cover; display: block; animation: fade var(--t-med) ease-out; }
.photo-drop-empty { display: grid; gap: 4px; place-items: center; font-size: 13px; color: var(--muted); }
.photo-drop-icon { font-size: 26px; }
.photo-progress {
  position: absolute;
  inset: auto 0 0 0;
  padding: 4px;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
}
.photo-actions { display: grid; gap: 8px; justify-items: start; min-width: 0; }

.menu-admin-thumb {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  font-size: 18px;
}
.menu-admin-thumb img { width: 100%; height: 100%; object-fit: cover; }
.menu-admin-item { justify-content: flex-start; }
.menu-admin-item > .row { margin-left: auto; }

/* Логотип в настройках */
.logo-row { display: flex; gap: 14px; align-items: center; }
.logo-drop {
  flex: none;
  width: 72px;
  height: 72px;
  padding: 0;
  border-radius: var(--r-xl);
  overflow: hidden;
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--line);
}
.logo-drop img { width: 100%; height: 100%; object-fit: contain; display: block; }
.logo-drop:has(img:not(.hidden)) { background: none; border-color: transparent; }
.logo-initial { font-size: 30px; font-weight: 600; }

/* Цвета */
.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.swatch {
  width: 40px;
  height: 40px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  background: var(--swatch);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
  position: relative;
}
.swatch[aria-checked='true'] { box-shadow: 0 0 0 2px var(--text); transform: scale(1.06); }
.swatch-custom {
  margin: 0; /* у label по умолчанию есть отступы */
  display: grid;
  place-items: center;
  background: conic-gradient(#e2541b, #f2b705, #2a9d55, #0f8b8d, #2563eb, #7c3aed, #db2777, #e2541b);
  color: #fff;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.swatch-custom.is-custom { background: var(--swatch); }
.swatch-custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; padding: 0; border: 0; }

.brand-preview-card { padding: 14px; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--line); }
.brand-preview .item { box-shadow: none; }

/* Фото блюда в меню: нажимается — открывается крупно */
.item-photo { padding: 0; min-height: 0; border-radius: var(--r-sm); overflow: hidden; background: var(--surface-2); }
.item-photo img { display: block; }

dialog.photo-view {
  border: 0;
  padding: 0;
  width: min(560px, calc(100% - 32px));
  border-radius: var(--r-2xl);
  background: var(--surface);
  color: var(--text);
  overflow: hidden;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity var(--t-med) var(--ease-out), transform var(--t-med) var(--ease-out),
    overlay var(--t-med) allow-discrete, display var(--t-med) allow-discrete;
}
dialog.photo-view[open] { opacity: 1; transform: none; }
@starting-style {
  dialog.photo-view[open] { opacity: 0; transform: scale(0.96); }
}
dialog.photo-view::backdrop { background: rgba(0, 0, 0, 0.6); }
.photo-view img { display: block; width: 100%; max-height: 62vh; object-fit: cover; background: var(--surface-2); }
.photo-view-body { padding: 16px; display: grid; gap: 6px; }
.photo-view-close {
  position: absolute;
  top: 10px;
  right: 10px;
  min-height: 36px;
  width: 36px;
  padding: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
}

/* ---------- уведомления в панели ---------- */

.notify-banner {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  background: var(--accent-soft);
  border-color: transparent;
}
.notify-row { display: flex; gap: 12px; align-items: flex-start; padding-top: 12px; border-top: 1px solid var(--line); }
.notify-icon {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  background: var(--surface-2);
  font-size: 18px;
}
.status-on { color: var(--ok); font-weight: 600; }
.status-off { color: var(--warn); font-weight: 600; }
.manual-chat-id { margin-top: 14px; }
.manual-chat-id summary { cursor: pointer; color: var(--muted); }

/* =====================================================================
   Анимации
   Двигаем только transform и opacity — они не вызывают перерасчёт
   раскладки и плавно идут даже на слабых телефонах.
   ===================================================================== */

:root {
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast: 140ms;
  --t-med: 260ms;
  --t-slow: 380ms;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes pop {
  0%   { opacity: 0; transform: scale(0.6); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes bump {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}
@keyframes bar-bump {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.03); }
  100% { transform: scale(1); }
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 var(--accent-soft); }
  70%  { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@keyframes flash {
  0%   { background: var(--accent-soft); }
  100% { background: var(--surface); }
}

/* ---------- кнопки ---------- */

button, .btn {
  transition:
    transform var(--t-fast) var(--ease-out),
    background-color var(--t-med) var(--ease-out),
    color var(--t-med) var(--ease-out),
    box-shadow var(--t-med) var(--ease-out),
    opacity var(--t-med) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
button:active:not(:disabled), .btn:active { transform: scale(0.96); }

input, textarea, select {
  transition: border-color var(--t-med) var(--ease-out), box-shadow var(--t-med) var(--ease-out);
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }

.segmented button[aria-pressed] { transition: background-color var(--t-med) var(--ease-out), box-shadow var(--t-med) var(--ease-out), color var(--t-med); }

/* ---------- меню ---------- */

.cats a {
  transition: background-color var(--t-med) var(--ease-out), color var(--t-med) var(--ease-out),
    border-color var(--t-med) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
.cats a:active { transform: scale(0.95); }
.cats-inner { scroll-behavior: smooth; }

.item { transition: transform var(--t-fast) var(--ease-out), border-color var(--t-med), opacity var(--t-med); }
.item:active { transform: scale(0.99); }

.qty.pop, .add-btn.pop { animation: pop var(--t-med) var(--ease-spring); }
.qty span.bump { display: inline-block; animation: bump var(--t-med) var(--ease-out); }

/* Плавное появление при первой загрузке, лесенкой */
.enter > * { animation: rise var(--t-slow) var(--ease-out) both; }
.enter > *:nth-child(2) { animation-delay: 40ms; }
.enter > *:nth-child(3) { animation-delay: 80ms; }
.enter > *:nth-child(4) { animation-delay: 120ms; }
.enter > *:nth-child(5) { animation-delay: 160ms; }
.enter > *:nth-child(n + 6) { animation-delay: 200ms; }

/* ---------- нижняя кнопка корзины: выезжает снизу ---------- */

.cart-bar {
  transform: translateY(120%);
  opacity: 0;
  pointer-events: none;
  transition: transform var(--t-slow) var(--ease-out), opacity var(--t-med) var(--ease-out);
}
.cart-bar.show { transform: none; opacity: 1; pointer-events: auto; }
#open-cart.bump { animation: bar-bump var(--t-med) var(--ease-out); }
#cart-sum { font-variant-numeric: tabular-nums; }

/* ---------- окно корзины: выезжает снизу, фон затемняется ---------- */

dialog.sheet {
  transform: translateY(100%);
  transition:
    transform var(--t-slow) var(--ease-out),
    overlay var(--t-slow) allow-discrete,
    display var(--t-slow) allow-discrete;
}
dialog.sheet[open] { transform: none; }
@starting-style {
  dialog.sheet[open] { transform: translateY(100%); }
}

dialog.sheet::backdrop {
  background: rgba(0, 0, 0, 0);
  transition:
    background-color var(--t-slow) var(--ease-out),
    overlay var(--t-slow) allow-discrete,
    display var(--t-slow) allow-discrete;
}
dialog.sheet[open]::backdrop { background: rgba(0, 0, 0, 0.45); }
@starting-style {
  dialog.sheet[open]::backdrop { background: rgba(0, 0, 0, 0); }
}

@media (min-width: 760px) {
  dialog.sheet { transform: translateY(24px) scale(0.98); opacity: 0; transition-property: transform, opacity, overlay, display; }
  dialog.sheet[open] { transform: none; opacity: 1; }
  @starting-style {
    dialog.sheet[open] { transform: translateY(24px) scale(0.98); opacity: 0; }
  }
}

/* ---------- уведомления ---------- */

.toast { animation: toast-in var(--t-med) var(--ease-out); transition: opacity var(--t-med), transform var(--t-med) var(--ease-out); }
.toast.out { opacity: 0; transform: translate(-50%, 8px); }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- статус заказа ---------- */

.steps li::before, .steps li::after, .steps li {
  transition: background-color var(--t-slow) var(--ease-out), border-color var(--t-slow) var(--ease-out), color var(--t-slow);
}
.steps li.current::before { animation: pulse 1.8s var(--ease-out) infinite; }
.steps.advance li.current { animation: rise var(--t-slow) var(--ease-out); }
.badge { transition: background-color var(--t-med), color var(--t-med); }
.badge.pop { animation: pop var(--t-med) var(--ease-spring); }

/* ---------- панель заведения ---------- */

[id^='tab-']:not(.hidden) { animation: rise var(--t-med) var(--ease-out); }
.tabs button { transition: color var(--t-med), border-color var(--t-med) var(--ease-out); }
.order-card { transition: border-color var(--t-slow) var(--ease-out); }
.order-card.enter-card { animation: rise var(--t-slow) var(--ease-out) both; }
.order-card.flash { animation: flash 900ms var(--ease-out); }
.order-card.flash.linked { animation-duration: 2s; box-shadow: 0 0 0 2px var(--accent); }
.order-card { scroll-margin: 80px; }

/* =====================================================================
   Squircle — «суперэллипс», плавные углы как у иконок iOS.
   Работает в Chrome/Edge 139+ (большинство Android). Где corner-shape
   не поддерживается (пока Safari и Firefox), остаются обычные скругления.
   У squircle изгиб визуально мельче, поэтому радиусы больше примерно в 1,6 раза.
   ===================================================================== */

@supports (corner-shape: squircle) {
  :root {
    --r-sm: 16px;
    --r-md: 19px;
    --radius: 22px;
    --r-lg: 26px;
    --r-xl: 29px;
    --r-2xl: 32px;
  }
  *, *::before, *::after { corner-shape: squircle; }

  /* Круги должны остаться кругами */
  .swatch,
  .my-order-dot,
  .steps li::before,
  .photo-view-close { corner-shape: round; }
}

/* =====================================================================
   Blur — только там, где под элементом прокручивается содержимое
   или нужно отделить окно от страницы. Без поддержки — сплошной фон.
   ===================================================================== */

@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  :root {
    --glass: color-mix(in srgb, var(--bg) 72%, transparent);
    --glass-strong: color-mix(in srgb, var(--bg) 84%, transparent);
    --glass-blur: blur(18px) saturate(1.6);
  }

  /* Полоска категорий в меню: меню видно сквозь неё при прокрутке */
  .cats {
    background: var(--glass);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border-bottom-color: color-mix(in srgb, var(--line) 70%, transparent);
  }

  /* Низ с кнопкой корзины */
  .cart-bar {
    background: var(--glass);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  }

  /* Заголовок корзины, прилипающий при прокрутке */
  .sheet-head {
    background: var(--glass-strong);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
  }

  /* Затемнение под окнами: страница размывается, окно — в фокусе */
  dialog.sheet::backdrop,
  dialog.photo-view::backdrop {
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
  }

  /* Вкладки панели прилипают сверху, заказы прокручиваются под ними */
  .tabs {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--glass);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
  }

  /* Мелкие элементы поверх фото и уведомления */
  .toast {
    background: color-mix(in srgb, var(--text) 82%, transparent);
    -webkit-backdrop-filter: blur(12px) saturate(1.4);
    backdrop-filter: blur(12px) saturate(1.4);
  }
  .photo-view-close,
  .photo-progress {
    background: rgba(0, 0, 0, 0.35);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
}

/* Система просит меньше прозрачности — убираем стекло */
@media (prefers-reduced-transparency: reduce) {
  .cats, .cart-bar, .sheet-head, .tabs { background: var(--bg) !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
  .toast { background: var(--text) !important; backdrop-filter: none !important; }
  dialog.sheet::backdrop, dialog.photo-view::backdrop { backdrop-filter: none !important; }
}

/* Уважаем системную настройку «уменьшить движение» */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, ::backdrop {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- страница владельца и подписка ---------- */

.badge-danger { background: color-mix(in srgb, var(--danger) 16%, var(--surface)); color: var(--danger); }
.owner-card { border-left: 4px solid var(--line); }
.owner-card.status-active { border-left-color: var(--ok); }
.owner-card.status-grace { border-left-color: var(--warn); }
.owner-card.status-expired, .owner-card.status-unpaid, .owner-card.status-suspended { border-left-color: var(--danger); }
.claim { margin-top: 10px; padding: 10px 12px; border-radius: var(--r-md); background: var(--accent-soft); }

/* Плашка про подписку в панели заведения */
.billing-banner {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  border-color: transparent;
}
.billing-banner.warn { background: var(--warn-soft); }
.billing-banner.danger { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); }
.billing-banner strong { display: block; }
.pay-instructions { white-space: pre-line; padding: 12px; border-radius: var(--r-md); background: var(--surface-2); }
.big-date { font-size: 22px; font-weight: 600; }

/* ---------- выбор филиала ---------- */
.branch-list { display: grid; gap: 8px; }
.branch-option {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; min-height: 56px; padding: 12px 14px; text-align: left;
  border: 1.5px solid var(--line); border-radius: var(--r-md); background: var(--surface);
  transition: border-color var(--t-fast, .15s), background var(--t-fast, .15s);
}
.branch-option .name { display: block; font-weight: 600; }
.branch-option .small { display: block; }
.branch-option[aria-checked='true'] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}
.branch-option:disabled { opacity: 0.55; cursor: not-allowed; }

.when-badge { font-weight: 600; color: var(--accent-text); }

/* ---------- плавное появление блоков формы заказа ---------- */
/* Высота плавно меняется от 0 до нужной (grid 0fr → 1fr), без измерения в JS. */
.collapse {
  display: grid;
  grid-template-rows: 1fr;
  opacity: 1;
  transition: grid-template-rows var(--t-slow) var(--ease-out), opacity var(--t-med) var(--ease-out);
}
.collapse.is-closed { grid-template-rows: 0fr; opacity: 0; pointer-events: none; }
/* Поля фокуса не должны обрезаться: даём запас и забираем его обратно отрицательным отступом. */
.collapse-inner { min-height: 0; overflow: hidden; padding: 3px; margin: -3px; }
#when-wrap .collapse-inner { padding-top: 11px; }

.appear { animation: rise var(--t-med) var(--ease-out); }
.branch-option { transition: border-color var(--t-med) var(--ease-out), background-color var(--t-med) var(--ease-out), transform var(--t-fast) var(--ease-out), opacity var(--t-med); }
.branch-option:not(:disabled):active { transform: scale(0.98); }
.totals .grand span:last-child { display: inline-block; }

/* ---------- подпись платформы ---------- */
.platform-footer { display: grid; justify-items: center; gap: 8px; padding: 28px 0 8px; font-size: 13px; color: var(--muted); }
.platform-footer a { color: inherit; text-decoration: none; }
.platform-mark {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px;
  border-radius: var(--r-md); background: var(--surface-2);
  transition: background-color var(--t-med) var(--ease-out);
}
.platform-mark img { border-radius: 4px; display: block; }
.platform-mark strong { color: var(--text); }
.platform-cta { text-decoration: underline !important; text-underline-offset: 3px; }

/* ---------- отчёты ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kpi { padding: 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.kpi-value { font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 600; line-height: 1.2; margin: 2px 0; word-break: break-word; }

.chart { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 3px; align-items: end; height: 120px; }
.bar { height: 100%; padding: 0; min-height: 0; background: transparent; border: 0; display: flex; align-items: flex-end; border-radius: 4px; }
.bar-fill {
  display: block; width: 100%; height: var(--h); border-radius: 4px 4px 2px 2px;
  background: color-mix(in srgb, var(--accent) 55%, var(--surface-2));
  transform-origin: bottom; animation: bar-grow var(--t-slow) var(--ease-out) both;
  transition: background-color var(--t-fast);
}
.bar:hover .bar-fill, .bar.active .bar-fill { background: var(--accent); }
@keyframes bar-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.chart-axis { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 3px; margin-top: -4px; }
.chart-axis span { text-align: center; font-size: 11px; overflow: visible; white-space: nowrap; }
.chart-readout { min-height: 1.4em; }

.top-row { display: grid; gap: 4px; }
.top-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.top-bar span { display: block; height: 100%; border-radius: 3px; background: var(--accent); animation: bar-grow-x var(--t-slow) var(--ease-out) both; transform-origin: left; }
@keyframes bar-grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.split { display: flex; height: 10px; gap: 2px; border-radius: 5px; overflow: hidden; }
.split-part { display: block; min-width: 4px; }
.s0 { background: var(--accent); }
.s1 { background: color-mix(in srgb, var(--accent) 45%, var(--surface-2)); }
.s2 { background: color-mix(in srgb, var(--accent) 22%, var(--surface-2)); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: baseline; }
#r-period button { white-space: nowrap; padding-inline: 6px; font-size: 14px; }

/* ---------- стрелка списка ---------- */
/* Родная стрелка select прижимается к самому краю. Рисуем свою: отступ справа как у текста слева. */
select:not([multiple]) {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 44px;
  background-color: var(--surface);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  text-overflow: ellipsis;
}

/* ---------- логотип Zakazo на страницах ---------- */
.zk-bar { display: flex; justify-content: flex-end; padding-top: 14px; padding-bottom: 0; min-height: 32px; }
.zk-bar-left { justify-content: flex-start; padding-top: 6px; padding-bottom: 8px; }
.zk-bar a { display: inline-flex; opacity: 0.75; transition: opacity var(--t-med) var(--ease-out); }
.zk-bar a:hover { opacity: 1; }
.zk-bar .brand-logo, .zk-line .brand-logo, .platform-mark .brand-logo { margin-bottom: 0; }
.zk-line { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0; }
.zk-line a { display: inline-flex; opacity: 0.75; }
.platform-mark { gap: 8px; }

/* ---------- иконки (SVG вместо символов) ---------- */
.icon { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }
.photo-drop-icon { width: 28px; height: 28px; color: var(--muted); }
.notify-icon .icon { width: 20px; height: 20px; }
.my-order-arrow .icon { width: 22px; height: 22px; vertical-align: middle; }
.photo-view-close { display: grid; place-items: center; }
.btn-icon { min-width: 34px; padding-inline: 10px; }
.btn-icon .icon { vertical-align: middle; }
.menu-admin-thumb .icon { width: 22px; height: 22px; color: var(--muted); }

/* Строка блюда в панели: если кнопки не помещаются, они уходят на вторую строку, а не давят название */
.menu-admin-item { flex-wrap: wrap; row-gap: 10px; }
.menu-admin-item > div:nth-child(2) { flex: 1 1 150px !important; min-width: 0; overflow-wrap: anywhere; }
.menu-admin-item > .row { flex-wrap: wrap; margin-left: auto; }

/* ---------- поиск по меню ---------- */
.menu-search { padding-top: 8px; }
.menu-search input { padding-left: 14px; }

/* ---------- оформление заказа: три понятных шага ---------- */
.co-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  margin-top: 12px;
}
.co-card > label:first-of-type, .co-card .collapse-inner > label:first-child { margin-top: 0; }
.co-title { display: flex; align-items: center; gap: 10px; font-size: 16px; margin: 0 0 6px; }
.co-num {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-text); font-size: 13px; font-weight: 600;
}
.cart-lines .cart-line:last-child { border-bottom: 0; }
.cart-lines .cart-line:first-child { padding-top: 2px; }
.cart-lines .cart-line:last-child { padding-bottom: 2px; }
.co-card .segmented { margin-bottom: 2px; }
.co-card .segmented + .collapse, .co-card .collapse + label { margin-top: 0; }
.co-more { margin-top: 12px; }
.co-more summary { cursor: pointer; color: var(--accent-text); font-weight: 600; padding: 6px 0; list-style: none; }
.co-more summary::before { content: '+ '; }
.co-more[open] summary::before { content: '− '; }
.co-more summary::-webkit-details-marker { display: none; }
.co-more textarea { margin-top: 6px; }

/* Итог и кнопка всегда под рукой: прилипают к низу окна. */
.co-footer {
  position: sticky;
  bottom: 0;
  margin: 12px -16px 0;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--line);
  z-index: 1;
}
.co-footer .error { margin: 0 0 10px; }
.co-note { text-align: center; margin: 8px 0 0; }
.btn-lg { min-height: 52px; font-size: 17px; }
#submit-order { display: flex; justify-content: space-between; align-items: center; }
.co-card .totals { margin: 0; }
.co-note { margin-top: 12px; }

/* ---------- окно «Новый заказ» в панели ---------- */
dialog.order-alert {
  border: 0; padding: 0; width: min(440px, calc(100% - 24px)); max-height: calc(100dvh - 24px);
  margin: auto; border-radius: var(--r-2xl); background: var(--surface); color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); overflow: auto;
}
dialog.order-alert::backdrop { background: rgba(0, 0, 0, 0.6); }
dialog.order-alert[open] { animation: rise var(--t-med) var(--ease-out); }
.oa-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 18px;
  background: var(--accent); color: var(--accent-ink); font-size: 18px;
}
.oa-head .badge { margin-left: auto; }
.oa-pulse { width: 12px; height: 12px; border-radius: 50%; background: currentColor; animation: oa-pulse 1.2s ease-out infinite; }
@keyframes oa-pulse { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,.7); } 100% { box-shadow: 0 0 0 12px rgba(255,255,255,0); } }
.oa-body { padding: 16px 18px 6px; display: grid; gap: 12px; }
.oa-top { display: flex; justify-content: space-between; align-items: baseline; }
.oa-num { font-size: 30px; font-weight: 600; }
.oa-sum { font-variant-numeric: tabular-nums; font-size: 26px; font-weight: 600; color: var(--accent-text); }
.oa-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.oa-items { list-style: none; margin: 0; padding: 10px 12px; background: var(--surface-2); border-radius: var(--r-md); display: grid; gap: 6px; max-height: 32vh; overflow: auto; }
.oa-items li { display: flex; justify-content: space-between; gap: 12px; }
.oa-comment { margin: 0; padding: 8px 12px; border-radius: var(--r-md); background: var(--warn-soft); color: var(--warn); font-size: 14px; }
.oa-client { display: grid; gap: 2px; }
.oa-actions { display: grid; gap: 8px; padding: 12px 18px 18px; }
@media (prefers-reduced-motion: reduce) { .oa-pulse { animation: none; } }
#fulfillment-wrap .collapse-inner { padding-top: 11px; }
#branch-wrap + #fulfillment-wrap { margin-top: 4px; }

/* ---------- настройки: разделы ---------- */
.set-nav { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 14px; padding: 2px 16px; scrollbar-width: none; }
.set-nav::-webkit-scrollbar { display: none; }
.set-nav button {
  flex: none; min-height: 38px; padding: 6px 16px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text); font-weight: 500;
}
.set-nav button[aria-pressed='true'] { background: var(--text); color: var(--bg); border-color: var(--text); }
.set-card { margin-bottom: 14px; }
.set-title { margin: 0 0 4px; font-size: 18px; }
.set-desc { margin: 0 0 8px; }
.set-sep { height: 1px; background: var(--line); margin: 4px 0; }

.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin: 0; padding: 14px 0; color: var(--text); font-size: 16px; cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.switch-row:last-of-type { border-bottom: 0; }
.sw-text { display: grid; gap: 2px; }
.sw-text small { font-size: 13px; }
input.switch {
  appearance: none; -webkit-appearance: none; flex: none; width: 50px; height: 30px; padding: 0;
  border-radius: 999px; border: 0; background: var(--line); position: relative; cursor: pointer;
  transition: background-color var(--t-med, .2s);
}
input.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform var(--t-med, .2s) var(--ease-out, ease);
}
input.switch:checked { background: var(--ok); }
input.switch:checked::after { transform: translateX(20px); }
input.switch:disabled { opacity: .5; }

.save-bar {
  position: sticky; bottom: 0; z-index: 2; margin: 0 -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--line);
}
.save-bar .error { margin: 0 0 8px; }
.save-bar.hidden { display: none; }

/* ---------- филиалы ---------- */
.branch-card { display: grid; gap: 8px; padding: 14px 16px; }
.branch-card.is-off { opacity: .8; }
.bc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bc-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 17px; min-width: 0; }
.bc-switch { display: flex; align-items: center; gap: 10px; margin: 0; cursor: pointer; }
.bc-meta { display: grid; gap: 3px; }
.bc-meta .icon { width: 14px; height: 14px; vertical-align: -2px; }
.bc-edit summary, .branch-add summary { cursor: pointer; font-weight: 600; color: var(--accent-text); list-style: none; padding: 4px 0; }
.bc-edit summary::-webkit-details-marker, .branch-add summary::-webkit-details-marker { display: none; }
.bc-edit[open] summary { margin-bottom: 2px; }
.bc-tg { display: grid; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.branch-add summary { padding: 6px 0; font-size: 16px; }

/* ---------- меню в админке ---------- */
.menu-toolbar-admin { display: flex; flex-wrap: wrap; gap: 8px; }
.menu-toolbar-admin input { flex: 1 1 100%; }
.menu-group { padding: 8px 16px 12px; }
.mg-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0 4px; }
.mg-head h3 { margin: 0; font-size: 17px; }
.mi { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.mi:first-of-type { border-top: 0; }
.mi-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; background: transparent; padding: 0; min-height: 0; text-align: left; border-radius: var(--r-sm); }
.mi-text { display: grid; gap: 2px; min-width: 0; }
.mi-name { font-weight: 600; overflow-wrap: anywhere; }
.mi.is-off .mi-main { opacity: .55; }
.mi .menu-admin-thumb { flex: none; }
.mi-main { justify-content: flex-start; text-align: left; }
.mg-head h3 { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.mg-head .row { flex: none; flex-wrap: nowrap; gap: 6px; }
.mi-main { color: var(--text); }

/* ---------- заказ вручную ---------- */
#manual-sheet .co-card:first-child { margin-top: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.chips button { min-height: 40px; padding: 0 14px; border-radius: 999px; background: var(--surface-2); border: 1px solid transparent; }
.chips button[aria-pressed='true'] { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.m-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.m-two label { margin-top: 4px; }
@media (max-width: 480px) { .m-two { grid-template-columns: 1fr; } }
.m-items { display: grid; gap: 14px; }
.m-group-title { font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 4px; }
.m-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 8px 10px; margin: 0 -10px; border-radius: var(--r-md);
  transition: background-color var(--t-med) var(--ease-out);
}
.m-item.is-on { background: var(--accent-soft); }
.m-item .qty { flex: none; }
#manual-sheet .co-more { margin-top: 14px; }
.m-cats { flex-wrap: nowrap; overflow-x: auto; margin: 10px -4px 12px; padding: 2px 4px; scrollbar-width: none; }
.m-cats button { flex: none; white-space: nowrap; min-height: 36px; }
.m-cats::-webkit-scrollbar { display: none; }
#m-search { margin-top: 4px; }
.m-picked { margin-top: 14px; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); display: grid; gap: 4px; }
.m-picked-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }

/* Ссылка на наличие в шапке меню (видна, только если что-то есть) */
.stock-link { display: flex; align-items: center; gap: 6px; margin-top: 12px; padding: 12px 14px; border-radius: var(--r-md); background: var(--accent-soft, var(--surface-2)); color: var(--accent-text); text-decoration: none; }
.stock-link .icon { margin-left: auto; flex: none; }
.stock-link .muted { color: var(--muted); }

/* ---------- Наличие: страница клиента ---------- */
.stock-hero { margin-top: 18px; display: grid; gap: 6px; justify-items: start; }
.stock-hero h2 { font-size: 24px; }
.stock-hero p { margin: 0; }
.live-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 10px; border-radius: 999px;
  background: var(--ok-soft); color: var(--ok); font-size: 13px; font-weight: 600;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: live-pulse 2s ease-in-out infinite; }
@keyframes live-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); } 50% { box-shadow: 0 0 0 6px transparent; } }

.stock-card { display: grid; gap: 14px; padding: 16px; }
.stock-top { display: flex; align-items: flex-start; gap: 14px; }
.stock-tile {
  flex: none; width: 52px; height: 52px; display: grid; place-items: center;
  border-radius: var(--r-md); background: var(--accent); color: var(--accent-ink);
  font-size: 22px; font-weight: 600;
}
.stock-main { flex: 1; min-width: 0; }
.stock-main .item-name { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.stock-price { flex: none; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stock-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; border-top: 1px dashed var(--line); }
.stock-bottom .add-btn { min-height: 44px; padding: 0 28px; font-size: 16px; font-weight: 500; background: var(--accent); color: var(--accent-ink); border-radius: 999px; }
.stock-bottom .qty button { min-height: 44px; min-width: 44px; }
.stock-bottom .qty span { min-width: 32px; font-size: 18px; }
.st-meter { display: grid; gap: 6px; min-width: 0; }
.st-bars { display: flex; gap: 3px; }
.st-bars i { width: 10px; height: 18px; border-radius: 3px; background: var(--ok); }
.st-meter.is-low .st-bars i { background: var(--warn); }
.st-meter-text { font-size: 13px; font-weight: 500; color: var(--ok); white-space: nowrap; }
.st-meter.is-low .st-meter-text { color: var(--warn); }
.stock-count { margin: 0; color: var(--muted); font-size: 14px; }
.stock-count strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.stock-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.stock-empty { text-align: center; padding: 32px 20px; display: grid; justify-items: center; }
.stock-empty-icon {
  width: 64px; height: 64px; display: grid; place-items: center; margin-bottom: 14px;
  border-radius: 50%; background: var(--surface-2); color: var(--muted);
}
.stock-empty-icon .icon { width: 30px; height: 30px; }

/* ---------- Наличие: панель ---------- */
.st-summary { display: flex; flex-wrap: wrap; gap: 8px; }
.st-pill { padding: 6px 12px; border-radius: 999px; background: var(--surface-2); font-size: 13px; font-weight: 600; color: var(--muted); }
.st-pill.is-live { background: var(--ok-soft); color: var(--ok); }
.st-pill.is-warn { background: var(--warn-soft); color: var(--warn); }
.st-card { display: grid; gap: 14px; padding: 16px; }
.st-card.is-off, .st-card.is-stale { background: transparent; }
.st-head { display: flex; align-items: center; justify-content: flex-start; gap: 14px; width: 100%; background: transparent; padding: 0; min-height: 0; text-align: left; color: var(--text); }
.st-count { flex: none; display: grid; place-items: center; align-content: center; width: 64px; height: 64px; border-radius: var(--r-md); background: var(--ok-soft); color: var(--ok); line-height: 1.1; }
.st-count b { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.st-count small { font-size: 11px; }
.st-card.is-stale .st-count { background: var(--warn-soft); color: var(--warn); }
.st-card.is-off .st-count { background: var(--surface-2); color: var(--muted); }
.mi-text { gap: 2px; }
.st-title { font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }
.st-desc { font-weight: 400; }
.st-price { font-variant-numeric: tabular-nums; font-weight: 500; }
.st-card.is-off .st-title { color: var(--muted); }
.st-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 14px; border-top: 1px dashed var(--line); }
.st-actions .qty { margin-right: auto; }
.st-actions .qty button { min-height: 44px; min-width: 44px; }
.st-actions .qty span { min-width: 36px; font-size: 18px; }
.st-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.st-chips .muted { margin-right: 2px; }
.st-chips button { min-height: 36px; min-width: 44px; padding: 0 12px; }
.chips-row { display: flex; gap: 6px; margin-top: 8px; }
.chips-row button { min-height: 36px; padding: 0 14px; flex: 1; }
.st-empty { text-align: center; padding: 28px 16px; display: grid; gap: 6px; justify-items: center; }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* ---------- Отзывы ---------- */
.stars { display: inline-flex; gap: 1px; font-size: 16px; line-height: 1; letter-spacing: 0; }
.stars .star { color: transparent; background: linear-gradient(90deg, #d9962b var(--f), var(--line) var(--f)); -webkit-background-clip: text; background-clip: text; }
.stars-lg { font-size: 20px; }
.rating-chip { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; color: var(--text); text-decoration: none; font-size: 14px; }
.rating-chip .muted { color: var(--muted); }
.reviews { padding-top: 28px; padding-bottom: 8px; scroll-margin-top: 16px; }
.reviews:empty { display: none; }
.reviews-title { margin: 0 0 12px; }
.reviews-summary { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 12px; }
.reviews-score { display: grid; gap: 4px; justify-items: start; }
.reviews-avg { font-size: 44px; font-weight: 600; line-height: 1; letter-spacing: -0.02em; }
.reviews-bars { flex: 1 1 160px; display: grid; gap: 5px; min-width: 150px; }
.rbar { display: grid; grid-template-columns: 12px 1fr 24px; align-items: center; gap: 8px; }
.rbar-track { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.rbar-fill { display: block; height: 100%; background: #d9962b; border-radius: inherit; }
.review-list { display: grid; gap: 10px; }
.review { display: grid; gap: 8px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.review.is-hidden { opacity: 0.65; }
.review-top { display: flex; align-items: center; gap: 10px; }
.review-ava { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.review-who { display: grid; flex: 1; min-width: 0; }
.review-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.review-reply { padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); }
.review-reply p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.review-more { width: 100%; margin-top: 10px; }
.star-picker { display: flex; gap: 4px; }
.star-picker button { padding: 2px 4px; border: 0; background: none; font-size: 38px; line-height: 1; color: var(--line); cursor: pointer; transition: transform var(--t-fast) var(--ease-spring), color var(--t-fast); }
.star-picker button.on { color: #d9962b; }
.star-picker button:active { transform: scale(1.2); }
.star-hint { min-height: 1.4em; margin-top: 2px; }

/* =====================================================================
   Панель на компьютере: слева навигация, справа рабочая область.
   Под 1024px всё как раньше — одна колонка.
   ===================================================================== */

.side, .content { display: contents; }
.orders-bar > * { margin-bottom: 12px; }
#manual-open { width: 100%; }

@media (min-width: 1024px) {
  #app-view {
    max-width: 1440px;
    padding: 0 32px;
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
    column-gap: 40px;
    align-items: start;
  }
  .side {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: sticky;
    top: 0;
    min-height: 100vh;
    padding: 20px 0 28px;
  }
  .side .zk-bar { padding: 0 0 12px; }
  .side .topbar { display: grid; gap: 14px; padding: 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
  .side .topbar h1 { font-size: 18px !important; }
  .side .topbar #logout { justify-self: start; }

  /* вертикальная навигация */
  #app-view .tabs {
    position: static;
    flex-direction: column;
    gap: 2px;
    margin: 8px 0 0;
    padding: 0;
    border: 0;
    overflow: visible;
    background: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  #app-view .tabs button {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 42px;
    padding: 8px 14px;
    border: 0;
    border-radius: var(--r-md);
    font-size: 15px;
    color: var(--muted);
    text-align: left;
  }
  #app-view .tabs button .badge { margin-left: auto; }
  #app-view .tabs button:hover { background: var(--surface-2); color: var(--text); }
  #app-view .tabs button[aria-selected='true'] { background: var(--surface); color: var(--text); font-weight: 500; box-shadow: inset 0 0 0 1px var(--line); }
  #app-view .tabs button[aria-selected='true']::before { content: ''; width: 4px; height: 16px; margin-right: 2px; border-radius: 2px; background: var(--accent); }

  .content { display: block; padding: 28px 0 64px; min-width: 0; }
  .content > section { max-width: 920px; }
  .content > #tab-orders, .content > #tab-reports { max-width: none; }
  .content .billing-banner { max-width: 920px; }

  /* заказы: панель управления сверху, карточки сеткой */
  .orders-bar { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
  .orders-bar > * { margin-bottom: 0; }
  .orders-bar #branch-filter { width: 220px; }
  .orders-bar .orders-filter { flex: 1; justify-content: flex-start; gap: 20px; }
  .orders-bar #manual-open { order: 3; width: auto; padding-inline: 20px; }
  #orders { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; align-items: start; }
  #orders > .empty { grid-column: 1 / -1; }
  .order-card { height: 100%; align-content: start; }
}

@media (min-width: 1024px) {
  #r-body { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 16px; }
  #r-body > .kpis, #r-body > .empty, #r-body > .kpis + .card { grid-column: 1 / -1; }
  #r-body > .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .kpi { padding: 18px 20px; }
  .kpi-value { font-size: 28px; }
  .chart { height: 160px; }
}

@media (min-width: 1440px) {
  #orders { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
