/* Ресторан: админка (/admin), официант (/waiter), кухня (/kitchen).
   Системные шрифты и никаких внешних ресурсов — приложения работают в локальной сети без интернета. */

:root {
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Ubuntu, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --line: #e2e5ee;
  --text: #171b26;
  --muted: #646c82;
  --primary: #4338ca;
  --primary-ink: #ffffff;
  --primary-soft: #eceefe;
  --ok: #0b8a4f;
  --ok-soft: #e4f5ec;
  --warn: #b25d00;
  --warn-soft: #fff1dc;
  --bad: #c42b2b;
  --bad-soft: #fdeaea;
  --info: #2257d6;
  --info-soft: #e7eeff;
  --violet: #7c3aed;
  --violet-soft: #f1eaff;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 6px 18px rgba(16, 24, 40, .07);
  --tap: 48px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.boot, .noscript { padding: 32px; color: var(--muted); text-align: center; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1 1 auto; min-width: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------------------------------------------------------------- Кнопки и поля */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-weight: 600; white-space: nowrap; user-select: none;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-soft { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--primary); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn-lg { min-height: 60px; font-size: 18px; padding: 0 24px; }
.btn-block { width: 100%; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  border: 3px solid currentColor; border-color: rgba(255, 255, 255, .9) rgba(255, 255, 255, .9) transparent transparent;
  animation: spin .7s linear infinite;
}
.btn:not(.btn-primary):not(.btn-ok):not(.btn-danger).busy::after { border-color: var(--primary) var(--primary) transparent transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label, .label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field .hint { font-size: 13px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: var(--tap); padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); outline: none;
}
.textarea { min-height: 84px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; font-weight: 500; }
.check input { width: 22px; height: 22px; accent-color: var(--primary); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
.seg { display: inline-flex; padding: 4px; gap: 4px; background: var(--surface-2); border-radius: 12px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; min-height: 40px; padding: 0 14px; border-radius: 9px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------------------------------------------------------------- Карточки, списки, метки */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-h h2 { font-size: 18px; }
.sub { font-size: 14px; color: var(--muted); }
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--line); }
.list-row:first-child { border-top: 0; }
.list-row .t { font-weight: 600; }
.list-row .s { font-size: 13px; color: var(--muted); }
.list-row.off { opacity: .55; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.violet { background: var(--violet-soft); color: var(--violet); }
.empty { padding: 28px 12px; text-align: center; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .k { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat .v { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; }
.stat .v small { font-size: 14px; font-weight: 600; color: var(--muted); }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.data td { padding: 10px; border-bottom: 1px solid var(--line); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 8px; }
.bar { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; min-width: 0; height: 100%; }
.bar i { display: block; width: 100%; max-width: 46px; background: var(--primary); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.bar span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.meter { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }

/* ---------------------------------------------------------------- Модальное окно и уведомления */
.modal-layer { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(10, 14, 25, .5); }
.modal {
  position: relative; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--surface); color: var(--text); border-radius: 18px; padding: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.modal.wide { width: min(860px, 100%); }
.modal h2 { font-size: 20px; margin-bottom: 6px; }
.modal .sub { margin-bottom: 16px; }
.modal-x { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--surface-2); font-size: 22px; line-height: 1; }
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translate(-50%, calc(100% + 40px));
  max-width: min(560px, calc(100vw - 32px)); padding: 14px 18px; border-radius: 14px;
  background: #1b2030; color: #fff; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  transition: transform .25s ease, opacity .25s ease, visibility .25s; pointer-events: none; opacity: 0; visibility: hidden;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.toast.bad { background: var(--bad); }
.toast.ok { background: var(--ok); }
.banner { margin: 0 24px 0; padding: 12px 16px; border-radius: 12px; background: var(--warn-soft); color: #6b3b00; font-weight: 600; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.banner.bad { background: var(--bad-soft); color: #7a1414; }
.banner .grow { min-width: 200px; }

/* ---------------------------------------------------------------- Вход по PIN */
.login-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-box { width: min(760px, 100%); }
.login-head { text-align: center; margin-bottom: 18px; }
.login-head img { width: 64px; height: 64px; }
.login-head h1 { font-size: 26px; margin-top: 8px; }
.login-head .sub { margin-top: 4px; }
.staff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.staff-tile {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 10px; min-height: 120px;
  border: 2px solid var(--line); border-radius: var(--radius); background: var(--surface); font-weight: 700;
}
.staff-tile.on { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.staff-tile .role { font-size: 13px; font-weight: 600; color: var(--muted); }
.avatar { width: 52px; height: 52px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; background: var(--primary); flex: none; }
.avatar.sm { width: 36px; height: 36px; font-size: 14px; }
.avatar.waiter { background: #0f766e; }
.avatar.cook { background: #c2410c; }
.avatar.admin { background: #4338ca; }
.avatar.owner { background: #7c3aed; }
.avatar.seller { background: #2563eb; }
.pin-box { margin: 18px auto 0; width: min(340px, 100%); text-align: center; }
.pin-dots { display: flex; justify-content: center; gap: 12px; height: 28px; margin: 12px 0 16px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--muted); }
.pin-dots i.on { background: var(--text); border-color: var(--text); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pin-pad button { min-height: 64px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-size: 26px; font-weight: 700; }
.pin-pad button:active { background: var(--surface-2); }
.pin-error { color: var(--bad); font-weight: 600; min-height: 24px; margin-top: 10px; }
.login-foot { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.demo-hint { margin: 12px auto 0; padding: 10px 14px; border-radius: 12px; background: var(--info-soft); color: var(--info); font-weight: 600; text-align: center; max-width: 520px; }

/* ---------------------------------------------------------------- Чек (экран и печать из браузера) */
.receipt { font-family: var(--mono); font-size: 13px; line-height: 1.35; color: #000; background: #fff; width: 100%; max-width: 360px; margin: 0 auto; padding: 12px; border: 1px dashed #bbb; }
.receipt .rl { white-space: pre-wrap; word-break: break-word; }
.receipt .rl.c { text-align: center; }
.receipt .rl.r { text-align: right; }
.receipt .rl.b { font-weight: 800; }
.receipt .rl.t { font-size: 1.45em; line-height: 1.25; }
.receipt .rl.l { font-size: 1.9em; line-height: 1.15; }
.receipt .rl.inv { background: #000; color: #fff; padding: 0 4px; }
.receipt .rrow { display: flex; justify-content: space-between; gap: 10px; }
.receipt .rrow span:last-child { white-space: nowrap; }
.receipt .rule { overflow: hidden; white-space: nowrap; }
.receipt .feed { height: 1em; }
.print-frame { position: fixed; width: 0; height: 0; border: 0; right: 0; bottom: 0; visibility: hidden; }

/* ================================================================ Админка */
body.app-admin { --primary: #4338ca; --primary-soft: #eceefe; }
.admin-shell { display: flex; min-height: 100vh; }
.admin-side {
  width: 248px; flex: none; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: #141a2e; color: #cfd5e8; display: flex; flex-direction: column; padding: 16px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { color: #fff; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-text span { font-size: 12px; color: #9aa3c0; }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-nav a, .bottom-nav a {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px;
  color: inherit; text-decoration: none; font-weight: 600;
}
.side-nav a:hover { background: rgba(255, 255, 255, .06); }
.side-nav a.on { background: #2b3557; color: #fff; }
.side-nav svg, .bottom-nav svg { width: 20px; height: 20px; flex: none; }
.side-nav .count { margin-left: auto; background: var(--bad); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 7px; }
.side-foot { border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.side-foot .btn { min-height: 40px; background: transparent; color: #cfd5e8; border-color: rgba(255, 255, 255, .15); }
.admin-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.admin-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px 12px; flex-wrap: wrap; }
.admin-top h1 { font-size: 26px; letter-spacing: -.02em; }
.eyebrow { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-view { padding: 12px 24px 40px; outline: none; }
.bottom-nav { display: none; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-2 > .card + .card { margin-top: 0; }
.dish-row .price { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cat-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; min-height: 38px; padding: 0 14px; font-weight: 600; }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.toggle-stop { min-width: 92px; }
.token-box { font-family: var(--mono); font-size: 15px; word-break: break-all; padding: 12px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--line); user-select: all; }
.log-row .s { white-space: normal; }
.mode-badge { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.mode-badge.local { background: var(--ok-soft); color: var(--ok); }
.mode-badge.online { background: var(--info-soft); color: var(--info); }

@media (max-width: 900px) {
  .admin-side { display: none; }
  .admin-top { padding: 14px 16px 8px; }
  .admin-top h1 { font-size: 22px; }
  .admin-view { padding: 8px 16px 96px; }
  .banner { margin: 0 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: #141a2e; color: #cfd5e8;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); overflow-x: auto; gap: 2px;
  }
  .bottom-nav a { flex-direction: column; gap: 2px; font-size: 11px; min-width: 64px; padding: 6px 4px; justify-content: center; flex: 1 0 auto; }
  .bottom-nav a.on { background: #2b3557; color: #fff; }
}
@media (max-width: 520px) { .row2 { grid-template-columns: 1fr; } }

/* ================================================================ Официант */
body.app-waiter { --primary: #0f766e; --primary-soft: #dff3ef; --bg: #f2f6f5; --tap: 54px; font-size: 17px; }
.waiter-shell { min-height: 100vh; display: flex; flex-direction: column; }
.w-top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); background: var(--surface); border-bottom: 1px solid var(--line);
}
.w-back { width: 52px; height: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-size: 26px; flex: none; }
.w-back::before { content: "‹"; font-weight: 700; }
.w-title { flex: 1; min-width: 0; }
.w-title h1 { font-size: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-net { padding: 6px 12px; border-radius: 99px; background: var(--bad-soft); color: var(--bad); font-weight: 700; font-size: 14px; }
.w-who { display: flex; align-items: center; gap: 8px; border: 0; background: var(--surface-2); border-radius: 99px; padding: 4px 14px 4px 4px; font-weight: 700; min-height: 48px; }
.w-view { flex: 1; padding: 14px 14px 120px; outline: none; }
.w-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; display: flex; gap: 10px; align-items: center;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line);
  box-shadow: 0 -6px 18px rgba(16, 24, 40, .08);
}
.w-bar .total { flex: 1; min-width: 0; }
.w-bar .total b { display: block; font-size: 22px; }
.w-bar .total span { font-size: 14px; color: var(--muted); }
.w-filters { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; color: var(--muted); margin-left: auto; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; }
.tables-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.t-tile {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  min-height: 132px; padding: 14px; border-radius: 18px; border: 2px solid transparent; box-shadow: var(--shadow);
}
.t-tile .n { font-size: 34px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.t-tile .st { font-weight: 700; font-size: 15px; }
.t-tile .meta { font-size: 14px; opacity: .85; }
.t-tile .sum { margin-top: auto; font-weight: 800; font-size: 17px; }
.t-free { background: #ffffff; border-color: #b8e2cf; color: #0b5d3b; }
.t-free .st::before { content: "● "; color: var(--ok); }
.t-busy { background: #fff3db; border-color: #f2c76e; color: #6b3d00; }
.t-bill { background: #ede5ff; border-color: #b69af5; color: #4b1fa8; }
.t-tile .ready {
  position: absolute; top: 10px; right: 10px; padding: 4px 10px; border-radius: 99px; background: var(--ok); color: #fff;
  font-weight: 800; font-size: 14px; animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(11, 138, 79, .18); } }
.order-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr); gap: 16px; align-items: start; }
.menu-cats { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; }
.menu-cats .chip { min-height: 48px; padding: 0 18px; font-size: 16px; flex: none; }
.dish-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.dish-btn {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left;
  min-height: 104px; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow);
}
.dish-btn .dn { font-weight: 700; font-size: 16px; line-height: 1.25; }
.dish-btn .dp { margin-top: auto; font-weight: 800; color: var(--primary); }
.dish-btn .dq { position: absolute; top: -8px; right: -6px; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 99px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; }
.dish-btn.stop { background: repeating-linear-gradient(-45deg, #f6f6f8, #f6f6f8 10px, #eeeef2 10px, #eeeef2 20px); color: var(--muted); cursor: not-allowed; }
.dish-btn.stop .dp::after { content: " · СТОП"; color: var(--bad); }
.search { position: relative; margin-bottom: 10px; }
.search .input { padding-left: 44px; font-size: 17px; }
.search::before { content: "⌕"; position: absolute; left: 14px; top: 50%; transform: translateY(-52%); font-size: 22px; color: var(--muted); }
.order-panel { position: sticky; top: 84px; }
.o-line { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.o-line:first-child { border-top: 0; }
.o-line .nm { font-weight: 700; }
.o-line .cm { font-size: 14px; color: var(--warn); font-weight: 600; }
.o-line .pr { font-size: 14px; color: var(--muted); }
.o-line.cancelled .nm { text-decoration: line-through; color: var(--muted); }
.o-line.ready { background: var(--ok-soft); margin: 0 -10px; padding: 10px; border-radius: 10px; border-top-color: transparent; }
.qty { display: inline-flex; align-items: center; gap: 4px; }
.qty button { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 22px; font-weight: 700; }
.qty b { min-width: 28px; text-align: center; font-size: 18px; }
.st-pill { font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.st-new { background: var(--info-soft); color: var(--info); }
.st-cooking { background: var(--warn-soft); color: var(--warn); }
.st-ready { background: var(--ok); color: #fff; }
.st-served { background: var(--surface-2); color: var(--muted); }
.st-cancelled { background: var(--bad-soft); color: var(--bad); }
.batch-h { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 14px 0 2px; }
.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 10px 0 16px; }
.pay-btn { min-height: 84px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); font-size: 20px; font-weight: 800; }
.pay-btn.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.cash-quick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.big-total { font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.change { font-size: 20px; font-weight: 700; color: var(--ok); margin-top: 8px; }
@media (max-width: 820px) {
  .order-layout { grid-template-columns: 1fr; }
  .order-panel { position: static; }
  .w-view { padding: 10px 10px 130px; }
  .tables-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* ================================================================ Кухня (KDS) */
body.app-kitchen {
  --bg: #0b0f14; --surface: #151b23; --surface-2: #1f2731; --line: #2a3442; --text: #f3f6fa; --muted: #9aa7b8;
  --primary: #f97316; --primary-soft: #3a2413; --ok: #22c55e; --ok-soft: #12301f; --warn: #f59e0b; --warn-soft: #3a2a0b;
  --bad: #ef4444; --bad-soft: #3b1414; --info: #60a5fa; --info-soft: #132a45; --shadow: none;
  color-scheme: dark; font-size: 20px; overflow: hidden;
}
.app-kitchen .login-view { overflow: auto; height: 100vh; }
.app-kitchen .staff-tile, .app-kitchen .pin-pad button { background: var(--surface); color: var(--text); }
.app-kitchen .modal { background: var(--surface); }
.kds-shell { height: 100vh; display: flex; flex-direction: column; }
.kds-top { display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-bottom: 1px solid var(--line); flex: none; }
.kds-brand { display: flex; align-items: baseline; gap: 14px; }
.kds-brand strong { font-size: 24px; }
.kds-clock { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; }
.kds-alerts { flex: 1; min-width: 0; display: flex; gap: 8px; overflow: hidden; }
.kds-alert { padding: 8px 14px; border-radius: 12px; font-weight: 800; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kds-alert.bad { background: var(--bad); color: #fff; animation: blink 1s step-start infinite; }
.kds-alert.warn { background: var(--warn); color: #1b1200; }
.kds-alert.info { background: var(--info-soft); color: var(--info); }
.kds-actions { display: flex; gap: 8px; flex: none; }
.kds-btn { min-height: 52px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font-weight: 700; font-size: 17px; }
.kds-btn[aria-pressed="true"] { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.kds-board { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 12px; }
.kds-col { display: flex; flex-direction: column; min-height: 0; background: #0f141b; border-radius: 16px; border: 1px solid var(--line); }
.kds-col-h { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; font-size: 24px; font-weight: 900; text-transform: uppercase; letter-spacing: .03em; border-bottom: 3px solid; }
.kds-col-h b { font-size: 28px; padding: 0 12px; border-radius: 10px; background: var(--surface-2); }
.kds-col.new .kds-col-h { border-color: var(--info); color: var(--info); }
.kds-col.cooking .kds-col-h { border-color: var(--warn); color: var(--warn); }
.kds-col.ready .kds-col-h { border-color: var(--ok); color: var(--ok); }
.kds-cards { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.kcard { background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.kcard.fresh { animation: arrive 1.2s ease-out 3; }
@keyframes arrive { 0% { box-shadow: 0 0 0 0 rgba(96, 165, 250, .9); } 100% { box-shadow: 0 0 0 16px rgba(96, 165, 250, 0); } }
.kcard-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.kcard-no { font-size: 30px; font-weight: 900; line-height: 1.05; }
.kcard-no small { display: block; font-size: 16px; font-weight: 800; color: var(--warn); text-transform: uppercase; }
.kcard-table { font-size: 26px; font-weight: 900; color: #fff; background: var(--surface-2); border-radius: 12px; padding: 4px 12px; white-space: nowrap; }
.kcard-meta { color: var(--muted); font-size: 17px; margin-top: 4px; }
.ktimer { font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; padding: 2px 12px; border-radius: 10px; background: var(--ok-soft); color: var(--ok); white-space: nowrap; }
.ktimer.warn { background: var(--warn); color: #1b1200; }
.ktimer.over { background: var(--bad); color: #fff; animation: blink 1s step-start infinite; }
.ktimer.done { background: var(--surface-2); color: var(--muted); }
@keyframes blink { 50% { opacity: .55; } }
.kitems { list-style: none; margin: 10px 0 0; padding: 0; }
.kitem { display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; margin-top: 6px; border-radius: 12px; border: 2px solid transparent; background: var(--surface-2); color: var(--text); font-size: 24px; font-weight: 800; line-height: 1.2; }
.kitem .q { flex: none; min-width: 52px; }
.kitem .nm { flex: 1; min-width: 0; }
.kitem .cm { display: block; margin-top: 4px; font-size: 19px; font-weight: 900; color: #1b1200; background: var(--warn); border-radius: 8px; padding: 2px 8px; }
.kitem .ks { flex: none; font-size: 14px; font-weight: 800; padding: 4px 8px; border-radius: 8px; text-transform: uppercase; }
.kitem.cooking { border-color: var(--warn); }
.kitem.cooking .ks { background: var(--warn); color: #1b1200; }
.kitem.ready { border-color: var(--ok); }
.kitem.ready .ks { background: var(--ok); color: #04210f; }
.kitem.new .ks { background: var(--info-soft); color: var(--info); }
.kitem.served { opacity: .45; }
.kitem.cancelled { opacity: .7; text-decoration: line-through; border-color: var(--bad); }
.kitem.cancelled .ks { background: var(--bad); color: #fff; text-decoration: none; }
.kcomment { margin-top: 10px; padding: 8px 12px; border-radius: 10px; background: var(--warn); color: #1b1200; font-weight: 900; font-size: 20px; }
.kcard-a { display: flex; gap: 8px; margin-top: 12px; }
.kcard-a .kds-btn { min-height: 64px; font-size: 20px; flex: 1; }
.kcard-a .go { background: var(--warn); border-color: var(--warn); color: #1b1200; }
.kcard-a .done { background: var(--ok); border-color: var(--ok); color: #04210f; }
.kcard-a .print { flex: 0 0 auto; }
.kds-empty { color: var(--muted); text-align: center; padding: 30px 10px; font-size: 20px; }
.kds-unlock { position: fixed; inset: 0; z-index: 40; background: rgba(5, 8, 12, .92); display: flex; align-items: center; justify-content: center; padding: 20px; }
.kds-unlock-btn { min-height: 120px; padding: 0 40px; border-radius: 24px; border: 0; background: var(--primary); color: #fff; font-size: 30px; font-weight: 900; }
.stop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; max-height: 60vh; overflow: auto; }
.stop-grid button { min-height: 60px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface-2); color: var(--text); font-weight: 700; font-size: 17px; text-align: left; padding: 8px 12px; }
.stop-grid button.on { border-color: var(--bad); background: var(--bad-soft); color: #ffb4b4; }
@media (max-width: 1100px) { body.app-kitchen { font-size: 18px; } .kitem { font-size: 21px; } .kcard-no { font-size: 26px; } .kds-actions .kds-btn { padding: 0 10px; font-size: 15px; } }
@media (max-width: 760px) {
  body.app-kitchen { overflow: auto; }
  .kds-shell { height: auto; min-height: 100vh; }
  .kds-board { grid-template-columns: 1fr; }
  .kds-top { flex-wrap: wrap; }
}

/* ---------------------------------------------------------------- Печать страницы чека */
@media print {
  @page { size: 80mm auto; margin: 2mm; }
  body { background: #fff; }
}
