/* Цвета и шрифты приходят из /theme.css (client.yaml). Здесь — значения по умолчанию.
   :where() обнуляет специфичность: тема клиента побеждает при любом порядке подключения. */
:where(:root) {
  --c-primary: #24463A; --c-on-primary: #fff; --c-accent: #B08A4A;
  --c-background: #fff; --c-surface: #F2F0EA; --c-text: #1D2422; --c-muted: #5C6561;
  --f-display: Georgia, serif; --f-body: system-ui, sans-serif;
  --line: color-mix(in srgb, var(--c-text) 14%, transparent);
  --ok: #2F6B4F; --warn: #9A5B12; --danger: #A3312A;
  --radius-s: 6px; --radius-m: 12px; --radius-l: 20px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 16px/1.5 var(--f-body); color: var(--c-text); background: var(--c-background); }
body.no-scroll { overflow: hidden; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
a { color: var(--c-primary); }
.muted { color: var(--c-muted); }
.small { font-size: 13px; }
.warn { color: var(--warn); }
.loading, .empty { color: var(--c-muted); padding: 24px 0; }
.offline { position: fixed; top: 0; left: 0; right: 0; z-index: 50; padding: 8px 16px; background: var(--warn); color: #fff; font-size: 14px; text-align: center; }
.fatal { min-height: 80vh; display: grid; place-items: center; padding: 24px; text-align: center; }
.fatal h1 { font: 500 26px/1.3 var(--f-display); max-width: 22ch; }

/* ---------------------------------------------------------------- кнопки и поля */
.btn { border: 1px solid var(--line); background: var(--c-background); border-radius: var(--radius-s); padding: 12px 18px; font-weight: 500; min-height: 44px; }
.btn.primary { background: var(--c-primary); color: var(--c-on-primary); border-color: var(--c-primary); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.small { padding: 6px 12px; min-height: 34px; font-size: 14px; }
.btn.wide { width: 100%; }
.btn.grow { flex: 1; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.field { display: grid; gap: 4px; font-size: 13px; color: var(--c-muted); }
.field input { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; font-size: 16px; color: var(--c-text); background: var(--c-background); width: 100%; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-s); }
.stepper button { border: 0; background: none; width: 44px; height: 44px; font-size: 20px; }
.stepper output { min-width: 28px; text-align: center; font-variant-numeric: tabular-nums; }
.stepper.small button { width: 34px; height: 34px; font-size: 18px; }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--c-accent); color: #fff; font-size: 12px; font-weight: 700; }
.chip { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: var(--c-surface); white-space: nowrap; }
.chip.s-new { background: #F5E7CF; color: var(--warn); }
.chip.s-cooking, .chip.s-accepted { background: #E3ECE7; color: var(--ok); }
.chip.s-ready { background: var(--ok); color: #fff; }
.chip.s-cancelled { text-decoration: line-through; }
.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 80;
  background: var(--c-text); color: #fff; padding: 12px 18px; border-radius: var(--radius-s); max-width: min(92vw, 420px); transition: .2s; font-size: 15px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }

/* ---------------------------------------------------------------- шторка */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(20, 24, 22, .45); opacity: 0; transition: opacity .2s; }
.sheet { position: absolute; left: 50%; bottom: 0; width: min(100%, 640px); max-height: 92vh; overflow: auto; background: var(--c-background);
  border-radius: var(--radius-l) var(--radius-l) 0 0; padding: 28px 20px calc(20px + var(--safe-b)); transform: translate(-50%, 100%); transition: transform .25s ease-out; }
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: translate(-50%, 0); }
.sheet-close { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border: 0; background: none; font-size: 28px; color: var(--c-muted); }
.sheet-title { font: 600 26px/1.2 var(--f-display); margin: 0 40px 8px 0; }
.sheet-desc { color: var(--c-muted); margin: 0 0 16px; }
.sheet-actions { display: flex; gap: 12px; margin-top: 20px; position: sticky; bottom: 0; background: var(--c-background); padding-top: 12px; }
.stack { display: grid; gap: 10px; margin-top: 12px; }
.opt { border: 0; padding: 0; margin: 18px 0 0; }
.opt legend { font-weight: 700; margin-bottom: 6px; padding: 0; }
.opt-hint { font-weight: 400; color: var(--c-muted); font-size: 14px; }
.opt label { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.opt label span:first-of-type { flex: 1; }
.opt input { width: 20px; height: 20px; accent-color: var(--c-primary); }
.opt-price { color: var(--c-muted); font-variant-numeric: tabular-nums; }
.opt.inline { display: flex; gap: 16px; flex-wrap: wrap; }
.opt.inline legend { width: 100%; }
.opt.inline label { border: 0; padding: 4px 0; }
.sheet .field { margin-top: 18px; }

/* ---------------------------------------------------------------- суммы и раунды (официант, гость) */
.sum-row { display: flex; justify-content: space-between; padding: 6px 0; font-variant-numeric: tabular-nums; }
.sum-row.total { font-weight: 700; font-size: 18px; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; }
.sum-row.accent { color: var(--c-primary); border-top: 0; margin-top: 0; }
.round { padding: 12px 0; border-bottom: 1px solid var(--line); }
.round-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; margin-bottom: 6px; }
.round ul { list-style: none; padding: 0; margin: 0; }
.round li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.round small { color: var(--c-muted); }

/* Гостевое меню — в guest.css. */

/* ---------------------------------------------------------------- инструменты персонала */
.tool { background: #F6F6F4; }
.tool .sheet-title { font: 700 22px/1.25 var(--f-body); }
.block .empty { padding: 2px 0 8px; }
.tool-head { display: flex; align-items: center; gap: 12px; padding: 14px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.tool-head h1 { font-size: 20px; margin: 0; }
.tool-head .btn { margin-left: auto; }
.tabs { display: flex; gap: 4px; padding: 0 16px; background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 14px 12px; min-height: 48px; color: var(--c-muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs button[aria-selected="true"] { color: var(--c-text); border-color: var(--c-primary); }
.login { max-width: 320px; margin: 10vh auto; text-align: center; padding: 0 20px; }
.login h1 { font-size: 24px; margin: 0 0 4px; }
.login-hint { color: var(--c-muted); margin: 0 0 20px; }
.login-error { color: var(--danger); min-height: 24px; margin: 8px 0; }
.pin-dots { display: flex; justify-content: center; gap: 14px; }
.pin-dots span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--c-text); }
.pin-dots span.on { background: var(--c-text); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keypad button { height: 64px; border-radius: var(--radius-m); border: 1px solid var(--line); background: #fff; font-size: 24px; }
.staff-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; padding: 20px; max-width: 1200px; margin: 0 auto; }
.staff .tabs { display: none; }
.staff-grid h2, .block h2 { font-size: 15px; color: var(--c-muted); font-weight: 700; margin: 0 0 10px; }
.block { margin-bottom: 24px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px 16px; margin-bottom: 10px; }
.card.call { border-left: 4px solid var(--c-accent); }
.card.call.late { border-left-color: var(--danger); background: #FFF5F4; }
.card-head { display: flex; justify-content: space-between; gap: 8px; }
.card p { margin: 6px 0 0; }
.card-actions { display: flex; gap: 8px; margin-top: 12px; }
.lines { list-style: none; padding: 0; margin: 8px 0 0; }
.lines li { padding: 3px 0; }
.lines small { display: block; color: var(--c-muted); padding-left: 24px; }
.lines small.warn { color: var(--warn); }
.tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.table-tile { display: grid; gap: 2px; text-align: left; padding: 12px; min-height: 78px; border-radius: var(--radius-m); border: 1px solid var(--line); background: #fff; }
.tile-num { font-size: 26px; font-weight: 700; line-height: 1; }
.tile-state { font-size: 13px; color: var(--c-muted); }
.table-tile.t-open { border-color: var(--c-primary); box-shadow: inset 0 0 0 1px var(--c-primary); }
.table-tile.t-bill_requested { background: #FBF3E4; border-color: var(--c-accent); }
.table-tile.t-bill_requested .tile-state { color: var(--warn); font-weight: 700; }
.close-box { margin-top: 16px; padding-top: 8px; }
.form-row { display: flex; gap: 10px; align-items: end; margin-top: 12px; }
.form-row .field { flex: 1; margin: 0; }
.close-box .btn.wide { margin-top: 16px; }
@media (max-width: 760px) {
  .staff .tabs { display: flex; }
  .staff-grid { grid-template-columns: 1fr; padding: 16px; }
  .staff-grid[data-tab="now"] .col-tables, .staff-grid[data-tab="tables"] .col-now { display: none; }
  .col-tables h2 { display: none; }
}

/* ---------------------------------------------------------------- кухня (тёмная) */
body.kds { background: #15191A; color: #ECEDEA; --line: rgba(255, 255, 255, .14); }
.kds .login .keypad button { background: #22282A; color: #ECEDEA; }
.kds .pin-dots span { border-color: #ECEDEA; }
.kds .pin-dots span.on { background: #ECEDEA; }
.kds-head { display: flex; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.kds-head h1 { margin: 0; font-size: 20px; }
.kds-head .btn { margin-left: auto; color: #ECEDEA; }
.kds-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 16px; align-items: start; }
.kds-col h2 { font-size: 16px; color: #A9B0AD; margin: 0 0 12px; }
.kds-count { color: #ECEDEA; }
.kds-card { background: #22282A; border-radius: var(--radius-m); padding: 14px; margin-bottom: 12px; border-top: 4px solid #4C8C6E; }
.kds-card.late { border-top-color: #E0604F; }
.kds-card header { display: flex; justify-content: space-between; align-items: baseline; }
.kds-table { font-size: 22px; font-weight: 700; }
.kds-timer { font-variant-numeric: tabular-nums; font-size: 18px; color: #A9B0AD; }
.kds-card.late .kds-timer { color: #FF8B7B; font-weight: 700; }
.kds-card ul { list-style: none; padding: 0; margin: 10px 0 0; }
.kds-card li { display: flex; gap: 10px; padding: 6px 0; font-size: 18px; border-top: 1px solid var(--line); }
.kds-card li b { min-width: 24px; }
.kds-card li small { display: block; color: #A9B0AD; font-size: 15px; }
.kds-card .kds-note, .kds-comment { color: #F2C46D; }
.kds-comment { margin: 8px 0 0; }
.kds-btn { width: 100%; margin-top: 12px; min-height: 52px; border: 0; border-radius: var(--radius-s); background: #ECEDEA; color: #15191A; font-size: 18px; font-weight: 700; }
.kds-empty { color: #6E7673; }
@media (max-width: 900px) { .kds-board { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- управление */
.admin-main { max-width: 1100px; margin: 0 auto; padding: 20px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-m); padding: 20px; margin-bottom: 20px; }
.panel h2 { font-size: 18px; margin: 0 0 6px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-m); padding: 16px; display: grid; gap: 4px; }
.kpi-label { color: var(--c-muted); font-size: 14px; }
.kpi-value { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi-sub { color: var(--c-muted); font-size: 13px; }
.grid { width: 100%; border-collapse: collapse; font-size: 15px; }
.grid th { text-align: left; color: var(--c-muted); font-weight: 500; font-size: 13px; padding: 8px; border-bottom: 1px solid var(--line); }
.grid td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input[type=search] { flex: 1; min-width: 220px; border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; background: #fff; }
.toolbar p { flex: 1; margin: 0; }
.menu-rows { display: grid; }
.menu-row { display: grid; grid-template-columns: 88px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px 0; border-bottom: 1px solid var(--line); }
.menu-row > .btn { align-self: end; }
.row-fields { display: grid; grid-template-columns: 2fr 2fr 110px auto; gap: 10px; align-items: end; min-width: 0; }
.menu-row.stopped input[name=name_ru] { text-decoration: line-through; color: var(--c-muted); }
.photo-cell { position: relative; display: grid; gap: 6px; justify-items: center; }
.photo-cell img, .photo-empty { width: 88px; height: 88px; border-radius: 12px; object-fit: cover; display: block; }
.photo-empty { display: grid; place-items: center; background: #F3F4F2; border: 1px dashed var(--line); color: var(--c-muted); font-size: 13px; }
.photo-rm { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); font-size: 16px; line-height: 1; padding: 0; }
.photo-btn { font-size: 13px; color: var(--c-primary); font-weight: 600; cursor: pointer; }
.photo-btn.busy { opacity: .5; pointer-events: none; }
.row-more { grid-column: 1 / -1; font-size: 14px; }
.row-more summary { cursor: pointer; color: var(--c-primary); font-weight: 500; padding: 4px 0; }
.more-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 8px; }
.more-grid .wide { grid-column: span 1; }
.field textarea { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 8px 12px; font: inherit; font-size: 15px; color: var(--c-text); background: #fff; width: 100%; resize: vertical; }
.tag-set { grid-column: 1 / -1; border: 0; padding: 0; margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tag-set legend { font-size: 13px; color: var(--c-muted); padding: 0; margin-bottom: 6px; width: 100%; }
.tag-opt input { position: absolute; opacity: 0; }
.tag-opt span { display: inline-block; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 14px; }
.tag-opt input:checked + span { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-primary); }
.tag-opt input:focus-visible + span { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.switch { display: flex; align-items: center; gap: 6px; font-size: 14px; min-height: 44px; }
.switch input { width: 20px; height: 20px; accent-color: var(--c-primary); }
/* Телефонная раскладка редактора меню — в секции «меню в кабинете» ниже. */
.notice { background: #FBF3E4; border-left: 4px solid var(--c-accent); padding: 10px 14px; border-radius: var(--radius-s); }
.upload { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 16px 0; }
.review-head { margin: 16px 0 8px; }
.table-scroll { overflow-x: auto; }
.review input { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 6px 8px; width: 100%; min-width: 240px; background: #fff; }
.review { min-width: 1100px; }
.review td.num input { min-width: 80px; text-align: right; }
.review tr.low { background: #FFF5F4; }
.review tr.low .conf { color: var(--danger); font-weight: 700; }
.review .notes { font-size: 13px; color: var(--c-muted); min-width: 200px; }
.review-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 16px; }
.steps { padding-left: 20px; }
.steps li { margin-bottom: 8px; }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.qr-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-m); padding: 20px; margin: 0; text-align: center; break-inside: avoid; }
.qr { display: grid; place-items: center; min-height: 168px; }
.qr img, .qr canvas { margin: 0 auto; }
.qr-card figcaption { display: grid; gap: 2px; margin-top: 12px; }
.qr-brand { font: 500 24px/1.1 var(--f-display); }
.qr-table { font-size: 18px; font-weight: 700; }
.qr-hint { font-size: 12px; color: var(--c-muted); }
.qr-link { font-size: 13px; }
.table-add { display: flex; gap: 8px; }
.table-add input { width: 90px; border: 1px solid var(--line); border-radius: var(--radius-s); padding: 8px 10px; background: #fff; }
.qr-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; margin-top: 6px; font-size: 13px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--c-primary); text-decoration: underline; font-size: 13px; }
.link-btn:disabled { color: var(--c-muted); text-decoration: none; cursor: not-allowed; }
.link-btn.danger { color: var(--danger); }
.qr-busy { font-size: 12px; color: var(--warn); }
.qr-card.busy { border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }

/* ---------------------------------------------------------------- меню в кабинете (mvp/menu)
   Добавление блюд и разделов, фильтры-чипы, телефонный редактор. Ориентир — docs/design/system.md «Тихая бумага»:
   линия вместо тени, табличные цифры, акцент только на выбранном. Рамка всего, что нажимается, — не меньше 3:1. */
.admin { --m-control: color-mix(in srgb, var(--c-text) 55%, transparent); --m-select: color-mix(in srgb, var(--c-primary) 9%, #fff); }
.m-add { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.m-add svg, .chip.filter svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.m-toolbar .muted { white-space: nowrap; }
.m-toolbar .m-add { margin-left: auto; }
.btn.busy:disabled { opacity: 1; cursor: progress; }

/* Фильтры липнут к верху экрана; на узком экране — лента с горизонтальной прокруткой. */
.m-filters { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; display: flex; gap: 8px; overflow-x: auto;
  margin: -4px -20px 16px; padding: 8px 20px; background: #F6F6F4; box-shadow: 0 1px 0 var(--line); scrollbar-width: none; }
.m-filters::-webkit-scrollbar { display: none; }
.chip.filter { display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 36px; padding: 0 12px; border: 1px solid var(--m-control);
  border-radius: var(--radius-s); background: #fff; color: var(--c-text); font-size: 14px; font-weight: 600; line-height: 20px; }
.chip.filter:hover { background: var(--c-surface); }
.chip.filter[aria-pressed="true"] { border-color: var(--c-primary); background: var(--m-select); color: var(--c-primary); }
.f-count { font-weight: 500; color: var(--c-muted); font-variant-numeric: tabular-nums; }
.chip.filter[aria-pressed="true"] .f-count { color: inherit; }

.m-sec-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.m-sec-head h2 { margin: 0; }
.m-sec-count { color: var(--c-muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.m-sec-head .m-add { margin-left: auto; }
.m-sec-empty { margin: 16px 0 0; font-size: 14px; }
.m-sec, .menu-row { transition: background-color .6s ease-out, border-color .6s ease-out; }
.m-sec.m-fresh { border-color: var(--c-primary); }
.menu-row.m-fresh { background: var(--m-select); }
.m-empty { padding: 40px 20px; text-align: center; background: #fff; border: 1px dashed var(--m-control); border-radius: var(--radius-m); }
.m-empty-t { margin: 0 0 6px; font-size: 18px; font-weight: 700; }
.m-empty .muted { max-width: 44ch; margin: 0 auto 16px; }

/* Строка позиции: цена табличными цифрами, кнопка фото доступна с клавиатуры, удаление — в «Описание, выход, метки». */
.row-fields .price input { text-align: right; font-variant-numeric: tabular-nums; }
.photo-btn { position: relative; }
.photo-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.photo-btn:has(input:focus-visible) { outline: 2px solid var(--c-accent); outline-offset: 2px; border-radius: 4px; }
.row-danger { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.btn.m-del { background: #fff; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 60%, transparent); }
.btn.m-del:hover { background: color-mix(in srgb, var(--danger) 8%, #fff); }
.btn.m-del.armed { background: var(--danger); border-color: var(--danger); color: #fff; }

/* Ошибки у поля: рамка и текст под полем, а не только тост. */
.field.invalid input, .field.invalid textarea { border: 2px solid var(--danger); }
.tag-set.invalid .tag-opt span { border-color: var(--danger); }
.field-err { color: var(--danger); font-size: 13px; font-weight: 500; }
.tag-set .field-err { width: 100%; }

/* Шторки «Новое блюдо» и «Новый раздел». */
.m-sheet .sheet-actions { border-top: 1px solid var(--line); }
.m-form .field > span { color: var(--c-text); font-size: 14px; font-weight: 600; }
.m-form .req { color: var(--danger); font-weight: 600; }
.m-form .field input { border-color: var(--m-control); }
.m-form .field textarea { border-color: var(--m-control); font-size: 16px; }
.m-form [name=price] { text-align: right; font-variant-numeric: tabular-nums; }
.m-form-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; align-items: start; }
.m-form .tag-set { margin-top: 18px; }
.m-form .tag-set legend { color: var(--c-text); font-size: 14px; font-weight: 600; }
.m-form-error { margin: 16px 0 0; padding: 10px 12px; border-left: 3px solid var(--danger); border-radius: var(--radius-s); background: color-mix(in srgb, var(--danger) 10%, #fff); }

@media (max-width: 760px) {
  .m-toolbar input[type=search] { flex-basis: 100%; min-height: 48px; font-size: 16px; }
  .chip.filter { min-height: 44px; padding: 0 14px; }
  .m-add, .row-danger .btn { min-height: 44px; }
  .m-sec { padding: 16px; }
  /* Строка позиции — столбиком: фото с кнопкой, название, цена и наличие рядом, English, подробности. */
  .menu-row { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 16px 0; }
  .photo-cell { display: flex; align-items: center; gap: 12px; }
  .photo-cell img, .photo-empty { width: 72px; height: 72px; }
  .photo-rm { left: 60px; right: auto; }
  .photo-rm::after { content: ""; position: absolute; inset: -10px; }
  .photo-btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border: 1px solid var(--m-control); border-radius: var(--radius-s); background: #fff; font-size: 15px; }
  .row-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
  .row-fields > [data-field="name_ru"] { grid-column: 1 / -1; }
  .row-fields > [data-field="name_en"] { grid-column: 1 / -1; order: 3; }
  .row-fields > .switch { align-self: end; min-height: 48px; font-size: 16px; gap: 10px; }
  .admin .switch input { width: 24px; height: 24px; }
  .row-more { order: 4; grid-column: 1 / -1; }
  .row-more summary { padding: 10px 0; }
  .admin .field input { min-height: 48px; }
  .admin .field textarea { font-size: 16px; }
  .more-grid { grid-template-columns: 1fr; gap: 12px; }
  .admin .tag-opt span { padding: 10px 14px; font-size: 15px; }
  .menu-row > .btn { grid-column: 1 / -1; width: 100%; min-height: 48px; font-size: 16px; }
  .m-sheet .sheet-actions .btn { min-height: 48px; }
}

/* ---------------------------------------------------------------- сводка (пакет «Дашборд»)
   Ориентир — «Тихая бумага» (docs/design/system.md): нейтральные столбики, линия вместо тени, табличные цифры,
   акцент — только у выбранного: чип периода и столбик или клетка под курсором. Цвета — из переменных --c-*. */
.dash {
  --dash-bar: color-mix(in srgb, var(--c-text) 80%, var(--c-background));     /* будни: ≈ 8:1 к листу */
  --dash-bar-we: color-mix(in srgb, var(--c-text) 50%, var(--c-background));  /* выходные: ≥ 3:1, сплошной тон */
  --dash-on: var(--c-accent);
  --dash-grid: color-mix(in srgb, var(--c-text) 9%, transparent);
  --dash-heat: var(--c-primary);
  --dash-soft: color-mix(in srgb, var(--c-text) 4%, transparent);
}
.vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.dash-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 16px; }
.dash-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dash-chips .chip { min-height: 36px; padding: 6px 14px; border: 1px solid var(--line); background: #fff; color: var(--c-text); font-size: 14px; font-weight: 500; }
.dash-chips .chip:hover { border-color: color-mix(in srgb, var(--c-text) 45%, transparent); }
.dash-chips .chip[aria-pressed="true"] { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-primary); font-weight: 600; }
.dash-range { margin: 0; }
.dash-body { transition: opacity .2s; }
.dash-body.is-loading { opacity: .55; pointer-events: none; }   /* прежние цифры держатся до ответа — без скачка вёрстки */

.dash-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dash-kpis .kpi { align-content: start; gap: 6px; }
.dash-kpis .kpi-value { font-size: clamp(20px, 2.4vw, 28px); line-height: 1.15; white-space: nowrap; }
.delta { font-size: 13px; color: var(--c-muted); }
.delta b { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta.up b { color: var(--ok); }
.delta.down b { color: var(--danger); }

.dash-today { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 28px; padding: 12px 16px; margin-bottom: 20px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-m); }
.dash-today h2 { font-size: 15px; margin: 0; }
.dash-today dl { display: flex; flex-wrap: wrap; gap: 6px 24px; margin: 0; }
.dash-today-item { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; }
.dash-today dt { color: var(--c-muted); font-size: 13px; }
.dash-today dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.dash-today .delta { font-weight: 400; }

.dash-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 10px; }
.dash-head h2, .dash-head p { margin: 0; }
.dash-head .dash-note { flex-basis: 100%; }
.dash-sub { margin: 18px 0 6px; font-size: 14px; font-weight: 600; color: var(--c-muted); }
.dash-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 6px 0 0; }
.dash-legend .key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--dash-bar); }
.dash-legend .key:not(:first-child) { margin-left: 8px; }
.dash-legend .key.we { background: var(--dash-bar-we); }
.dash-legend .key.part { background: transparent; box-shadow: inset 0 0 0 1.5px var(--dash-bar); }

.dash-chart { display: block; width: 100%; height: auto; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.dash-chart .axis { font-size: 11px; fill: var(--c-muted); font-variant-numeric: tabular-nums; }
.dash-chart .peak { font-size: 11px; font-weight: 700; fill: var(--c-text); font-variant-numeric: tabular-nums; }
.dash-chart .grid-line { stroke: var(--dash-grid); stroke-width: 1; shape-rendering: crispEdges; }
.dash-chart .grid-line.base { stroke: color-mix(in srgb, var(--c-text) 28%, transparent); }
.dash-chart .bar { fill: var(--dash-bar); }
.dash-chart .bar.we { fill: var(--dash-bar-we); }
.dash-chart .bar.part { fill: var(--c-background); stroke: var(--dash-bar); stroke-width: 1.5; }  /* сегодня и неполная неделя — контуром */
.dash-chart .bar.on { fill: var(--dash-on); stroke: var(--dash-on); }
.dash-chart .hit { fill: transparent; cursor: pointer; outline: none; }
.dash-chart .hit:focus-visible { stroke: var(--c-text); stroke-width: 2; }
.dash-chart .cell.on { stroke: var(--dash-on); stroke-width: 2.5; }
/* Тепловая карта: один тон, от светлого к тёмному, пять ступеней; пустая клетка — нейтральная. */
.dash .h0 { --heat: color-mix(in srgb, var(--c-text) 5%, var(--c-background)); }
.dash .h1 { --heat: color-mix(in srgb, var(--dash-heat) 14%, var(--c-background)); }
.dash .h2 { --heat: color-mix(in srgb, var(--dash-heat) 32%, var(--c-background)); }
.dash .h3 { --heat: color-mix(in srgb, var(--dash-heat) 52%, var(--c-background)); }
.dash .h4 { --heat: color-mix(in srgb, var(--dash-heat) 72%, var(--c-background)); }
.dash .h5 { --heat: color-mix(in srgb, var(--dash-heat) 92%, var(--c-background)); }
.dash-chart .cell { fill: var(--heat); }
.dash-legend .key.heat { margin-left: 0; background: var(--heat); }
.dash-legend .key.heat.gap { margin-left: 10px; box-shadow: inset 0 0 0 1px var(--line); }

.chart-tip { position: fixed; z-index: 70; display: grid; gap: 1px; max-width: min(280px, calc(100vw - 16px)); padding: 8px 12px; pointer-events: none;
  border-radius: var(--radius-s); background: var(--c-text); color: #fff; font-size: 13px; line-height: 1.35;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 8px 24px -8px rgba(0, 0, 0, .3); }
.tip-label { color: rgba(255, 255, 255, .78); }
.tip-value { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tip-note { font-variant-numeric: tabular-nums; }

.dash-cols { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 0 20px; align-items: start; }
.dash-top-scroll { max-height: 380px; overflow-y: auto; overscroll-behavior: contain; }
.dash-top-grid { font-size: 14px; }
.dash-top-grid th { position: sticky; top: 0; z-index: 1; background: #fff; }
.dash-top-grid td { padding: 8px 6px; }
.dash-top-grid td:first-child, .dash-top-grid th:first-child { padding-left: 0; width: 2.2em; }
.dash-top-grid tbody tr:hover { background: var(--dash-soft); }
.top-name { display: block; }
.top-share { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 12px; color: var(--c-muted); font-variant-numeric: tabular-nums; }
.top-bar { flex: 1; max-width: 180px; height: 4px; border-radius: 2px; background: var(--dash-grid); overflow: hidden; }
.top-bar i { display: block; height: 100%; border-radius: 2px; background: var(--dash-bar); }
.top-rev { display: none; margin-left: auto; color: var(--c-text); font-size: 13px; font-weight: 600; white-space: nowrap; }
.dash-table summary { cursor: pointer; padding: 10px 0 0; color: var(--c-primary); font-size: 14px; font-weight: 500; }
.dash-table-scroll { max-height: 320px; overflow: auto; margin-top: 8px; }
.dash-table-scroll th { position: sticky; top: 0; background: #fff; }
.dash code { font-size: 13px; }

@media (max-width: 1000px) { .dash-cols { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .dash-kpis .kpi { padding: 12px; }
  .dash-kpis .kpi-value { font-size: clamp(18px, 5.2vw, 24px); }
  .dash .panel { padding: 16px 14px; }
  .dash-today { gap: 6px 16px; }
  .dash-today dl { gap: 6px 16px; }
}
@media (max-width: 560px) {   /* популярные блюда: название во всю ширину, выручка — строкой под ним */
  .dash-top-grid .top-rev-col { display: none; }
  .top-rev { display: inline; }
  .top-bar { max-width: none; }
}
@media (max-width: 480px) {
  .dash-chips { flex-wrap: nowrap; width: 100%; gap: 4px; }
  .dash-chips .chip { flex: 1 1 auto; padding: 6px 4px; text-align: center; }
}
@media (pointer: coarse) { .dash-chips .chip { min-height: 44px; } }
@media (forced-colors: active) {
  .dash-chart .bar, .dash-chart .cell { stroke: CanvasText; }
  .dash-chart .bar.on, .dash-chart .cell.on { fill: Highlight; }
}

/* ---------------------------------------------------------------- исправления после QA (пакет «qa»)
   Точечные правки сводки, редактора меню и шторок перед показом MVP. Ориентир тот же — «Тихая бумага». */
.chart-tip[hidden] { display: none; }   /* display: grid подсказки перебивал атрибут hidden — плашка висела после ухода с графика */
.dash-kitchen { grid-column: 1 / -1; margin: 0; }   /* показатель за период — под карточками периода, а не в «Сегодня» */
.heat-legend { column-gap: 14px; }
.dash-legend-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }   /* квадратик не отрывается от подписи */
.heat-legend .key.heat.gap { margin-left: 0; }

/* Меню: пустой раздел можно удалить; низ шторки закрыт панелью кнопок целиком. */
.m-sec-empty { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.m-sec-empty p { margin: 0; }
.sheet.m-sheet { padding-bottom: 0; }   /* липкая панель вставала выше нижнего отступа шторки — в щель просвечивали метки */
.m-sheet .sheet-actions { padding-bottom: calc(20px + var(--safe-b)); }
@media (min-width: 761px) {
  /* Место под «Сохранить» занято заранее: при первой правке поля строки не сужаются и не уезжают из-под курсора. */
  .menu-row > [type=submit][hidden] { display: inline-block; visibility: hidden; }
}
@media (max-width: 760px) {
  .m-sec-empty .btn { min-height: 44px; }
}

@media print {
  .tool-head, .tabs, .toolbar, .qr-link, .qr-actions, .qr-busy, #offline { display: none !important; }
  .tool, .admin-main { background: #fff; padding: 0; }
  .qr-grid { grid-template-columns: repeat(2, 1fr); }
  .qr-card { border: 1px dashed #999; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
