body { background: var(--bg); }

/* ---------- вход ---------- */
.login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: var(--espresso); position: relative; overflow: hidden;
}
.login::before { content: ''; position: absolute; width: 520px; height: 520px; top: -220px; right: -160px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 106, 43, 0.55), transparent 65%); }
.login::after { content: ''; position: absolute; width: 420px; height: 420px; bottom: -220px; left: -140px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 159, 67, 0.3), transparent 65%); }
.login .card { position: relative; z-index: 1; width: 100%; max-width: 380px; padding: 30px; border-radius: 26px; box-shadow: var(--shadow-lg); }
.login-logo { width: 56px; height: 56px; border-radius: 16px; display: block; margin-bottom: 18px; }
.login h2 { margin: 0 0 4px; font-size: 22px; }
.login[hidden], .layout[hidden] { display: none; }

/* ---------- каркас ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px;
  flex: none;
  background: var(--espresso);
  color: #fff;
  padding: 22px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}
.sidebar::before {
  content: ''; position: absolute; width: 300px; height: 300px; left: -120px; bottom: -160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 106, 43, 0.35), transparent 65%); pointer-events: none;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 22px; position: relative; }
.brand img { width: 40px; height: 40px; border-radius: 12px; }
.brand b { font-family: var(--font-display); font-weight: 600; font-size: 15px; display: block; line-height: 1.2; }
.brand small { color: rgba(255, 255, 255, 0.5); font-size: 12px; font-weight: 600; }
.nav-btn {
  position: relative;
  display: flex; align-items: center; gap: 12px; width: 100%;
  border: 0; background: none; padding: 12px 14px; border-radius: 14px; cursor: pointer; text-align: left;
  font-weight: 700; color: rgba(255, 255, 255, 0.65); transition: all 0.2s;
}
.nav-btn .ic { font-size: 18px; width: 22px; text-align: center; }
.nav-btn:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-btn.active { background: var(--grad); color: #fff; box-shadow: 0 8px 20px rgba(255, 106, 43, 0.3); }
.nav-btn .pill { margin-left: auto; background: #fff; color: var(--accent-dark); border-radius: 999px; font-size: 12px; font-weight: 800; padding: 1px 8px; }
.nav-btn:not(.active) .pill { background: var(--accent); color: #fff; }
.sidebar .bottom { margin-top: auto; position: relative; }
.live { display: flex; align-items: center; gap: 8px; font-size: 13px; color: rgba(255, 255, 255, 0.55); padding: 10px 14px; font-weight: 600; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.live.on i { background: #3fd68b; box-shadow: 0 0 0 4px rgba(63, 214, 139, 0.2); animation: livePulse 2s infinite; }
@keyframes livePulse { 50% { box-shadow: 0 0 0 7px rgba(63, 214, 139, 0.05); } }

.content { flex: 1; padding: 28px 32px 60px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 28px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; align-items: center; }
.chip {
  border: 0; background: var(--surface); border-radius: 999px; padding: 8px 15px; cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--line); font-size: 14px; font-weight: 700; transition: all 0.2s;
}
.chip:hover { box-shadow: inset 0 0 0 1px var(--muted); }
.chip.active { background: var(--grad); color: #fff; box-shadow: 0 6px 14px rgba(255, 106, 43, 0.25); }
.chips input[type=date] { border: 0; box-shadow: inset 0 0 0 1px var(--line); background: var(--surface); border-radius: 999px; padding: 7px 14px; font-weight: 600; }

.notify-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  background: var(--accent-soft); border: 1px solid rgba(255, 106, 43, 0.25);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px;
}

/* ---------- заказы ---------- */
.orders { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 16px; align-items: start; }
.order {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
  display: flex; flex-direction: column; position: relative; overflow: hidden;
  animation: fadeUp 0.3s ease-out both;
}
.order::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--line); }
.order.s-new::before { background: var(--grad); }
.order.s-preparing::before { background: var(--warn); }
.order.s-cancelled { opacity: 0.6; }
.order.fresh { animation: flash 1s ease-out 3; }
@keyframes flash { 50% { box-shadow: 0 0 0 4px var(--accent), var(--shadow); } }
.order-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.order-head b { font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.order-meta { color: var(--muted); font-size: 13px; margin: 4px 0 12px; font-weight: 600; }
.order-items { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 12px; }
.order-items div { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; font-size: 15px; font-weight: 600; }
.order-items div span:last-child { color: var(--muted); font-weight: 600; }
.order-comment { background: var(--warn-soft); border-radius: 12px; padding: 9px 12px; font-size: 14px; margin-bottom: 12px; font-weight: 600; }
.order-badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.order-total { margin-left: auto; font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.order-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.order-actions .btn { padding: 10px 12px; font-size: 14px; flex: 1; }
.badge.neutral { background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }

.calls { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.call {
  display: flex; align-items: center; gap: 14px; background: var(--espresso); color: #fff;
  border-radius: 16px; padding: 10px 10px 10px 16px; animation: flash 1s ease-out 3; font-weight: 600;
}
.call .btn { padding: 8px 14px; font-size: 13px; }

/* ---------- столики ---------- */
.tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.table-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; text-align: center; }
.table-card.inactive { opacity: 0.55; }
.table-card .qr-wrap { background: #fff; border-radius: 16px; padding: 10px; display: inline-block; box-shadow: inset 0 0 0 1px var(--line); }
.table-card img { width: 100%; max-width: 170px; aspect-ratio: 1; display: block; }
.table-card h3 { margin: 12px 0 2px; font-size: 17px; }
.table-card .row { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.table-card .row .btn { padding: 8px 11px; font-size: 13px; }
.url { font-size: 11px; color: var(--muted); word-break: break-all; margin-top: 8px; }
.url a { color: var(--muted); }

/* ---------- меню ---------- */
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
.panel h2 { margin: 0 0 14px; font-size: 17px; }
.cat-list { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-item { display: flex; align-items: center; gap: 2px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); border-radius: 12px; padding: 4px 4px 4px 14px; font-weight: 700; }
.cat-item button { border: 0; background: none; cursor: pointer; padding: 5px 7px; border-radius: 8px; }
.cat-item button:hover:not(:disabled) { background: var(--line); }
.cat-item button:disabled { opacity: 0.3; cursor: default; }

table.grid { width: 100%; border-collapse: collapse; }
table.grid th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 800; padding: 10px; border-bottom: 1px solid var(--line); }
table.grid td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tbody tr { transition: background 0.15s; }
table.grid tbody tr:hover { background: var(--surface-2); }
table.grid tr.off td { opacity: 0.45; }
.thumb { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; font-size: 22px; }
.price-input { width: 110px; border: 1.5px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 10px; font-weight: 700; outline: none; }
.price-input:focus { border-color: var(--accent); }
.icon-btn { border: 0; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.icon-btn:hover { background: var(--line); }
.icon-btn.danger:hover { background: var(--danger-soft); }

.switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 999px; cursor: pointer; transition: 0.2s; }
.switch span::before { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: 0.2s; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::before { transform: translateX(20px); }

/* ---------- статистика ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; position: relative; overflow: hidden; }
.tile .label { color: var(--muted); font-size: 13px; font-weight: 700; }
.tile .value { font-family: var(--font-display); font-size: 24px; font-weight: 600; margin-top: 6px; }
.tile.accent { background: var(--espresso); color: #fff; }
.tile.accent .label { color: rgba(255, 255, 255, 0.6); }
.tile.accent::after { content: ''; position: absolute; width: 180px; height: 180px; right: -70px; top: -80px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 106, 43, 0.6), transparent 65%); }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 220px; padding-top: 24px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bar div { width: 100%; max-width: 44px; background: var(--grad); border-radius: 8px 8px 3px 3px; min-height: 3px; transition: height 0.5s; }
.bar:hover div { filter: brightness(1.1); }
.bar small { font-size: 11px; color: var(--muted); margin-top: 6px; white-space: nowrap; font-weight: 600; }
.bar .v { font-size: 11px; color: var(--muted); margin-bottom: 4px; white-space: nowrap; font-weight: 700; }

/* ---------- модальные окна ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 10, 6, 0.5); z-index: 30; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade 0.2s; }
.modal { background: var(--bg); border-radius: 26px; padding: 26px; width: 100%; max-width: 500px; max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: up 0.25s ease-out; }
.modal h2 { margin: 0 0 6px; font-size: 21px; }
.modal .actions, .panel .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
.check { display: flex; align-items: center; gap: 10px; margin-top: 16px; cursor: pointer; font-weight: 600; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* ---------- печать QR-кодов ---------- */
#printArea { display: none; }
@media print {
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: grid !important; grid-template-columns: 1fr 1fr; gap: 10mm; }
  .print-card { border: 1px dashed #999; border-radius: 6mm; padding: 8mm; text-align: center; break-inside: avoid; color: #000; font-family: var(--font); }
  .print-card img { width: 60mm; height: 60mm; }
  .print-card h2 { margin: 0 0 3mm; font-size: 20pt; }
  .print-card p { margin: 2mm 0 0; font-size: 11pt; }
}

@media (max-width: 820px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; z-index: 10; flex-direction: row; padding: 10px; overflow-x: auto; gap: 6px; scrollbar-width: none; }
  .sidebar::before, .brand, .live { display: none; }
  .sidebar .bottom { margin-top: 0; }
  .nav-btn { white-space: nowrap; width: auto; padding: 10px 14px; }
  .content { padding: 18px 16px 40px; }
  .page-head h1 { font-size: 23px; }
  .hide-sm { display: none; }
}

/* иконки */
.nav-btn .ic .bi { font-size: 18px; }
.thumb .bi { font-size: 20px; color: var(--accent); opacity: 0.7; }
.icon-btn .bi, .cat-item button .bi { font-size: 15px; }
.icon-btn.danger:hover .bi, .cat-item button[data-del-cat]:hover .bi { color: var(--danger); }
.order-meta .bi, .order-comment .bi { margin-right: 2px; }
.call .bi { color: var(--accent-2); margin-right: 4px; }
.notify-banner .bi { font-size: 18px; margin-right: 4px; }

/* оплата по QR */
.order.needs-check { box-shadow: 0 0 0 2px var(--danger), var(--shadow); }
.receipt-btn { border: 0; cursor: pointer; font: inherit; font-size: 12px; font-weight: 800; }
.receipt-btn:hover { box-shadow: inset 0 0 0 1px var(--accent); color: var(--accent-dark); }
.qr-setting { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.qr-preview { width: 170px; height: 170px; background: #fff; border-radius: 16px; padding: 8px; box-shadow: inset 0 0 0 1px var(--line); display: flex; align-items: center; justify-content: center; }
.qr-preview img { max-width: 100%; max-height: 100%; display: block; }
.qr-preview.empty { background: var(--surface-2); flex-direction: column; gap: 8px; text-align: center; color: var(--muted); font-size: 12px; font-weight: 600; padding: 14px; }
.qr-preview.empty .bi { font-size: 40px; }
.qr-actions { display: flex; flex-direction: column; gap: 10px; }

/* язык */
.login-top { display: flex; justify-content: space-between; align-items: flex-start; }
.sidebar .bottom { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; padding-left: 8px; }
.sidebar .bottom .live { padding-left: 6px; }
@media (max-width: 820px) {
  .sidebar .bottom { flex-direction: row; align-items: center; padding-left: 0; margin-left: auto; }
}

/* брони */
.order.booking::before { background: var(--line); }
.order.b-new::before { background: var(--grad); }
.order.b-confirmed::before { background: var(--ok); }
.order.b-cancelled { opacity: 0.6; }
.booking-info a { color: var(--text); text-decoration: none; font-weight: 700; }
.booking-info .bi { color: var(--muted); margin-right: 4px; }
.day-tag { display: inline-block; background: var(--accent-soft); color: var(--accent-dark); border-radius: 6px; padding: 0 7px; margin-right: 6px; font-weight: 800; }
.order .field select { padding: 9px 12px; font-size: 14px; }

/* отзывы */
.review-card.low::before { background: var(--danger); }
.review-card.hidden-review { opacity: 0.55; }
.review-card .order-head { justify-content: flex-start; gap: 10px; }
.review-text { margin: 0 0 14px; line-height: 1.5; white-space: pre-line; }
.tile .stars { font-size: 14px; margin-left: 6px; }
.dist-tile { display: flex; flex-direction: column; justify-content: center; }
.dist-tile .dist-bar { background: var(--line); }

/* сотрудники и отчёты */
.staff-grid { margin-bottom: 18px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.staff-link { display: flex; gap: 18px; align-items: center; }
.staff-link img { width: 140px; height: 140px; border-radius: 12px; background: #fff; padding: 6px; flex: none; }
.staff-link h2 { margin: 0 0 6px; }
.staff-link p { margin: 0 0 8px; }
.staff-link a { word-break: break-all; font-weight: 700; }
.rp-log { margin-top: 14px; }
.rp-log summary { cursor: pointer; font-weight: 800; color: var(--accent-dark); padding: 6px 0; }
table.grid tfoot td { padding: 10px; border-top: 2px solid var(--line); }
@media (max-width: 640px) {
  .staff-link { flex-direction: column; text-align: center; }
}
