/* Альпен Хаус — дизайн-система «альпийский шале» (mobile-first) */
/* Шрифты: Manrope (текст/заголовки, variable 200-800) + Prata (вордмарк), self-hosted */
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 200 800; font-display: swap; src: url('/fonts/manrope-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 200 800; font-display: swap; src: url('/fonts/manrope-cyrillic-ext.woff2') format('woff2'); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 200 800; font-display: swap; src: url('/fonts/manrope-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+2219, U+FEFF, U+FFFD; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 200 800; font-display: swap; src: url('/fonts/manrope-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Prata'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/prata-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Prata'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/prata-cyrillic-ext.woff2') format('woff2'); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: 'Prata'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/prata-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* «Альпийский шале»: сосна + тёплое дерево + снег */
  --bg: #f6f4ee; --card: #ffffff; --card2: #f1ece1; --line: #e2dbc9;
  --text: #1f2a25; --muted: #6d7a71;
  --mint: #0e7f66; --mint-deep: #0a5c4a; --pink: #e0577a; --green: #1d9a57; --red: #d64545; --blue: #3d7fc7;
  --gold: #c08a2e; --amber: #d9a441; /* янтарь/латунь — награды, акценты */
  --selbg: #e5efe8; --okbg: #e4f2e6; --errbg: #fbe9e9; --pinkbg: #fcebf0;
  /* Типографика и возвышение */
  --font-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Prata', 'Manrope', Georgia, serif;
  --sh-xs: 0 1px 2px rgba(31, 42, 37, 0.05);
  --sh-sm: 0 2px 8px rgba(31, 42, 37, 0.07);
  --sh-md: 0 8px 24px rgba(31, 42, 37, 0.13);
  --r-sm: 10px; --r-md: 14px; --r-lg: 18px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--font-body);
  font-size: 16px; line-height: 1.5;
  min-height: 100vh; overscroll-behavior-y: contain;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
button { font: inherit; cursor: pointer; border: 0; border-radius: 12px; }
input, select, textarea {
  font: inherit; color: var(--text); background: #ffffff;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--mint); }

h1, h2, h3 { margin: 0 0 10px; }
a { color: var(--mint-deep); }

/* --- Шапка --- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; row-gap: 6px;
  padding: 12px 16px; background: rgba(246, 244, 238, 0.9); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top > div:first-child { min-width: 0; }
.top .title { font-family: var(--font-display); font-weight: 400; font-size: 19px; letter-spacing: 0.01em; display: flex; align-items: center; gap: 9px; min-width: 0; }
.top .title > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .sub { color: var(--muted); font-size: 13px; }
.top .right { margin-left: auto; flex-wrap: wrap; justify-content: flex-end; row-gap: 4px; }
.top .right > * { flex: 0 0 auto; }
/* Логотип-бейдж (горный пик) */
.brand-mark {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(140deg, #128d72, #0a5c4a);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--sh-sm), inset 0 1px 0 rgba(255,255,255,.25);
}
.brand-mark svg { width: 21px; height: 21px; }
.brand-mark .bm-snow { fill: #ffffff; }
.brand-mark .bm-sun { fill: var(--amber); }

/* --- Пространства Альпен Хаус --- */
.venue-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.venue-card { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 16px; padding: 22px 12px; min-height: 170px; text-align: center; }
.venue-card:active { transform: scale(.98); }
.venue-icon { font-size: 42px; margin-bottom: 10px; }
.venue-name { font-size: 19px; font-weight: 900; }
.venue-desc { color: var(--muted); font-size: 12px; margin-top: 6px; }
.venue-section { margin: 16px 0; }
.place-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.place-card { display: flex; flex-direction: column; justify-content: center; min-height: 62px; padding: 10px; text-align: center; background: var(--card2); color: var(--text); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; }
.place-card span { color: var(--muted); font-size: 11px; margin-top: 4px; }
@media (max-width: 650px) { .venue-cards { grid-template-columns: 1fr; } .place-grid { grid-template-columns: repeat(2, 1fr); } }

/* --- План зала (карта мест) --- */
.hall {
  position: relative; width: 100%; aspect-ratio: 10 / 8; min-height: 280px;
  background:
    repeating-linear-gradient(0deg, transparent 0 35px, rgba(14, 127, 102, 0.05) 35px 36px),
    repeating-linear-gradient(90deg, transparent 0 35px, rgba(14, 127, 102, 0.05) 35px 36px),
    #faf8f2;
  border: 1px solid var(--line); border-radius: 16px;
  overflow: hidden; margin: 0 0 4px;
}
.hall-t {
  position: absolute; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: #ffffff; border: 2px solid #93d3bd; color: var(--text);
  border-radius: 12px; text-decoration: none; font-weight: 800;
  box-shadow: 0 2px 8px rgba(18, 58, 44, 0.10);
  padding: 2px 1px; text-align: center; overflow: hidden;
}
.hall-t:active { transform: scale(0.95); }
.hall-t .nm { font-size: clamp(11px, 2.4vw, 16px); line-height: 1.1; }
.hall-t .sub { font-size: clamp(8px, 1.5vw, 11px); color: var(--muted); font-weight: 700; line-height: 1.15; }
.hall-t.k-bar { border-radius: 9px; background: #ddf3ec; border-color: #7cc9b2; }
.hall-t.k-gazebo { border-radius: 20px; }
.hall-t.k-pool { border-radius: 50%; background: #e9f4fc; border-color: #9cc9e8; }
.hall-t.k-parapet { border-radius: 7px; }
.hall-t.k-lounger { border-radius: 999px; background: #fdf4e3; border-color: #e0c690; }
.hall-t.k-space { border-style: dashed; background: rgba(255, 255, 255, 0.5); box-shadow: none; }
.hall-t.on { border-color: var(--green); background: var(--okbg); }
.hall-t.on .nm { color: #0d7a45; }
.hall-t.pickable { cursor: pointer; }
.hall-t.busy { opacity: .4; filter: grayscale(.3); }
.hall-t.occupied { border-color: #d8a53a; background: #fbf3e0; opacity: .96; }
.hall-t.occupied .nm { color: #8a6a1c; }
.hall-t.occupied .sub { color: #8a6a1c; }
.hall-t .flag {
  position: absolute; top: -8px; right: -6px; font-size: 15px;
  background: #ffffff; border-radius: 50%; padding: 1px; box-shadow: 0 1px 4px rgba(18, 58, 44, 0.25);
}
.hall-t .flag.chatflag { left: -6px; right: auto; }
.hall-zone {
  position: absolute; display: flex; align-items: center; justify-content: center;
  border: 2px dashed #a9ddc9; border-radius: 10px;
  color: var(--muted); background: rgba(221, 242, 233, 0.55);
  font-size: clamp(9px, 1.7vw, 12px); font-weight: 800; letter-spacing: 0.06em;
  text-align: center; overflow: hidden; padding: 2px;
  pointer-events: none; /* зоны-декорации никогда не кликаются */
  user-select: none; -webkit-user-select: none;
}
.hall-zone.stage {
  color: var(--mint-deep); border-style: dashed;
  background: rgba(13, 169, 140, 0.06); border-color: #a7d8c8;
}
.hall-zone.soft {
  border-radius: 999px; border-color: #bfe3d3;
  background: repeating-linear-gradient(45deg, rgba(151, 205, 183, 0.25) 0 8px, rgba(151, 205, 183, 0.5) 8px 16px);
}
.hall-zone.bldg { border-style: solid; background: #dceee6; }
.hall-zone.pool {
  border: 0; border-radius: 26px; color: #1d6d9e;
  background:
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.28) 0 7px, rgba(255, 255, 255, 0) 7px 16px),
    linear-gradient(180deg, #a9dcf3, #7ec4e8);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.45), inset 0 -8px 18px rgba(23, 94, 138, 0.18);
}

/* --- Живые персонажи зала (звукарь/бармен) --- */
.hall-person {
  position: absolute; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1px;
  background: #ffffff; border: 2px solid var(--mint); border-radius: 12px;
  box-shadow: 0 2px 10px rgba(13, 169, 140, 0.28); color: var(--mint-deep);
  padding: 2px; text-align: center; overflow: hidden;
}
.hall-person:active { transform: scale(0.94); }
.hall-person .ic { font-size: clamp(14px, 3vw, 22px); line-height: 1.05; }
.hall-person .nm { font-size: clamp(9px, 1.8vw, 13px); font-weight: 800; line-height: 1.1; }
.hall-person .live { font-size: clamp(7px, 1.3vw, 10px); color: var(--green); font-weight: 700; }
.p-avatar { font-size: 52px; margin: 8px 0 4px; }
.people-bar { display: flex; gap: 8px; margin-bottom: 12px; }
.people-bar .btn { flex: 1; font-size: 15px; }

/* --- Карточки --- */
.wrap { max-width: 720px; margin: 0 auto; padding: 14px 14px 90px; }
.wrap.wide { max-width: 1100px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 14px 16px; margin-bottom: 12px;
  box-shadow: var(--sh-xs);
}
.card h3 { font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.gold { color: var(--mint-deep); }
.big { font-size: 22px; font-weight: 800; }
.center { text-align: center; }

/* --- Кнопки --- */
.btn {
  background: var(--card2); color: var(--text); padding: 12px 18px;
  font-weight: 700; min-height: 48px;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: linear-gradient(135deg, #128d72, #0a5c4a); color: #ffffff; box-shadow: 0 4px 14px rgba(14, 127, 102, 0.28); }
.btn.pink { background: linear-gradient(135deg, #e0577a, #d6496b); color: #fff; }
.btn.green { background: linear-gradient(135deg, #22a563, #168a4e); color: #ffffff; }
.btn.danger { background: transparent; border: 1px solid var(--red); color: var(--red); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn.sm { min-height: 38px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }

/* --- Иконки (инлайн-SVG, stroke=currentColor) --- */
.ic { width: 1.2em; height: 1.2em; flex: 0 0 auto; vertical-align: -0.22em; display: inline-block; }
.btn .ic, .item .ic { vertical-align: -0.18em; }
.tabs .ic { width: 24px; height: 24px; display: block; margin: 0 auto 2px; }
.hall-person .ic { width: clamp(16px, 3.4vw, 26px); height: clamp(16px, 3.4vw, 26px); }
.gn-star .ic, .nps-b .ic { width: 20px; height: 20px; }
.p-avatar .ic { width: 44px; height: 44px; }
.chat-fab .ic { width: 26px; height: 26px; }
.chat-panel-title .ic, .cw-thread-hd .ic { vertical-align: -0.18em; }
.og-ic { width: 22px; height: 22px; }

/* --- Нижняя навигация гостя --- */
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; background: #f4faf7; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  flex: 1; background: none; color: var(--muted); padding: 8px 2px 10px;
  font-size: 11px; font-weight: 700; border-radius: 0; position: relative;
}
.tabs button .ic { display: block; margin-bottom: 3px; }
.tabs button.on { color: var(--mint-deep); }
.tabs button .dot {
  position: absolute; top: 6px; left: calc(50% + 10px);
  width: 9px; height: 9px; border-radius: 50%; background: var(--pink);
}

/* --- Оффлайн --- */
body.offline::after {
  content: '⚡ Нет связи с сервером…';
  position: fixed; top: 0; left: 0; right: 0; z-index: 99;
  background: var(--red); color: #fff; text-align: center;
  font-size: 13px; font-weight: 700; padding: 4px;
}

/* --- Тосты --- */
#toasts { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 100; width: min(92vw, 420px); }
.toast {
  background: #ffffff; border: 1px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 10px 16px; margin-bottom: 8px; text-align: center;
  box-shadow: 0 8px 24px rgba(18, 58, 44, 0.16); font-weight: 600;
  animation: tin 0.25s ease;
}
.toast.err { background: var(--errbg); border-color: var(--red); }
.toast.ok { background: var(--okbg); border-color: var(--green); }
.toast.gone { opacity: 0; transition: opacity 0.3s; }
@keyframes tin { from { opacity: 0; transform: translateY(-8px); } }

/* --- Списки --- */
.lst { display: flex; flex-direction: column; gap: 8px; }
.item {
  background: var(--card2); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 14px; display: flex; align-items: center; gap: 10px;
}
.item .grow { flex: 1; min-width: 0; }
.item .ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Попозиционная готовность (кухня/панель смены): каждая позиция отдельно + своя кнопка «Готово» --- */
.kds-items { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 12px; }
.kds-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 12px; background: var(--card2); border: 1px solid var(--line); border-radius: 12px; }
.kds-item .kds-item-name { flex: 1; min-width: 0; font-size: 17px; font-weight: 700; line-height: 1.3; color: var(--text); overflow-wrap: anywhere; }
.kds-item .kds-ready { flex: 0 0 auto; white-space: nowrap; }
.kds-item.done { border-color: rgba(61, 220, 132, 0.5); background: rgba(61, 220, 132, 0.08); }
.kds-item.done .kds-item-name { color: var(--green); text-decoration: line-through; opacity: 0.8; }
.kds-item .kds-item-state { flex: 0 0 auto; color: var(--green); font-weight: 800; font-size: 14px; white-space: nowrap; }

/* --- Список позиций заказа (панель персонала): читаемая нумерация вместо строки через «·» --- */
.ol { display: flex; flex-direction: column; gap: 3px; margin: 6px 0 2px; }
.ol-item { display: flex; gap: 8px; align-items: baseline; font-size: 15px; line-height: 1.35; color: var(--text); }
.ol-item .num { flex: 0 0 20px; color: var(--muted); text-align: right; }

/* --- Рейтинг --- */
.board .item.me { border-color: var(--mint); background: var(--selbg); }
.rank { font-size: 20px; font-weight: 900; width: 34px; color: var(--muted); }
.rank.r1 { color: #c99700; } .rank.r2 { color: #7fa392; } .rank.r3 { color: #c08a5a; }
.pts { font-weight: 800; font-size: 18px; color: var(--mint-deep); white-space: nowrap; }
.badges-line { font-size: 18px; letter-spacing: 2px; }

/* --- Квиз --- */
.q-opt {
  display: block; width: 100%; text-align: left; background: #ffffff;
  border: 1px solid var(--line); color: var(--text); border-radius: 12px;
  padding: 13px 14px; margin-bottom: 8px; font-weight: 600; min-height: 50px;
}
.q-opt:disabled { opacity: 0.55; }
.q-opt.correct { background: var(--okbg); border-color: var(--green); opacity: 1; }
.q-opt.wrong { background: var(--errbg); border-color: var(--red); }

/* --- Меню (категории + цены) --- */
.mnu-cat { color: var(--muted); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; margin: 16px 0 8px; }
.card > .drinks:first-of-type { margin-top: 4px; }
.drinks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.drinks button {
  background: #ffffff; border: 1px solid var(--line); color: var(--text);
  padding: 10px 10px; min-height: 52px; font-size: 13px; font-weight: 600;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; text-align: left;
}
.drinks button b { color: var(--mint-deep); font-size: 12.5px; font-weight: 800; }
.drinks button.sel { background: var(--selbg); border-color: var(--mint); color: var(--mint-deep); }
.drinks button.stopped { opacity: 0.38; border-style: dashed; }
.drinks button.stopped b { color: var(--red); }

/* --- Меню: сегменты Бар/Кухня + категории-аккордеоны --- */
.seg { display: flex; gap: 8px; margin: 10px 0 12px; }
.seg button {
  flex: 1; min-height: 46px; background: var(--card2); border: 1px solid var(--line);
  color: var(--muted); font-weight: 800; font-size: 15px; border-radius: 12px;
}
.seg button.on { background: var(--selbg); border-color: var(--mint); color: var(--mint-deep); }
.segdot {
  display: inline-block; min-width: 20px; padding: 0 5px; border-radius: 999px;
  background: var(--mint); color: #ffffff; font-size: 12px; font-weight: 800; margin-left: 4px;
}
.age18 {
  margin: 0 0 10px; padding: 9px 12px; border-radius: 10px;
  background: #fdf0f3; border: 1px solid var(--pink); color: #c2365c;
  font-size: 13px; font-weight: 700; text-align: center;
}
.legal { font-size: 14px; line-height: 1.6; color: var(--text); }
.legal p { margin: 8px 0; }
.consent { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0 4px; font-size: 13px; color: var(--muted); line-height: 1.4; text-align: left; }
.consent input { margin-top: 3px; width: 16px; height: 16px; flex: 0 0 auto; }
.consent a { color: var(--mint-deep); font-weight: 700; }
.mnu-group { border: 1px solid var(--line); border-radius: 12px; background: #ffffff; margin: 0 0 8px; }
.mnu-group summary {
  list-style: none; display: flex; align-items: center; gap: 8px;
  padding: 13px 14px; font-weight: 700; font-size: 15px; cursor: pointer;
}
.mnu-group summary::-webkit-details-marker { display: none; }
.mnu-group summary .ell { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mnu-group summary::after { content: '▸'; color: var(--muted); transition: transform 0.15s; }
.mnu-group[open] summary::after { transform: rotate(90deg); }
.mnu-group .selcnt {
  background: var(--mint); color: #ffffff; border-radius: 999px; font-size: 12px;
  font-weight: 800; padding: 1px 8px; flex: 0 0 auto;
}
.mnu-group .drinks { padding: 0 10px 10px; }
.sel-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.sel-chips .chip { cursor: pointer; color: var(--mint-deep); border-color: var(--mint); }

/* --- Общая корзина стола (компания за одним столом) --- */
.cart-sum { border: 1px dashed var(--line); border-radius: 12px; padding: 10px; margin-top: 12px; background: var(--card); }
.cart-by { margin-bottom: 8px; }
.cart-by-hd { display: flex; justify-content: space-between; align-items: center; font-size: 13px; margin-bottom: 4px; }
.cart-line { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 3px 2px; }
.cart-line .ell { flex: 1; min-width: 0; }
.cart-line.me { background: var(--selbg); border-radius: 6px; padding: 3px 6px; }
.cart-x { flex: 0 0 auto; border: 1px solid var(--line); background: #fff; color: var(--red); border-radius: 50%; width: 22px; height: 22px; line-height: 1; cursor: pointer; }
.cart-total { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; font-weight: 800; text-align: right; color: var(--mint-deep); }
.invite-code { font-size: 40px; font-weight: 900; letter-spacing: 10px; color: var(--mint-deep); margin: 8px 0; }

/* --- Посадка (сетка-запас, основной вид — план зала .hall) --- */
.seats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.seat {
  background: var(--card2); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 4px; text-align: center; position: relative; cursor: pointer;
}
.seat:active { transform: scale(0.96); }
.seat .n { font-weight: 900; font-size: 17px; }
.seat.on { border-color: var(--green); background: var(--okbg); }
.seat.on .n { color: #0d7a45; }
.seat .g { font-size: 11px; color: var(--muted); }
.seat .flag { position: absolute; top: -7px; right: -4px; font-size: 14px; }
.seat .flag.chatflag { font-size: 15px; top: -8px; left: -4px; right: auto; }

/* --- Модал карточки стола --- */
.modal { position: fixed; inset: 0; z-index: 90; background: rgba(14, 42, 32, 0.45); overflow-y: auto; padding: 28px 14px 40px; }
.modal-card { max-width: 480px; margin: 0 auto; }
.modal-card h3 { margin-top: 14px; }

/* --- Оверлей «Экран зала» для персонала (кнопка «Караоке») --- */
.karaoke-ov { position: fixed; inset: 0; z-index: 95; background: var(--bg); overflow-y: auto; }
.karaoke-ov-hd { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
.karaoke-ov-hd .title { flex: 1; font-weight: 800; font-size: 16px; }
.karaoke-ov-body { padding: 14px; max-width: 640px; margin: 0 auto; }

/* --- Чат смены --- */
.chat-lst { max-height: 40vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 2px; }
.chat-msg { background: #ffffff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; overflow-wrap: anywhere; }
.chat-msg .small b { color: var(--mint-deep); }

/* --- Переписка с гостями (пузыри) --- */
.gc-lst { max-height: 44vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px; }
.gc-msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 86%; }
.gc-msg.me { align-self: flex-end; align-items: flex-end; }
.gc-bub {
  background: #ffffff; border: 1px solid var(--line); border-radius: 14px 14px 14px 4px;
  padding: 8px 12px; font-size: 15px; overflow-wrap: anywhere;
}
.gc-msg.me .gc-bub { background: var(--selbg); border-color: var(--mint); border-radius: 14px 14px 4px 14px; color: var(--text); }
.item.unread { background: var(--pinkbg); }

/* --- Стоп-лист --- */
.stop-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.stop-item:last-child { border-bottom: 0; }
.stop-item .grow { flex: 1; min-width: 0; }
.stop-item.stopped .grow { text-decoration: line-through; opacity: 0.55; }
.btn.stopbtn { background: var(--errbg); border: 1px solid var(--red); color: var(--red); }
.btn.stopbtn.active { background: var(--red); color: #fff; }
/* свёрнутый блок-аккордеон (не растягивает страницу; раскрыт — когда нужен) */
.stop-box summary { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 800; list-style: none; padding: 2px 0; }
.stop-box summary::-webkit-details-marker { display: none; }
.stop-box summary .ell { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stop-box summary::after { content: '▸'; color: var(--muted); transition: transform 0.15s; }
.stop-box[open] summary::after { transform: rotate(90deg); }
.stop-box summary ~ * { margin-top: 8px; }
details summary { -webkit-tap-highlight-color: transparent; }

/* --- Сворачиваемый блок (посадка/зал) --- */
.fold-hd {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; text-align: left; padding: 4px 0;
}
.fold-title { font-weight: 800; font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.fold-sub { flex: 1 1 auto; min-width: 0; font-size: 13px; color: var(--mint-deep); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fold-arrow { color: var(--mint-deep); font-size: 18px; font-weight: 900; transition: transform 0.15s; }
.fold-body { margin-top: 12px; }

/* --- Стоп-меню: табы по категориям --- */
.cat-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 2px 8px; }
.cat-tab {
  flex: 0 0 auto; min-height: 38px; padding: 7px 13px; border-radius: 999px;
  background: var(--card2); border: 1px solid var(--line); color: var(--muted);
  font-weight: 800; font-size: 13px; white-space: nowrap;
}
.cat-tab:active { transform: scale(0.96); }
.cat-tab.on { background: var(--selbg); border-color: var(--mint); color: var(--mint-deep); }
.cat-tab .cnt { color: var(--pink); font-weight: 900; margin-left: 2px; }

/* --- Заказ вручную (персонал) --- */
.mo-items { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mo-item {
  position: relative; background: #ffffff; border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 8px 9px; font-size: 13px; font-weight: 600; text-align: left;
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-height: 46px;
}
.mo-item:active { transform: scale(0.97); }
.mo-item b { color: var(--mint-deep); font-size: 12px; font-weight: 800; }
.mo-item.sel { background: var(--selbg); border-color: var(--mint); color: var(--mint-deep); }
.mo-item.stopped { opacity: 0.42; border-style: dashed; }
.mo-item.stopped b { color: var(--red); }
.mo-cnt { position: absolute; top: 6px; right: 7px; background: var(--mint); color: #ffffff; border-radius: 999px; font-size: 11px; font-weight: 900; padding: 0 6px; }

/* --- Заметки/оценки гостя (персонал) --- */
.gn-stars { display: flex; gap: 4px; margin-bottom: 8px; }
.gn-star { flex: 1; min-height: 46px; background: none; font-size: 28px; color: var(--line); }
.gn-star.on { color: #eab308; }

/* --- NPS: оценка вечера гостем (0-10) --- */
.nps-row { display: flex; gap: 3px; margin: 10px 0 8px; flex-wrap: wrap; }
.nps-b { flex: 1; min-width: 30px; min-height: 38px; background: var(--card2); border: 1px solid var(--line); border-radius: 9px; font-size: 14px; font-weight: 700; color: var(--muted); }
.nps-b.on { background: var(--selbg); border-color: var(--mint); color: var(--mint-deep); }
.nps-b[data-nps="0"], .nps-b[data-nps="1"], .nps-b[data-nps="2"], .nps-b[data-nps="3"], .nps-b[data-nps="4"], .nps-b[data-nps="5"], .nps-b[data-nps="6"] { color: #d26464; }
.nps-b.on[data-nps="0"], .nps-b.on[data-nps="1"], .nps-b.on[data-nps="2"], .nps-b.on[data-nps="3"], .nps-b.on[data-nps="4"], .nps-b.on[data-nps="5"], .nps-b.on[data-nps="6"] { color: #b23b3b; }
.nps-b.on[data-nps="9"], .nps-b.on[data-nps="10"] { color: #0e7f66; }

/* --- PIN-гейт --- */
.gate {
  position: fixed; inset: 0; z-index: 80; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; gap: 12px;
}
.gate .card { width: min(94vw, 380px); margin: 0; }
.gate input, .gate select { text-align: center; font-size: 20px; letter-spacing: 4px; }

/* --- Аплодисменты --- */
.clap {
  width: 100%; min-height: 84px; border-radius: 18px; font-size: 26px; font-weight: 900;
  background: linear-gradient(135deg, #e0577a, #e8874f); color: #fff;
  box-shadow: 0 6px 30px rgba(240, 86, 140, 0.35);
}
.clap:active { transform: scale(0.96); }
.clap:disabled { background: var(--card2); color: var(--muted); box-shadow: none; }
.clap-count { font-size: 34px; font-weight: 900; text-align: center; color: var(--mint-deep); }

/* --- Табличные панели (диджей/персонал, desktop) --- */
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 800px) { .cols { grid-template-columns: 1fr; } }

/* --- Экран зала --- */
.screen-wrap { max-width: 1200px; margin: 0 auto; padding: 20px; }
.screen-now {
  font-size: clamp(30px, 6vw, 64px); font-weight: 900; text-align: center; padding: 30px 10px;
}
.screen-queue { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.screen-queue .item { min-width: 220px; }
.pulse { animation: pulse 0.5s ease; }
@keyframes pulse { 50% { transform: scale(1.08); } }

/* --- Служебное --- */
.chip { display: inline-block; background: var(--card2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: 12px; color: var(--muted); margin-right: 6px; white-space: nowrap; }
.chip .xtime { white-space: nowrap; }
@media (max-width: 560px) { .chip .xtime { display: none; } }
.spin { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--mint); border-radius: 50%; animation: sp 0.8s linear infinite; margin: 40px auto; }
@keyframes sp { to { transform: rotate(360deg); } }

/* --- Экран зала на ТВ: остаётся тёмным (не слепит в караоке-зале) --- */
body.screen-page {
  --bg: #0d0f14; --card: #171b23; --card2: #1e2430; --line: #2a3140;
  --text: #f2f4f8; --muted: #8b93a3;
  --mint: #2fd4b0; --mint-deep: #6fe6c4; --gold: #2fd4b0; --green: #3ddc84; --red: #ff5252;
  --selbg: #12332b; --okbg: #12351f; --errbg: #3a1a1f;
}
body.screen-page .screen-now .song { color: #6fe6c4; }

/* --- Конфетти на экране (оценка 9-10) --- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i {
  position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 2px;
  animation: conf-fall linear forwards;
}
@keyframes conf-fall { to { transform: translateY(110vh) rotate(720deg); opacity: 0.6; } }

/* --- Шоу-эффекты на экране --- */
.show-ov {
  position: fixed; inset: 0; z-index: 55; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; text-align: center;
  background: rgba(13, 15, 20, 0.92); color: #f2f4f8; animation: tin 0.25s ease;
}
.show-ov .show-big { font-size: clamp(40px, 9vw, 96px); font-weight: 900; }
.show-ov .show-sub { font-size: clamp(22px, 4.5vw, 44px); font-weight: 700; color: #6fe6c4; }
.show-ov.show-challenge .show-sub { color: #eab308; }
.show-ov.show-duel .show-sub { color: #f0568c; }
.show-ov .show-table { font-size: clamp(48px, 11vw, 120px); font-weight: 900; color: #2fd4b0; }
.show-marquee {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
  background: #171b23; border-top: 2px solid #2fd4b0; padding: 14px 0; overflow: hidden;
}
.show-marquee span { display: inline-block; white-space: nowrap; font-size: clamp(20px, 4vw, 36px); font-weight: 800; color: #2fd4b0; padding-left: 100%; animation: marquee 12s linear infinite; }
@keyframes marquee { to { transform: translateX(-100%); } }

/* --- Поздравления на экран --- */
.congrats-stack { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.congrats-item {
  background: linear-gradient(135deg, rgba(240, 86, 140, 0.18), rgba(255, 123, 84, 0.14));
  border: 2px solid #f0568c; color: #f2f4f8; border-radius: 16px; padding: 18px 22px;
  font-size: clamp(20px, 4vw, 36px); font-weight: 800; text-align: center;
}

/* --- Бары в отчёте (топ заказов) --- */
.bar-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.bar-label { flex: 0 0 46%; min-width: 0; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 12px; background: var(--card2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, #128d72, #0a5c4a); border-radius: 999px; }
.bar-val { flex: 0 0 auto; font-size: 13px; font-weight: 800; color: var(--mint-deep); white-space: nowrap; }

/* --- Статистика администратора (staff) --- */
.rgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 700px) { .rgrid { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 8px; text-align: center; }
.kpi .v { font-size: 22px; font-weight: 900; color: var(--gold); }
.kpi .l { font-size: 12px; color: var(--muted); }
.st-scroll { overflow-x: auto; }
table.st { width: 100%; border-collapse: collapse; font-size: 13px; }
table.st th { color: var(--muted); text-align: right; font-size: 11px; text-transform: uppercase; padding: 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.st th:first-child, table.st td:first-child { text-align: left; }
table.st td { padding: 6px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }

/* --- Рекомендации гостю (базовые + ИИ) --- */
.reco-card { border-color: var(--gold); }
.reco-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--card2); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 10px; margin-bottom: 6px; cursor: pointer;
  transition: border-color .12s, background .12s;
}
.reco-item:active { background: var(--selbg); border-color: var(--mint); }
.reco-item .grow { min-width: 0; }
.reco-item b { font-size: 14px; }
.reco-item .muted { font-size: 11.5px; }
.reco-side { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.reco-side .pts { font-size: 13px; font-weight: 800; color: var(--mint-deep); white-space: nowrap; }
.reco-add {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--mint); color: #fff; font-size: 16px; font-weight: 800; line-height: 1;
}
.reco-ai { display: flex; align-items: center; gap: 10px; padding: 8px 2px; color: var(--muted); font-size: 13px; }
.reco-ai .spin { width: 18px; height: 18px; border-width: 2px; margin: 0; display: inline-block; flex: 0 0 auto; }

.reco-name { display: flex; align-items: center; gap: 6px; }
.reco-name b { font-size: 14px; }
.reco-badge { display: inline-block; font-size: 10.5px; font-weight: 800; line-height: 1; padding: 3px 6px; border-radius: 6px; white-space: nowrap; }
.reco-badge.alco { background: var(--pinkbg); color: var(--pink); border: 1px solid var(--pink); }
.reco-badge.soft { background: var(--okbg); color: var(--green); border: 1px solid var(--green); }

/* ИИ-подсказки: «маскот»-аватар робота в градиентной капсуле вместо голого эмодзи */
.ai-orb {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; margin-right: 7px; border-radius: 50%;
  background: linear-gradient(135deg, #a78bfa 0%, #6366f1 58%, #4338ca 100%);
  box-shadow: 0 3px 8px rgba(99, 102, 241, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  font-size: 14px; line-height: 1;
  vertical-align: -6px; flex: 0 0 auto;
}
.ai-orb.sm { width: 18px; height: 18px; margin-right: 4px; font-size: 10px; vertical-align: -3px; }

/* ===== Тёмная тема (по выбору): класс .dark на <html>, переключается в common.js ===== */
html.dark {
  --bg: #141714; --card: #1d221d; --card2: #252b25; --line: #333b34;
  --text: #e8ece6; --muted: #98a59b;
  --mint: #37c49b; --mint-deep: #7fe1c3; --pink: #ff7d9d; --green: #4bd18a; --red: #ff6e6e; --blue: #5aa7f0;
  --gold: #d9a441; --amber: #e3b356;
  --selbg: #1f332b; --okbg: #14301f; --errbg: #3a2024; --pinkbg: #3a2430;
}
html.dark body { background: var(--bg); color: var(--text); }
html.dark .top { background: rgba(20, 23, 20, 0.9); }
html.dark input, html.dark select, html.dark textarea { background: #232923; color: var(--text); }
html.dark .hall {
  background:
    repeating-linear-gradient(0deg, transparent 0 35px, rgba(55, 196, 155, 0.05) 35px 36px),
    repeating-linear-gradient(90deg, transparent 0 35px, rgba(55, 196, 155, 0.05) 35px 36px),
    #171c17;
}
html.dark .hall-t { background: #262c26; border-color: #3a6a5c; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); }
html.dark .hall-t.k-bar { background: #1f332b; border-color: #3d8066; }
html.dark .hall-t.k-pool { background: #1b2420; border-color: #33503f; }
html.dark .hall-t.k-lounger { background: #2a2418; border-color: #6a5b35; }
html.dark .hall-t.k-space { background: rgba(38, 44, 38, 0.5); }
html.dark .hall-t.on .nm { color: var(--green); }
html.dark .hall-t.occupied { border-color: #d8a53a; background: #332a17; }
html.dark .hall-t.occupied .nm, html.dark .hall-t.occupied .sub { color: #e0c06a; }
html.dark .hall-t .flag { background: #262c26; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); }
html.dark .hall-zone { background: rgba(20, 40, 34, 0.5); border-color: #2f5a4c; }
html.dark .hall-zone.bldg { background: #1c2a26; }
html.dark .hall-zone.stage { background: rgba(55, 196, 155, 0.08); border-color: #2f5a4c; }
html.dark .hall-person { background: #262c26; color: var(--mint-deep); box-shadow: 0 2px 10px rgba(55, 196, 155, 0.18); }
html.dark .tabs { background: #171c17; }
html.dark .toast { background: #262c26; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); }
html.dark .q-opt { background: #262c26; }
html.dark .drinks button { background: #262c26; }
html.dark .mnu-group { background: #1d221d; }
html.dark .cart-x { background: #262c26; }
html.dark .chat-msg { background: #262c26; }
html.dark .gc-bub { background: #262c26; }
html.dark .mo-item { background: #262c26; }
html.dark .age18 { background: #2a1820; color: #f08caa; }
html.dark .seat.on .n { color: var(--green); }
html.dark .rank.r2 { color: #8fa8a0; }

/* --- Единый чат-виджет (угол экрана) --- */
.chat-fab {
  position: fixed; right: 16px; bottom: 18px; z-index: 40;
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--mint), var(--mint-deep));
  color: #05231b; border: none; box-shadow: 0 6px 20px rgba(18, 58, 44, 0.32);
  font-size: 26px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
body.has-tabs .chat-fab { bottom: 76px; }
.chat-fab:active { transform: scale(0.94); }
.chat-fab.hidden { opacity: 0; pointer-events: none; transform: scale(0.6); }
.chat-fab-dot {
  position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px;
  padding: 0 5px; border-radius: 10px; background: var(--pink); color: #fff;
  font-size: 12px; font-weight: 800; line-height: 20px; text-align: center;
  border: 2px solid #fff; box-sizing: border-box;
}
.chat-panel {
  position: fixed; z-index: 45; left: 0; right: 0; bottom: 0;
  max-height: 74vh; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 18px 18px 0 0; box-shadow: 0 -8px 40px rgba(18, 58, 44, 0.22);
  opacity: 0; pointer-events: none; transform: translateY(24px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.chat-panel.open { opacity: 1; pointer-events: auto; transform: none; }
.chat-panel-hd {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.chat-panel-title { font-weight: 800; font-size: 16px; flex: 1; }
.chat-panel-close {
  border: none; background: none; color: var(--muted); font-size: 18px;
  cursor: pointer; padding: 2px 6px;
}
.chat-panel-tabs { display: flex; gap: 6px; padding: 8px 12px 0; }
.cw-tab {
  flex: 1; padding: 8px 6px; border-radius: 10px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); font-weight: 700; font-size: 14px;
  cursor: pointer; position: relative;
}
.cw-tab.on { background: var(--selbg); border-color: var(--mint); color: var(--mint-deep); }
.cw-tab-badge {
  display: inline-block; margin-left: 5px; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 9px; background: var(--pink); color: #fff;
  font-size: 12px; line-height: 18px; text-align: center; font-weight: 800;
}
.chat-panel-body { flex: 1; overflow-y: auto; padding: 10px 12px 12px; }
.cw-scroll { max-height: 50vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.cw-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--card2, #ffffff); border: 1px solid var(--line);
  border-radius: 12px; cursor: pointer;
}
.cw-item.unread { border-color: var(--pink); }
.cw-place { font-size: 22px; font-weight: 900; min-width: 46px; }
.cw-grow { flex: 1; min-width: 0; }
.cw-badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--pink); color: #fff; font-size: 12px; font-weight: 800;
  line-height: 20px; text-align: center;
}
.cw-thread-hd { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
@media (min-width: 640px) {
  .chat-panel { left: auto; right: 16px; bottom: 16px; width: 400px; border-radius: 18px; }
}

html.dark .chat-fab-dot { border-color: #171c17; }
html.dark .chat-panel { background: #171c17; box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5); }
html.dark .cw-item { background: #262c26; }
html.dark .cw-tab { background: #1d221d; }
html.dark .cw-tab.on { background: #12332b; }



/* --- Плашка автообновления (checkBuild → offerUpdate): персоналу — кнопка «Обновить» --- */
#upd-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 60;
  display: flex; gap: 12px; align-items: center;
  background: var(--mint-deep); color: #fff;
  padding: 8px 10px 8px 16px; border-radius: var(--r-md);
  box-shadow: var(--sh-md); font-size: 14px; font-weight: 600;
  animation: upd-in 0.25s ease;
}
#upd-bar .btn { color: #fff; background: var(--mint); flex: 0 0 auto; }
#upd-bar span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
#upd-bar .ic { width: 15px; height: 15px; }
@keyframes upd-in { from { transform: translate(-50%, 16px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
html.dark #upd-bar { background: var(--mint); }

/* Количество позиции в меню/корзине гостя («×2» рядом с названием) */
.cart-cnt { color: var(--mint); font-weight: 800; font-size: 13px; white-space: nowrap; }
