/* QWIK Admin–style theme (ref: greed-is-good/QWIK-waiter-call) */
:root {
  --slate-900: #0f172a;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-200: #e2e8f0;
  --emerald-950: #022c22;
  --emerald-900: #064e3b;
  --emerald-800: #065f46;
  --emerald-100: #d1fae5;
  --emerald-50: #ecfdf5;
  --rose-600: #e11d48;
  --danger: #e11d48;
  --accent: #064e3b;
  --slate-100: #f1f5f9;
  --amber-100: #fef3c7;
  --amber-800: #92400e;
  --bg: linear-gradient(180deg, #f4f7f1 0%, #f7f8f4 45%, #eef3ec 100%);
  --mobile-top-bg: #064e3b;
  --mobile-top-border: #047857;
  --card-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  --nav-shadow: 0 10px 20px rgba(15, 23, 42, 0.04);
  --sidebar-w: 280px;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--slate-900);
  background:
    radial-gradient(circle at 20% 0%, rgba(16, 185, 129, 0.09), transparent 30%),
    var(--bg);
  line-height: 1.5;
  overscroll-behavior-y: none;
}

button,
.btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea { font: inherit; }

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.72);
  border-right: 1px solid rgba(226, 232, 240, 0.9);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand-block { padding: 4px 8px; }
.brand-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--emerald-950);
  margin: 0;
}
.brand-sub {
  font-size: 0.8rem;
  color: var(--slate-500);
  margin: 2px 0 0;
}
.brand-venue {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--emerald-900);
  margin: 6px 0 0;
  line-height: 1.25;
  word-break: break-word;
}

.trial-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--emerald-50);
  color: var(--emerald-900);
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.trial-badge.warn {
  background: #fff7ed;
  color: #c2410c;
  border-color: rgba(249, 115, 22, 0.35);
}
.trial-badge.expired {
  background: #fef2f2;
  color: #b91c1c;
  border-color: rgba(225, 29, 72, 0.3);
}
.rental-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--slate-500);
  margin: 4px 0 0;
}
.rental-block {
  margin: 16px 20px 0;
  padding: 24px;
  border-radius: 12px;
  background: linear-gradient(135deg, #fef2f2, #fff7ed);
  border: 1px solid rgba(225, 29, 72, 0.2);
  text-align: center;
}

body.system-blocked { overflow: hidden; }
.system-blocked-overlay {
  position: fixed;
  inset: 0;
  z-index: 11000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(6px);
}
.system-blocked-overlay.hidden { display: none !important; }
.system-blocked-card {
  width: min(480px, 100%);
  padding: 36px 32px 32px;
  border-radius: 16px;
  background: #fff;
  border: 2px solid #e11d48;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  text-align: center;
}
.system-blocked-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e11d48, #be123c);
  color: #fff;
  font-size: 2rem;
  line-height: 72px;
  box-shadow: 0 8px 24px rgba(225, 29, 72, 0.35);
}
.system-blocked-card h2 {
  margin: 0 0 14px;
  font-size: 1.45rem;
  color: var(--slate-900);
}
.system-blocked-detail {
  margin: 0 0 12px;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--slate-600);
}
.system-blocked-phone {
  display: inline-block;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--emerald-800);
  text-decoration: none;
  letter-spacing: 0.01em;
}
.system-blocked-phone:hover {
  text-decoration: underline;
  color: var(--emerald-900);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.pairing-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 20px 12px;
  padding: 10px 16px;
  border-radius: 10px;
  background: linear-gradient(90deg, #fff7ed, #fef3c7);
  border: 1px solid rgba(249, 115, 22, 0.35);
  color: #9a3412;
  font-size: 0.9rem;
  font-weight: 600;
}
.pairing-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f97316;
  animation: pairing-pulse 1.4s ease-in-out infinite;
}
@keyframes pairing-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}
.pairing-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.pairing-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.pairing-login-required {
  margin-top: 8px;
  color: var(--amber-700, #b45309);
  font-size: 0.85rem;
}
.pairing-toggle.is-locked {
  opacity: 0.75;
}

.admin-main { max-width: min(1480px, 100%); width: 100%; }
/* Generic wrapper used by every platform-admin table so wide grids scroll
   horizontally on narrow screens instead of blowing out the page width. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.admin-tab {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--slate-200);
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
}
.admin-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.feat-grid { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 0.75rem; }
.plans-editor { display: flex; flex-direction: column; gap: 16px; margin-top: 12px; }
.plan-edit-card { margin: 0; }
.plan-edit-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 16px; margin-bottom: 12px; }
.plan-edit-meta { margin-bottom: 12px; }
.plan-feat-grid { margin-bottom: 12px; }
.plan-edit-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.feat-chk { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.admin-tenant-search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  margin: 0 0 14px;
}
.admin-tenant-search-row input[type="search"] {
  flex: 1;
  min-width: min(100%, 280px);
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--slate-300);
}
.storage-sort-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--slate-600);
  white-space: nowrap;
}
.storage-sort-label select {
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--slate-300);
  padding: 0 10px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--slate-800, #1e293b);
  background: #fff;
}
.storage-th-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.storage-th-sortable:hover { color: #059669; }
.storage-size-cell { white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 110px; }
.storage-load-cell { white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 110px; }
.storage-legend { margin: 6px 0 12px; line-height: 1.5; }
.storage-pct-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.storage-pct-bar {
  width: 54px;
  height: 5px;
  border-radius: 3px;
  background: var(--slate-100, #f1f5f9);
  overflow: hidden;
  flex-shrink: 0;
}
.storage-pct-fill {
  height: 100%;
  border-radius: 3px;
  background: #94a3b8;
}
.storage-pct-fill.storage-load-mid { background: #d97706; }
.storage-pct-fill.storage-load-high { background: #e11d48; }
.storage-pct-txt { font-size: 0.72rem; }
.storage-pct-txt.storage-load-mid { color: #b45309; font-weight: 600; }
.storage-pct-txt.storage-load-high { color: #e11d48; font-weight: 700; }
.storage-activity-hint { display: block; font-size: 0.68rem; margin-top: 2px; }
.pa-ignore-mid { color: #b45309; font-weight: 600; }
.pa-ignore-high { color: #e11d48; font-weight: 700; }
.tenant-contact-name {
  display: block;
  font-size: 0.78rem;
  margin-top: 4px;
}
.admin-tenants-scroll { overflow-x: auto; }
.admin-tenants-table {
  table-layout: fixed;
  width: 100%;
  min-width: 960px;
  font-size: 0.82rem;
}
.admin-tenants-table .col-venue { width: 12%; }
.admin-tenants-table .col-rental { width: 22%; }
.admin-tenants-table .col-plan { width: 11%; }
.admin-tenants-table .col-feat { width: 40%; }
.admin-tenants-table .col-actions { width: 15%; }
.admin-tenants-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--slate-500);
  white-space: nowrap;
}
.admin-tenants-table td { vertical-align: top; padding: 10px 8px; }
.tenant-row + .tenant-row td { border-top: 1px solid var(--slate-100); }
.tenant-venue-cell .tenant-name { display: block; font-size: 0.9rem; margin-bottom: 2px; }
.tenant-venue-cell .tenant-slug { font-size: 0.75rem; word-break: break-all; }
.tenant-plan-cell { min-width: 0; }
.tenant-plan-cell .field-label,
.rental-field-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--slate-500);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.plan-select {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 6px 8px;
  font-size: 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--slate-200);
  background: #fff;
}
.tenant-feat-grid {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
  max-height: 168px;
  overflow-y: auto;
  padding: 2px 4px 4px 0;
  font-size: 0.72rem;
  line-height: 1.25;
}
.tenant-feat-grid .feat-chk {
  margin: 0;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  background: var(--slate-50, #f8fafc);
  border: 1px solid var(--slate-200, #e2e8f0);
  color: var(--slate-600, #475569);
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.tenant-feat-grid .feat-chk:hover {
  border-color: var(--slate-300, #cbd5e1);
  background: #fff;
}
.tenant-feat-grid .feat-chk:has(input:checked) {
  background: var(--emerald-50, #ecfdf5);
  border-color: rgba(5, 150, 105, 0.35);
  color: #047857;
  font-weight: 600;
}
.tenant-feat-grid .feat-chk input[type="checkbox"] {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: #059669;
  flex-shrink: 0;
}
.tenant-actions-cell { min-width: 0; }
.tenant-actions-cell .btn-block { width: 100%; margin-bottom: 6px; }
.tenant-actions-mini {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.tenant-actions-mini .btn { padding: 4px 6px; font-size: 0.7rem; min-height: 28px; }
.rental-cell { min-width: 0; }
.rental-summary { margin-bottom: 6px; line-height: 1.35; font-size: 0.78rem; }
.rental-mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}
.rental-mode-btn {
  flex: 1 1 auto;
  padding: 4px 8px;
  font-size: 0.68rem;
  border: 1px solid var(--slate-200);
  border-radius: 6px;
  background: #fff;
  color: var(--slate-700);
  cursor: pointer;
  white-space: nowrap;
}
.rental-mode-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.rental-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(5, 150, 105, 0.06);
  border: 1px solid rgba(5, 150, 105, 0.28);
}
.rental-panel .rental-field-label {
  margin: 0;
  flex: 0 0 auto;
}
.rental-days-input {
  width: 3.6rem;
  padding: 4px 6px;
  font-size: 0.78rem;
  flex: 0 0 auto;
}
.rental-date-input {
  flex: 1 1 8rem;
  min-width: 0;
  padding: 4px 6px;
  font-size: 0.78rem;
}
.rent-expired { color: #e11d48; font-weight: 600; }
.bridge-status { margin: 8px 0; font-size: 0.85rem; }
.bridge-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.ok-text { color: #059669; }
.warn-text { color: #d97706; }

.nav-list { display: flex; flex-direction: column; gap: 6px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.8);
  color: var(--slate-600);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  box-shadow: var(--nav-shadow);
  transition: 0.15s ease;
}
.nav-item:hover {
  border-color: #a7f3d0;
  color: var(--emerald-950);
}
.nav-item.active {
  border-color: var(--emerald-900);
  background: var(--emerald-950);
  color: #fff;
  box-shadow: 0 10px 24px rgba(2, 44, 34, 0.2);
}
.nav-icon { font-size: 1.1rem; width: 22px; text-align: center; }

.sidebar-footer {
  border-top: 1px solid var(--slate-200);
  padding-top: 16px;
  font-size: 0.8rem;
  color: var(--slate-500);
}
.sidebar-footer a {
  color: var(--emerald-900);
  font-weight: 600;
  text-decoration: none;
}

/* Main */
.main-area {
  flex: 1;
  min-width: 0;
  padding: 24px 28px 40px;
  animation: fade-up 0.35s ease-out;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.page-header h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--slate-900);
}
.page-header p {
  margin: 6px 0 0;
  color: var(--slate-500);
  font-size: 0.95rem;
  max-width: 560px;
}
.page-header-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge.ok { background: var(--emerald-100); color: var(--emerald-900); }
.badge.off { background: #fee2e2; color: #991b1b; }
.badge.rent { background: var(--amber-100); color: var(--amber-800); }
.badge.pending { background: #fef9c3; color: #854d0e; }
.badge.confirmed { background: var(--emerald-100); color: var(--emerald-900); }
.badge.cancelled { background: #fee2e2; color: #991b1b; }
.badge.func-call { background: #dbeafe; color: #1e40af; }
.badge.func-bill { background: #fef3c7; color: #92400e; }
.badge.func-menu { background: #ede9fe; color: #5b21b6; }
.badge.func-order { background: #fce7f3; color: #9d174d; }
.badge.func-cancel { background: #f1f5f9; color: #475569; }
.badge.func-unknown { background: #fee2e2; color: #991b1b; }
.badge.shift-on { background: #dcfce7; color: #166534; }
.badge.shift-off { background: #f1f5f9; color: #64748b; }
.badge.err-type-error { background: #fee2e2; color: #991b1b; }
.badge.err-type-warn { background: #ffedd5; color: #9a3412; }
.badge.err-type-event { background: #fef3c7; color: #92400e; }
.badge.err-type-info { background: #e0f2fe; color: #075985; }
.emp-modal-hint {
  font-size: 0.85rem;
  color: var(--slate-600);
  background: #f8fafc;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.about-list { margin: 12px 0 0; padding-left: 18px; line-height: 1.8; }

.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .grid3 { grid-template-columns: 1fr; } }

.trial-card { margin-bottom: 16px; }
.trial-card-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; flex-wrap: wrap; margin-bottom: 16px;
}
.trial-card h2 { margin: 0 0 8px; font-size: 1.2rem; }
.trial-until {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em;
  color: var(--slate-500); text-transform: uppercase; white-space: nowrap;
}
.trial-progress-wrap { margin-bottom: 16px; }
.trial-progress-label {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em;
  color: var(--slate-500); margin-bottom: 8px;
}
.trial-progress {
  height: 8px; border-radius: 999px; background: #e2e8f0; overflow: hidden;
}
.trial-progress-bar {
  height: 100%; border-radius: 999px; background: linear-gradient(90deg, #059669, #10b981);
}
.trial-days-big {
  display: flex; align-items: baseline; gap: 10px;
  padding: 12px 0 4px; border-top: 1px solid #f1f5f9;
}
.trial-days-num {
  font-size: 2.5rem; font-weight: 800; line-height: 1; color: var(--emerald-900);
}
.trial-days-label { font-size: 1rem; color: var(--slate-600); font-weight: 600; }
.system-info-grid { margin-bottom: 16px; }
.system-info-card h3 {
  margin: 0 0 8px; font-size: 0.85rem; color: var(--slate-500); font-weight: 600;
}
.system-info-value {
  margin: 0 0 8px; font-size: 1.1rem; font-weight: 700; color: var(--emerald-950);
}
.trial-feat-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px;
}
@media (max-width: 700px) { .trial-feat-grid { grid-template-columns: 1fr; } }
.trial-feat-item {
  background: #f8fafc; border-radius: 12px; padding: 14px 16px;
  font-size: 0.9rem; font-weight: 600; color: var(--slate-700);
  border: 1px solid #e2e8f0;
}
#system-panel-body .card { margin-bottom: 16px; }
#system-panel-body .card:last-child { margin-bottom: 0; }
.trial-card.expired { border-color: #fecaca; background: #fffbfb; }
.employees-table td, .errlog-table td { font-size: 0.88rem; }

.channels-hint {
  color: var(--slate-500);
  font-size: 0.85rem;
  margin: 10px 0 8px;
}
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 12px;
  font-size: 0.88rem;
  color: var(--slate-600);
  cursor: pointer;
}
.door-sensor-hint {
  color: #0369a1;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 8px 10px;
}
.battery-alerts {
  border-color: #fde68a;
  background: #fffbeb;
}
.battery-alerts h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}
.battery-summary-strip {
  margin-top: 12px;
}
.battery-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 10px 0 4px;
}
.battery-summary-tile {
  border-radius: 10px;
  padding: 12px 14px;
  border: 1px solid #e5e7eb;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.battery-summary-tile.warn {
  border-color: #fcd34d;
  background: #fffbeb;
}
.battery-summary-tile.ok {
  border-color: #86efac;
  background: #f0fdf4;
}
.battery-summary-tile.muted {
  border-color: #e5e7eb;
  background: #f9fafb;
}
.battery-summary-val {
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.1;
}
.battery-summary-tile.warn .battery-summary-val {
  color: #b45309;
}
.battery-summary-tile.ok .battery-summary-val {
  color: #15803d;
}
.battery-summary-lbl {
  font-size: 0.78rem;
  color: #6b7280;
  line-height: 1.25;
}
.battery-alert-list {
  margin-top: 12px;
}
.stat-card-visits .value {
  color: #0369a1;
}
.venue-bulk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px 16px;
  margin-bottom: 12px;
}
.inline-range {
  display: flex;
  align-items: center;
  gap: 8px;
}
.inline-range input[type="number"] {
  width: 72px;
}
.venue-bulk-card {
  margin-bottom: 16px;
}
.battery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: flex-end;
}
.battery-filters label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
}
.battery-bulk-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 8px 0;
}
.bat-pct {
  display: inline-block;
  min-width: 42px;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.82rem;
  text-align: center;
}
.bat-pct-ok { background: #dcfce7; color: #166534; }
.bat-pct-warn { background: #fef3c7; color: #92400e; }
.bat-pct-expired { background: #fee2e2; color: #991b1b; }
.bat-row-actions { white-space: nowrap; }
.battery-admin-bulk {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.channels-panel-kp .channels-list {
  overflow-x: hidden;
  overflow-y: auto;
  max-height: min(420px, 55vh);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.channel-row-kp {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 10px 10px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fafbfc;
  min-width: 0;
}
.channel-row-kp:hover {
  background: #f5f3ff;
  border-color: #ddd6fe;
}
.kp-row-top {
  display: grid;
  grid-template-columns: 52px 1fr 1fr 32px;
  gap: 6px;
  align-items: end;
}
.kp-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  margin: 0;
}
.kp-lbl {
  font-size: 0.65rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.2;
}
.channel-row-kp input {
  width: 100%;
  height: 34px;
  min-width: 0;
  box-sizing: border-box;
}
.kp-field-pager input {
  text-align: center;
  padding: 0 4px;
}
.kp-del {
  width: 32px;
  height: 34px;
  min-width: 32px;
  padding: 0;
  align-self: end;
}
.kp-field-code .kp-lbl {
  color: #6d28d9;
}
.kp-code-wrap {
  display: flex;
  gap: 6px;
  align-items: center;
}
.kp-code-wrap .group-ch-code-kp {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  background: #fff;
  border-color: #c4b5fd;
}
.kp-code-wrap .group-ch-code-kp:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.12);
}
.kp-code-wrap .btn-pick-code {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  min-width: 34px;
}
@media (max-width: 520px) {
  .kp-row-top {
    grid-template-columns: 48px 1fr 32px;
  }
  .kp-row-top .kp-field:nth-child(3) {
    grid-column: 1 / -2;
  }
}
.stat-card-kitchen {
  border-left: 3px solid #0284c7;
}

/* Hover tooltips */
.has-tip {
  position: relative;
  cursor: help;
}
.has-tip[data-tip]:hover::after,
.has-tip[data-tip]:focus-visible::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  min-width: 140px;
  max-width: min(320px, 90vw);
  padding: 8px 10px;
  background: #0f172a;
  color: #f8fafc;
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.4;
  border-radius: 8px;
  white-space: normal;
  text-align: center;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.28);
  z-index: 400;
  pointer-events: none;
}
.has-tip.tip-below[data-tip]:hover::after,
.has-tip.tip-below[data-tip]:focus-visible::after {
  bottom: auto;
  top: calc(100% + 8px);
}
.has-tip.tip-inline {
  cursor: help;
}
button.has-tip:not(:disabled) {
  cursor: pointer;
}
input.has-tip {
  cursor: text;
}
.stat-card.has-tip {
  cursor: help;
}
.badge.func-entry { background: #e0f2fe; color: #0369a1; }
.badge.func-exit { background: #fce7f3; color: #9d174d; }
.channels-panel {
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.channels-head {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) minmax(120px, 1.5fr) 36px 36px;
  gap: 8px;
  padding: 8px 10px;
  background: #f8fafc;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid #f1f5f9;
}
.channels-list {
  max-height: calc(40px * 5 + 12px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--slate-200) transparent;
}
.channels-list::-webkit-scrollbar { width: 6px; }
.channels-list::-webkit-scrollbar-thumb {
  background: var(--slate-200);
  border-radius: 4px;
}
.channels-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.channel-row {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) minmax(120px, 1.5fr) 36px 36px;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
  padding: 2px 2px;
}
.channel-row:last-child { margin-bottom: 0; }
.channel-row:hover { background: #f8fffb; border-radius: 8px; }
.channel-row input {
  height: 36px;
  margin-bottom: 0 !important;
  padding: 0 10px;
  font-size: 0.85rem;
  border-radius: 8px;
}
.channel-row .btn-small {
  padding: 0;
  width: 36px;
  height: 36px;
  min-width: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.badge.func-hookah { background: #fce7f3; color: #9d174d; }
.badge.func-sos { background: #fee2e2; color: #b91c1c; }
.badge.func-clean { background: #dbeafe; color: #1d4ed8; }
.badge.func-custom { background: #f1f5f9; color: #334155; }
.recent-codes-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.recent-codes-head h2 {
  margin: 0;
  font-size: 1.1rem;
}
.recent-codes-scroll {
  max-height: 7.5rem; /* ~3 строки, остальное — скролл */
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}
.recent-codes-scroll::-webkit-scrollbar {
  width: 6px;
}
.recent-codes-scroll::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.recent-code {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; border-radius: 10px; background: #f8fafc;
  margin-bottom: 6px; font-size: 0.85rem;
}
.recent-code:last-child { margin-bottom: 0; }
.recent-code button { flex-shrink: 0; }
.device-group-title {
  font-weight: 800; color: var(--emerald-950);
  margin: 16px 0 8px; padding-bottom: 6px;
  border-bottom: 2px solid var(--emerald-100);
}

.header-badges { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.panel { display: none; }
.panel.active {
  display: block;
  animation: none;
}
@media (min-width: 901px) {
  .panel.active {
    contain: layout style;
  }
}

.card {
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.7);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--card-shadow);
}
.card h2 {
  margin: 0 0 16px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--slate-700);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.7);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: var(--card-shadow);
}
.stat-card .label { font-size: 0.8rem; color: var(--slate-500); font-weight: 600; }
.stat-card .value { font-size: 1.75rem; font-weight: 800; color: var(--emerald-950); margin-top: 4px; }
.stat-card .caption { font-size: 0.75rem; color: var(--slate-500); margin-top: 4px; }

.rental-panel-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 20px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.rental-panel-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.rental-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.rental-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px 18px;
  margin-bottom: 16px;
}
.rent-ok { color: #059669; font-weight: 600; }

.cabinet-auth-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--slate-200);
}
.cabinet-auth-label {
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.3;
}
.cabinet-auth-label.platform { color: #7c3aed; }
.cabinet-auth-label.owner { color: var(--emerald-900); }
.cabinet-auth-label.staff { color: var(--slate-500); }

.modal-wide { width: min(520px, 100%); }
.modal-compact { width: min(420px, 100%); }
.modal-scroll {
  display: flex;
  flex-direction: column;
  max-height: min(92vh, 680px);
  max-height: min(92dvh, 680px);
  padding: 0;
  overflow: hidden;
}
.modal-scroll .modal-head {
  flex-shrink: 0;
  padding: 18px 22px 10px;
  border-bottom: 1px solid var(--slate-100);
}
.modal-scroll .modal-head h2 { margin: 0 0 6px; font-size: 1.15rem; }
.modal-scroll .modal-head .emp-modal-hint { margin-bottom: 0; }
.modal-scroll .modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 22px;
  -webkit-overflow-scrolling: touch;
}
.modal-scroll .modal-foot {
  flex-shrink: 0;
  padding: 12px 22px 18px;
  margin-top: 0;
  border-top: 1px solid var(--slate-100);
  background: #fafbfc;
  border-radius: 0 0 20px 20px;
}
.modal-scroll .modal-foot.modal-actions { justify-content: flex-end; }
.modal-note { margin: 0 0 10px; font-size: 0.82rem; }
.emp-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  margin-bottom: 14px;
}
.emp-form-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--slate-600);
  margin-bottom: 4px;
}
.emp-form-field input,
.emp-form-field select,
.modal-body input:not([type="checkbox"]),
.modal-body select {
  width: 100%;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--slate-200);
  padding: 0 12px;
  margin-bottom: 0;
  background: #fff;
  font-size: 0.9rem;
  box-sizing: border-box;
}
/* Мобильные формы входа — без фиксированной высоты (iOS обрезает текст в select) */
.modal-body#waiter-login-form select,
.modal-body#waiter-login-form input,
.modal-body#cabinet-login-form input {
  height: auto;
  min-height: 48px;
  padding: 12px 14px;
  font-size: 16px;
  line-height: 1.35;
  border-radius: 12px;
}
.modal-body input:focus,
.modal-body select:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}
.emp-form-field.span-2 { grid-column: 1 / -1; }
@media (max-width: 520px) {
  .emp-form-grid { grid-template-columns: 1fr; }
  .emp-form-field.span-2 { grid-column: auto; }
  .emp-tables-chips { max-width: none; }
}
.emp-functions-block {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--slate-200);
}
.emp-functions-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}
.emp-fn-table-block {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
}
.emp-fn-table-name {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 8px;
  color: var(--slate-800);
}
.emp-fn-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.emp-fn-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  cursor: pointer;
}
.emp-fn-chip span {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid var(--slate-200);
  background: #fff;
  color: var(--slate-700);
}
.emp-fn-chip input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.emp-fn-chip input:checked + span {
  background: rgba(5, 150, 105, 0.12);
  border-color: rgba(5, 150, 105, 0.45);
  color: #047857;
}
.table-assign-routing-wrap {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--slate-200);
}
.table-assign-routing {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fn-route-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
}
.fn-route-label {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--slate-800);
}
.fn-route-modes {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fn-route-mode {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 0.85rem;
  cursor: pointer;
}
@media (min-width: 520px) {
  .fn-route-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .fn-route-modes {
    flex-direction: row;
    gap: 14px;
  }
}

.emp-tables-block {
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  padding: 12px 14px;
  background: #f8fafc;
}
.emp-tables-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.emp-tables-block-head label { margin: 0; font-weight: 700; font-size: 0.9rem; }
.emp-tables-block .table-assign-toolbar { margin: 0; }
.emp-tables-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 220px;
}
.emp-tables-col { vertical-align: middle; }
.employees-table .emp-actions-col { width: 1%; white-space: nowrap; }
.emp-actions-row { display: flex; flex-wrap: wrap; gap: 4px; }

.roles-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.roles-sortable-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.role-sort-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  background: var(--card, #fff);
  cursor: grab;
  transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  user-select: none;
}
.role-sort-item:active { cursor: grabbing; }
.role-sort-item.dragging {
  opacity: 0.55;
  transform: scale(0.98);
}
.role-sort-item.drag-over {
  border-color: var(--accent, #059669);
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.15);
}
.role-sort-grip {
  color: var(--muted, #94a3b8);
  font-size: 0.85rem;
  letter-spacing: -2px;
}
.role-sort-label { flex: 1; font-weight: 600; }
.role-sort-meta { font-size: 0.82rem; }
.role-sort-actions { display: flex; gap: 2px; }

.role-select-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.role-select-row select {
  flex: 1;
  min-width: 0;
}
.role-select-row .btn {
  flex-shrink: 0;
  min-width: 2.5rem;
  padding-left: 0.65rem;
  padding-right: 0.65rem;
  font-weight: 700;
}

.bridge-installer-modal .installer-steps {
  margin: 1rem 0 1.25rem;
  padding-left: 1.25rem;
  line-height: 1.55;
}
.bridge-installer-modal .installer-steps li + li { margin-top: 0.35rem; }
.installer-download-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 1rem;
}
.installer-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2, rgba(0,0,0,.04));
  margin-bottom: 1rem;
  font-weight: 600;
}
.installer-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}
.installer-status-row.online .installer-status-dot { background: var(--ok, #22c55e); }
.installer-status-row.offline .installer-status-dot { background: #f59e0b; }
.installer-details { margin-top: 0.75rem; }
.installer-details summary { cursor: pointer; font-weight: 600; }
.settings-installer-card .installer-steps { margin: 0.75rem 0 1rem; padding-left: 1.25rem; }
.installer-dl-btn.installer-dl-recommended { box-shadow: 0 0 0 2px var(--accent, #22c55e); }
.bridge-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.assign-emp-chip-more {
  background: var(--slate-100);
  color: var(--slate-600);
  border-color: var(--slate-200);
}
.card-subtitle { margin: 0 0 12px; font-size: 1rem; font-weight: 700; color: var(--slate-700); }
.table-assign-toolbar { display: flex; gap: 6px; }
.table-assign-grid {
  max-height: min(36vh, 240px);
  overflow-y: auto;
  padding: 2px 0 0;
  background: transparent;
  border: none;
}
.table-assign-zone { margin-bottom: 12px; }
.table-assign-zone:last-child { margin-bottom: 0; }
.table-assign-zone-title {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--slate-500);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.table-assign-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.table-assign-chip {
  position: relative;
  cursor: pointer;
  margin: 0;
}
.table-assign-chip input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.table-assign-chip span {
  display: inline-block;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--slate-700);
  background: #fff;
  border: 1px solid var(--slate-200);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  user-select: none;
}
.table-assign-chip:hover span {
  border-color: rgba(5, 150, 105, 0.45);
  background: rgba(5, 150, 105, 0.04);
}
.table-assign-chip input:checked + span {
  background: var(--emerald-100);
  border-color: var(--emerald-500);
  color: var(--emerald-950);
  box-shadow: 0 0 0 1px rgba(5, 150, 105, 0.15);
}
.table-assign-chk {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.86rem;
  border: 1px solid var(--slate-100);
  background: #fff;
}
.table-assign-chk:hover { background: rgba(5, 150, 105, 0.05); border-color: var(--slate-200); }
.table-assign-chk input { flex-shrink: 0; accent-color: var(--emerald-600); }
.assign-by-employee-list { display: flex; flex-direction: column; gap: 10px; }
.assign-emp-card {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
}
.assign-emp-card-head { min-width: 160px; }
.assign-emp-card-head b { display: block; }
.assign-emp-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 120px; }
.assign-emp-chip {
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--emerald-50);
  color: var(--emerald-900);
  border: 1px solid rgba(5, 150, 105, 0.2);
}
.table-assign-people { display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow-y: auto; }
#rental-tenants-table tbody tr.rental-row:hover { background: rgba(5, 150, 105, 0.06); }

.form-section-title {
  margin: 18px 0 6px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--slate-700);
}
.tenant-profile-card {
  margin-top: 10px;
  padding: 14px 16px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.7);
}
.tenant-profile-card h3 { margin: 0 0 8px; font-size: 0.95rem; }
.card-inner.tenant-profile-card { margin: 0 0 16px; background: #fff; }
.tenant-profile-row td { padding-top: 0 !important; border-top: none !important; }
.tenant-venue-edit { width: 100%; margin: 4px 0; }

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
}
.filters-row input,
.filters-row select {
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--slate-200);
  padding: 0 12px;
  background: #fff;
  color: var(--slate-900);
  min-width: 160px;
}
.filters-row input:focus,
.filters-row select:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
}
.search-input { flex: 1; min-width: 200px; max-width: 320px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 12px;
  border: none;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary {
  background: var(--emerald-900);
  color: #fff;
  box-shadow: 0 8px 20px rgba(2, 44, 34, 0.15);
}
.btn-primary:hover { background: var(--emerald-800); }
.btn-secondary {
  background: var(--emerald-50);
  color: var(--emerald-900);
}
.btn-secondary:hover { background: var(--emerald-100); }
.btn-ghost {
  background: #fff;
  color: var(--slate-700);
  border: 1px solid var(--slate-200);
}
.btn-danger { background: var(--rose-600); color: #fff; }
.btn-small { padding: 6px 12px; font-size: 0.8rem; }

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--slate-600);
  margin-bottom: 6px;
}
.card input:not([type="checkbox"]):not([type="radio"]),
.card select,
.card textarea {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--slate-200);
  padding: 0 12px;
  margin-bottom: 12px;
  background: #fff;
}
.card input:focus, .card select:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) {
  .grid2 { grid-template-columns: 1fr; }
}

/* Data table */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; border: 1px solid var(--slate-200); }
.calls-table-wrap {
  max-height: min(440px, calc(100vh - 320px));
  overflow-y: auto;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--slate-200) transparent;
}
.calls-table-wrap::-webkit-scrollbar { width: 6px; height: 6px; }
.calls-table-wrap::-webkit-scrollbar-thumb {
  background: var(--slate-200);
  border-radius: 4px;
}
.calls-table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 1px 0 var(--slate-200);
}
.data-table.calls-table th,
.data-table.calls-table td {
  padding: 9px 11px;
  font-size: 0.82rem;
}
.data-table.calls-table .cell-device {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.25;
}
.data-table.calls-table .cell-device .mono { font-size: 0.72rem; }
.calls-table-meta {
  margin: 8px 2px 0;
  font-size: 0.78rem;
  color: var(--slate-500);
}

/* System panel — bridge health */
.system-bridge-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 12px 0 8px;
}
.system-bridge-stat {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.system-bridge-stat.ok { border-color: #6ee7b7; background: #ecfdf5; }
.system-bridge-stat.warn { border-color: #fcd34d; background: #fffbeb; }
.system-bridge-label { font-size: 0.72rem; color: var(--slate-500); text-transform: uppercase; letter-spacing: 0.04em; }
.system-bridge-stat strong { font-size: 1rem; color: var(--slate-800); }
.system-bridge-hint { margin-top: 4px; font-size: 0.82rem; }

/* Calls — mobile filters + system bridge */
@media (max-width: 900px) {
  .filters-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .filters-row .search-input { grid-column: 1 / -1; }
  .calls-mobile-list .call-mobile-card {
    content-visibility: auto;
    contain-intrinsic-size: auto 88px;
  }
}

@media (max-width: 520px) {
  .system-bridge-grid { grid-template-columns: 1fr; }
  .filters-row { grid-template-columns: 1fr; }
}

.admin-payments-list {
  max-height: calc(44px * 5);
  border-top: none;
  margin-top: 0;
}
.admin-payments-list .item-row { padding: 8px 0; min-height: auto; }

.sound-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  margin-bottom: 14px;
  cursor: pointer;
}
.sound-toggle input { width: auto; height: auto; margin: 0; }
.sound-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 12px;
}
@media (max-width: 600px) {
  .sound-controls { grid-template-columns: 1fr; }
}
.sound-upload { margin-top: 16px; padding-top: 14px; border-top: 1px solid #f1f5f9; }
.sound-upload-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}
.sound-custom-list {
  max-height: calc(44px * 4);
  margin-top: 12px;
  border-top: 1px solid #f1f5f9;
}
.sound-custom-list .item-row { min-height: 40px; padding: 8px 0; }

/* Compact call sound */
.card-compact { padding: 14px 16px; }
.sound-card-head { margin-bottom: 10px; }
.sound-card-head h2 { margin: 0 0 4px; font-size: 1rem; }
.sound-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--slate-500);
}
.sound-controls-compact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}
.sound-on-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.sound-on-label input { width: auto; height: auto; margin: 0; }
.sound-select {
  min-width: 140px;
  flex: 1 1 140px;
  max-width: 220px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--slate-200);
  font-size: 0.85rem;
}
.sound-vol-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 120px;
  min-width: 100px;
}
.sound-vol-wrap input[type="range"] { flex: 1; min-width: 60px; }
.sound-vol-wrap span { font-size: 0.78rem; color: var(--slate-500); min-width: 36px; }
.sound-upload-collapse {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
  font-size: 0.85rem;
}
.btn-sound-del {
  min-width: 32px;
  padding: 4px 8px;
  line-height: 1;
}
.sound-custom-list-inline {
  margin: 8px 0 0;
  padding: 0;
  border-top: 1px solid #f1f5f9;
  max-height: none;
}
.sound-custom-list-inline:empty { display: none; border: none; margin: 0; }
.sound-custom-list-inline .item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  min-height: 36px;
}
.sound-custom-list-inline .item-row span:first-child {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--slate-600);
}
.sound-custom-list-inline .sound-custom-head span {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--slate-500);
}
.sound-custom-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.sound-upload-collapse summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--slate-600);
  user-select: none;
}
.sound-upload-collapse .sound-upload-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0 8px;
}
@media (max-width: 600px) {
  .sound-upload-collapse .sound-upload-row { grid-template-columns: 1fr; }
}

/* Settings */
.settings-toolbar { display: flex; gap: 8px; align-items: center; }
.settings-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.settings-subnav-btn {
  border: 1px solid var(--slate-200);
  background: #fff;
  color: var(--slate-600);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.settings-subnav-btn.active {
  background: var(--emerald-700);
  border-color: var(--emerald-700);
  color: #fff;
}
.settings-pane.hidden { display: none; }
.setup-guide-card { margin-bottom: 14px; }
.setup-guide-cheat {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--slate-200, #cbd5e1);
  background: var(--slate-50, #f8fafc);
}
.setup-guide-cheat h3 { margin: 0 0 8px; font-size: 1rem; }
.setup-guide-steps { margin: 0 0 12px; padding-left: 1.25rem; }
.setup-guide-steps li + li { margin-top: 6px; }
.setup-guide-list { margin: 0 0 12px; padding-left: 1.25rem; }
.setup-guide-list li + li { margin-top: 6px; }
.setup-guide-check { list-style: none; padding-left: 0; }
.setup-guide-check li {
  position: relative;
  padding-left: 1.4rem;
  margin-top: 8px;
}
.setup-guide-check li::before {
  content: "☐";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--slate-500, #64748b);
}
.setup-guide-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.setup-guide-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--slate-200, #cbd5e1);
  font-size: 0.9rem;
}
.setup-guide-toc a { color: var(--accent, #16a34a); text-decoration: none; }
.setup-guide-toc a:hover { text-decoration: underline; }
.setup-guide-card h3 { margin: 0 0 10px; }
.setup-guide-card h4 { margin: 12px 0 8px; font-size: 0.95rem; }
.push-guide-card { margin-bottom: 14px; }
.push-device-status-list { margin: 0 0 12px; padding-left: 1.2rem; line-height: 1.5; }
.push-device-status-list li.ok { color: var(--accent); }
.push-device-status-list li.warn { color: var(--warn); }
.push-guide-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}
.push-guide-head h2 { margin: 0 0 6px; }
.push-guide-url-block {
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--slate-200);
  margin-bottom: 12px;
}
.push-guide-url-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--slate-500);
  margin-bottom: 8px;
}
.push-guide-url-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.push-guide-url {
  flex: 1;
  min-width: 0;
  word-break: break-all;
  font-size: 0.9rem;
  color: var(--emerald-800);
  font-weight: 600;
}
.push-guide-hint {
  margin: 10px 0 0;
  font-size: 0.78rem;
  color: #b45309;
}
.push-guide-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.push-guide-platform-title {
  margin: 0 0 12px;
  font-size: 1rem;
}
.push-guide-steps {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--slate-700);
  line-height: 1.55;
}
.push-guide-steps li + li { margin-top: 8px; }
.push-guide-note {
  background: linear-gradient(135deg, #ecfdf5, #f0fdf4);
  border-color: #a7f3d0;
}
.push-guide-note p { margin: 0; font-size: 0.88rem; color: var(--slate-700); }

/* Уведомления о вызовах: toggle switches + pill-style radio group (was raw
   browser checkboxes/radios, blown up to 44px by the generic .card input rule). */
.push-toggles-group { margin-bottom: 4px; }
.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 12px 2px;
  cursor: pointer;
}
.push-toggles-group .toggle-row + .toggle-row { border-top: 1px solid var(--slate-100); }
.toggle-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 42px;
  height: 24px;
  margin: 0;
  border-radius: 999px;
  background: var(--slate-200);
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
}
.toggle-row input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
  transition: transform 0.15s ease;
}
.toggle-row input[type="checkbox"]:checked { background: #059669; }
.toggle-row input[type="checkbox"]:checked::before { transform: translateX(18px); }
.toggle-row input[type="checkbox"]:focus-visible { outline: 2px solid #059669; outline-offset: 2px; }
.toggle-row-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.toggle-row-title { font-size: 0.88rem; font-weight: 600; color: var(--slate-700); line-height: 1.3; }
.toggle-row-hint { font-size: 0.78rem; color: var(--slate-500); line-height: 1.35; }
.toggle-row > span:only-of-type { font-size: 0.88rem; font-weight: 600; color: var(--slate-700); }

.push-mode-fieldset {
  border: none;
  margin: 14px 0 4px;
  padding: 14px 0 0;
  border-top: 1px solid var(--slate-100);
}
.push-mode-fieldset legend {
  padding: 0 0 10px;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--slate-500);
}
.push-mode-options { display: flex; flex-wrap: wrap; gap: 8px; }
.radio-row { position: relative; margin: 0; cursor: pointer; }
.radio-row input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.radio-row span {
  display: inline-flex;
  align-items: center;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--slate-200);
  background: #fff;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--slate-600);
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.radio-row:hover span { border-color: #a7d8c4; }
.radio-row:has(input:checked) span {
  background: var(--emerald-50);
  border-color: rgba(5, 150, 105, 0.45);
  color: #047857;
}
.radio-row input[type="radio"]:focus-visible + span { outline: 2px solid #059669; outline-offset: 2px; }
.push-settings-waiter-link { margin-top: 16px; }
#btn-lang-toggle {
  min-width: 44px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.theme-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.theme-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 2px solid var(--slate-200);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.theme-option:has(input:checked) {
  border-color: var(--emerald-900);
  box-shadow: 0 0 0 3px rgba(6, 78, 59, 0.12);
}
.theme-option input { position: absolute; opacity: 0; pointer-events: none; }
.theme-swatch {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.theme-swatch-qwik { background: linear-gradient(135deg, #ecfdf5, #059669); }
.theme-swatch-rkeeper { background: linear-gradient(135deg, #2d2640, #6b5b95); }
.theme-swatch-iiko { background: linear-gradient(135deg, #fff7ed, #f97316); }
.theme-label { display: flex; flex-direction: column; gap: 2px; }
.theme-label b { font-size: 0.95rem; }
.theme-label small { font-size: 0.78rem; color: var(--slate-500); }

/* Themes */
[data-theme="rkeeper"] {
  --emerald-950: #1a1524;
  --emerald-900: #6b5b95;
  --emerald-800: #7d6ba8;
  --emerald-700: #6b5b95;
  --emerald-100: #e8e4f0;
  --emerald-50: #f0edf5;
  --bg: linear-gradient(180deg, #ebe8f0 0%, #f4f2f7 45%, #e8e5ee 100%);
  --mobile-top-bg: #2d2640;
  --mobile-top-border: #3d3450;
}
[data-theme="rkeeper"] body {
  background:
    radial-gradient(circle at 20% 0%, rgba(107, 91, 149, 0.12), transparent 30%),
    var(--bg);
}
[data-theme="rkeeper"] .sidebar {
  background: #2d2640;
  border-right-color: #3d3450;
  color: #c4bfd4;
}
[data-theme="rkeeper"] .brand-title { color: #fff; }
[data-theme="rkeeper"] .brand-venue { color: #e8e0f5; }
[data-theme="rkeeper"] .brand-sub,
[data-theme="rkeeper"] .sidebar-footer { color: #9d97b0; }
[data-theme="rkeeper"] .sidebar-footer a { color: #c9b8e8; }
[data-theme="rkeeper"] .nav-item {
  background: rgba(0, 0, 0, 0.22);
  color: #c4bfd4;
  box-shadow: none;
}
[data-theme="rkeeper"] .nav-item:hover {
  border-color: #6b5b95;
  color: #fff;
}
[data-theme="rkeeper"] .nav-item.active {
  background: #6b5b95;
  border-color: #8b7bb5;
  color: #fff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}
[data-theme="rkeeper"] .trial-badge {
  background: rgba(107, 91, 149, 0.25);
  color: #e8e0f8;
  border-color: rgba(139, 123, 181, 0.4);
}
[data-theme="rkeeper"] .btn-primary { background: #6b5b95; }
[data-theme="rkeeper"] .btn-primary:hover { background: #7d6ba8; }
[data-theme="rkeeper"] .big-alert { background: #2d2640; }

[data-theme="iiko"] {
  --emerald-950: #7c2d12;
  --emerald-900: #ea580c;
  --emerald-800: #f97316;
  --emerald-700: #ea580c;
  --emerald-100: #ffedd5;
  --emerald-50: #fff7ed;
  --bg: linear-gradient(180deg, #fffaf5 0%, #ffffff 45%, #fff7ed 100%);
  --mobile-top-bg: #ea580c;
  --mobile-top-border: #f97316;
}
[data-theme="iiko"] body {
  background:
    radial-gradient(circle at 20% 0%, rgba(249, 115, 22, 0.1), transparent 30%),
    var(--bg);
}
[data-theme="iiko"] .sidebar {
  background: #fff;
  border-right-color: #fed7aa;
}
[data-theme="iiko"] .brand-title { color: #ea580c; }
[data-theme="iiko"] .brand-venue { color: #c2410c; }
[data-theme="iiko"] .nav-item:hover { border-color: #fdba74; }
[data-theme="iiko"] .nav-item.active {
  background: #ea580c;
  border-color: #f97316;
  box-shadow: 0 10px 24px rgba(234, 88, 12, 0.22);
}
[data-theme="iiko"] .trial-badge {
  background: #fff7ed;
  color: #c2410c;
  border-color: rgba(249, 115, 22, 0.25);
}
[data-theme="iiko"] .btn-primary { background: #ea580c; }
[data-theme="iiko"] .btn-primary:hover { background: #f97316; }
[data-theme="iiko"] .big-alert { background: #ea580c; }
[data-theme="iiko"] .theme-option:has(input:checked) {
  border-color: #ea580c;
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.12);
}
[data-theme="rkeeper"] .theme-option:has(input:checked) {
  border-color: #6b5b95;
  box-shadow: 0 0 0 3px rgba(107, 91, 149, 0.15);
}
[data-theme="rkeeper"] .admin-tab.active {
  background: #6b5b95;
  border-color: #6b5b95;
}
[data-theme="iiko"] .admin-tab.active {
  background: #ea580c;
  border-color: #ea580c;
}

.code-area {
  width: 100%;
  min-height: 120px;
  border-radius: 12px;
  border: 1px solid var(--slate-200);
  padding: 10px 12px;
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  margin-bottom: 12px;
  resize: vertical;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: #fff;
}
.data-table th {
  text-align: left;
  padding: 12px 14px;
  background: #f8fafc;
  color: var(--slate-600);
  font-weight: 700;
  border-bottom: 1px solid var(--slate-200);
  white-space: nowrap;
}
.data-table td {
  padding: 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.data-table tr:hover td { background: #f8fffb; }
.data-table tr.row-pending td { background: #fffbeb; }
.data-table tr.row-pending-warn td { background: #fffbeb; }
.data-table tr.row-pending-warn td:first-child { box-shadow: inset 4px 0 0 #f59e0b; }
.data-table tr.row-pending-alert td { background: #fef2f2; }
.data-table tr.row-pending-alert td:first-child { box-shadow: inset 4px 0 0 #dc2626; }
.data-table tr.row-slow-done td { background: #fff7ed; }
.stat-card-warn .value { color: #b45309; }
.stat-card-alert .value { color: #b91c1c; }
.btn-accept-warn {
  background: #f59e0b;
  border-color: #d97706;
  min-width: 5.2rem;
  font-variant-numeric: tabular-nums;
}
.btn-accept-warn:hover { background: #d97706; }
.btn-accept-alert {
  background: #dc2626;
  border-color: #b91c1c;
  min-width: 5.2rem;
  font-variant-numeric: tabular-nums;
  animation: accept-alert-pulse 1.2s ease-in-out infinite;
}
.btn-accept-alert:hover { background: #b91c1c; }
@keyframes accept-alert-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}
@media (max-width: 900px), (prefers-reduced-motion: reduce) {
  .btn-accept-alert { animation: none; box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.35); }
}
.settings-sla-grid {
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.settings-actions { margin-top: 14px; }
.data-table tr.row-guest-order td { background: #fdf2f8; }
.data-table tr.row-guest-order td:first-child { box-shadow: inset 4px 0 0 #db2777; }
.data-table tr.row-guest-order:hover td { background: #fce7f3; }
.guest-order-hint {
  font-size: 0.8rem;
  color: #9d174d;
  font-weight: 600;
  margin-top: 4px;
  line-height: 1.3;
}
.data-table tr.row-cancelled td { background: #fef2f2; }
.data-table tr.row-cancelled:hover td { background: #fee2e2; }
.data-table tr.row-cancelled td:first-child { box-shadow: inset 4px 0 0 #dc2626; }
.data-table tr.row-cancelled-flash td {
  animation: row-cancel-pulse 0.8s ease-in-out 3;
}
@keyframes row-cancel-pulse {
  0%, 100% { background: #fef2f2; }
  50% { background: #fecaca; }
}
.data-table .mono { font-family: ui-monospace, monospace; font-size: 0.8rem; color: var(--slate-500); }

.big-alert {
  display: none;
  padding: 20px 24px;
  border-radius: 16px;
  background: var(--emerald-900);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 20px;
  box-shadow: 0 12px 32px rgba(2, 44, 34, 0.25);
  animation: fade-up 0.3s ease;
}
.big-alert.show { display: block; }
.big-alert.cancel {
  background: #991b1b;
  box-shadow: 0 12px 32px rgba(153, 27, 27, 0.35);
}

.floor-card { padding-bottom: 16px; }
.floor-card-head {
  display: flex; flex-wrap: wrap; gap: 16px;
  justify-content: space-between; align-items: flex-start;
  margin-bottom: 14px;
}
.floor-card-head h2 { margin-bottom: 4px; }
.floor-hint-text {
  color: var(--slate-500); font-size: 0.85rem; margin: 0;
  max-width: 520px;
}
.floor-toolbar {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
#floor-zoom-label {
  min-width: 48px; text-align: center; font-weight: 700;
  font-size: 0.85rem; color: var(--slate-600);
}

.floorplan-viewport {
  position: relative;
  height: min(72vh, 760px);
  min-height: 420px;
  overflow: auto;
  border: 2px solid var(--slate-200);
  border-radius: 16px;
  background: #dce3ea;
  box-shadow: inset 0 2px 8px rgba(15, 23, 42, 0.06);
  overscroll-behavior: contain;
}
.floorplan-viewport.is-panning { cursor: grabbing; }
#floorplan-zoom-wrap { position: relative; transform-origin: 0 0; }

.floorplan-canvas {
  position: relative;
  background-color: #f8fafc;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.18) 1px, transparent 1px);
  background-size: 24px 24px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.08);
  touch-action: none;
}
.floor-empty {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--slate-500); font-size: 0.95rem; padding: 24px; text-align: center;
}

.zone-region {
  position: absolute;
  border: 2px solid;
  border-radius: 14px;
  z-index: 1;
  box-sizing: border-box;
  user-select: none;
  min-width: 140px;
  min-height: 100px;
  transition: box-shadow 0.15s ease;
  touch-action: none;
  overflow: visible;
}
.zone-region.is-dragging,
.zone-region.is-resizing {
  z-index: 5;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
  transition: none;
  will-change: left, top, width, height;
}
.zone-region.is-dragging.is-overlap {
  outline: 2px dashed rgba(220, 38, 38, 0.55);
  outline-offset: 2px;
}
.zone-region .zone-drag-handle {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 12px;
  cursor: grab;
  border-radius: 12px 12px 8px 8px;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}
.zone-region .zone-drag-handle:active { cursor: grabbing; }
.zone-region .zone-grip {
  font-size: 0.75rem;
  letter-spacing: -2px;
  color: var(--slate-400);
  line-height: 1;
  user-select: none;
}
.zone-region:hover { box-shadow: 0 6px 20px rgba(15, 23, 42, 0.1); }
.zone-region .zone-label {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--slate-800);
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.zone-region .zone-resize {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0.55;
  cursor: nwse-resize;
  pointer-events: auto;
  z-index: 4;
}
.zone-region:hover .zone-resize,
.zone-region.is-resizing .zone-resize { opacity: 1; }
.table-node {
  z-index: 2;
  position: absolute;
  min-width: 56px;
  min-height: 56px;
  touch-action: none;
  padding: 6px 8px;
  background: #fff;
  border: 2px solid var(--emerald-900);
  border-radius: 14px;
  cursor: grab;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  transform: translate(-50%, -50%);
  box-shadow: var(--nav-shadow);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.table-node.shape-round { border-radius: 50%; }
.table-node.shape-square { border-radius: 10px; }
.table-node.shape-rect { border-radius: 10px; }
.table-node.selected {
  outline: 3px solid var(--emerald-900);
  outline-offset: 2px;
  z-index: 3;
}
.table-node.is-dragging {
  z-index: 8;
  cursor: grabbing;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.2);
}
.table-node.has-pending {
  border-color: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.25);
}
.table-node .zone-tag { font-size: 0.65rem; color: var(--slate-500); font-weight: 500; }
.table-resize {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 12px;
  height: 12px;
  background: var(--emerald-900);
  border-radius: 3px;
  cursor: nwse-resize;
  z-index: 5;
  opacity: 0.85;
}
.table-resize:hover { opacity: 1; }
#edit-table-height-row.hidden { display: none; }

.item-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 10px 0; border-bottom: 1px solid #f1f5f9;
  min-height: 44px;
}
.item-row-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex-shrink: 0;
}
.plan-list-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  align-items: center;
}
.plan-list-search {
  flex: 1 1 140px;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  font-size: 0.9rem;
  background: #fff;
  color: var(--slate-800);
}
.plan-list-search:focus {
  outline: none;
  border-color: var(--emerald-700);
  box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.12);
}
.plan-list-search::-webkit-search-cancel-button { cursor: pointer; }
.plan-list-zone-filter {
  flex: 0 1 168px;
  min-width: 120px;
  max-width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  font-size: 0.9rem;
  background: #fff;
  color: var(--slate-800);
}
.plan-list-zone-filter:focus {
  outline: none;
  border-color: var(--emerald-700);
  box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.12);
}
.plan-list-filter-meta {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--slate-500);
}
.plan-list-filter-meta.hidden { display: none !important; }
.item-list {
  margin-top: 16px;
  max-height: calc(44px * 5);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
  border-top: 1px solid #f1f5f9;
  scrollbar-width: thin;
  scrollbar-color: var(--slate-200) transparent;
}
.item-list::-webkit-scrollbar { width: 6px; }
.item-list::-webkit-scrollbar-thumb {
  background: var(--slate-200);
  border-radius: 4px;
}
.item-list::-webkit-scrollbar-thumb:hover { background: var(--slate-500); }
.item-list .muted-text { color: var(--slate-500); font-size: 0.9rem; padding: 8px 0; }

.button-card {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px; border: 1px solid var(--slate-200); border-radius: 14px;
  margin-bottom: 10px; background: #fafafa;
}
.button-card code { color: var(--emerald-900); font-weight: 600; }

#yandex-perm-modal {
  z-index: 16000;
  align-items: flex-end;
  padding: 0;
  overflow: hidden;
  touch-action: none;
}
#yandex-perm-modal .yandex-perm-modal {
  width: 100%;
  max-width: 100%;
  max-height: min(92dvh, 720px);
  margin: 0;
  padding: 0;
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  touch-action: pan-y pinch-zoom;
}
#yandex-perm-modal .modal-head {
  flex-shrink: 0;
  padding: 18px 18px 10px;
  border-bottom: 1px solid var(--slate-100);
}
#yandex-perm-modal .modal-head h2 {
  margin: 0 0 6px;
  font-size: 1.1rem;
}
#yandex-perm-modal .yandex-perm-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y pinch-zoom;
  padding: 12px 18px 8px;
}
#yandex-perm-modal .modal-foot {
  flex-shrink: 0;
  padding: 12px 18px max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--slate-100);
  background: #fafbfc;
}
body.yandex-guide-open {
  overflow: hidden;
}

.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: center; justify-content: center; z-index: 2000;
  padding: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal-overlay.hidden { display: none !important; }
#waiter-login-modal {
  z-index: 15000;
}
#waiter-login-modal .modal {
  position: relative;
  z-index: 1;
  pointer-events: auto;
  max-height: min(92vh, 640px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
#waiter-login-modal .waiter-login-foot {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
#waiter-login-modal .waiter-login-main-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
#waiter-login-modal .waiter-login-owner-link {
  display: block;
  text-align: center;
  font-size: 0.85rem;
  color: var(--slate-500);
  text-decoration: none;
  padding: 4px 0 2px;
}
#waiter-login-modal .btn-block {
  width: 100%;
  min-height: 48px;
  justify-content: center;
}
body.waiter-login-open {
  overflow: hidden;
  /* Prefer svh — dvh jumps when mobile browser chrome shows/hides */
  height: 100svh;
  height: 100dvh;
}
body.waiter-login-required .main-area {
  pointer-events: none;
  user-select: none;
  filter: blur(2px);
}
.waiter-login-error {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  font-size: 0.88rem;
  line-height: 1.4;
}
.waiter-login-error.hidden { display: none !important; }
@media (max-width: 900px) {
  body.waiter-login-open {
    position: relative;
    width: auto;
    left: auto;
    right: auto;
  }
  #waiter-login-modal.modal-overlay {
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y pinch-zoom;
  }
  #waiter-login-modal .modal {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}
body.waiter-login-open .pwa-action-bar,
body.waiter-login-open .ios-warn-bar,
body.waiter-login-open .mobile-bottom-nav,
body.waiter-login-open .big-alert,
body.waiter-login-open .mobile-banners {
  visibility: hidden;
  pointer-events: none;
}
#waiter-login-form label,
#cabinet-login-form label {
  display: block;
  margin: 14px 0 8px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--slate-700);
}
#waiter-login-form label:first-of-type,
#cabinet-login-form label:first-of-type {
  margin-top: 0;
}
#waiter-login-form select,
#waiter-login-form input,
#cabinet-login-form input {
  width: 100%;
  font-size: 16px;
  padding: 12px 14px;
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  background: #fff;
  box-sizing: border-box;
  height: auto;
  min-height: 48px;
  line-height: 1.35;
  margin: 0;
}
#waiter-login-form select {
  -webkit-appearance: menulist;
  appearance: menulist;
  cursor: pointer;
}
#waiter-login-form input,
#cabinet-login-form input {
  -webkit-appearance: none;
  appearance: none;
}
#waiter-login-form select:focus,
#waiter-login-form input:focus,
#cabinet-login-form input:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}
.modal {
  background: #fff; border-radius: 20px; padding: 28px;
  width: min(440px, 100%); box-shadow: 0 24px 48px rgba(15, 23, 42, 0.15);
}
.modal h2 { margin: 0 0 8px; font-size: 1.25rem; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }

.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--emerald-950); color: #fff;
  padding: 14px 20px; border-radius: 14px;
  font-weight: 600; z-index: 25000;
  box-shadow: 0 12px 32px rgba(0,0,0,0.2);
}
.hidden { display: none !important; }
.toast.hidden { display: none !important; }
/* Some elements (e.g. the "delete custom sound" ✕ button) toggle the native
   `hidden` attribute via JS instead of the `.hidden` class. The browser's
   built-in `[hidden] { display: none }` rule is easily beaten by our own
   `.btn { display: inline-flex }` rule, so without this override those
   elements stayed visible even while marked `hidden`. */
[hidden] { display: none !important; }

.sidebar-status-badges {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.receiver-status-badge {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 0.72rem;
  line-height: 1.3;
  white-space: normal;
  font-weight: 600;
}
.receiver-status-on {
  animation: receiver-pulse-on 2.4s ease-in-out infinite;
}
.receiver-status-off {
  animation: receiver-pulse-off 1.6s ease-in-out infinite;
  border: 1px solid rgba(239, 68, 68, 0.45);
}
@keyframes receiver-pulse-on {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
  50% { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18); }
}
@keyframes receiver-pulse-off {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
  50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.22); }
}

.bind-success-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  animation: bind-success-fade-in 0.25s ease;
}
/* Receiver connect/disconnect popup permanently disabled — blocked the mobile cabinet. */
#receiver-status-overlay,
#receiver-status-overlay.hidden {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
.bind-success-card {
  width: min(440px, 100%);
  padding: 32px 28px 24px;
  border-radius: 16px;
  background: #fff;
  border: 2px solid var(--accent);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
  text-align: center;
}
.bind-success-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #059669, #047857);
  color: #fff;
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 72px;
  box-shadow: 0 8px 24px rgba(5, 150, 105, 0.35);
}
.receiver-status-icon {
  font-size: 2rem;
  line-height: 72px;
}
#receiver-status-card.disconnected {
  border-color: var(--danger);
}
#receiver-status-card.disconnected .receiver-status-icon {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  box-shadow: 0 8px 24px rgba(220, 38, 38, 0.35);
}
.bind-success-card h2 {
  margin: 0 0 12px;
  font-size: 1.35rem;
  color: var(--slate-800);
}
.bind-success-detail {
  margin: 0 0 20px;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--slate-600);
}
.bind-success-btn {
  min-width: 140px;
  font-size: 1rem;
  padding: 10px 24px;
}
@keyframes bind-success-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.insight-tile {
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--emerald-50);
  border: 1px solid rgba(5, 150, 105, 0.15);
}
.insight-tile.warn {
  background: #fff7ed;
  border-color: rgba(217, 119, 6, 0.25);
}
.insight-tile h3 {
  margin: 0 0 6px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-500);
}
.insight-tile p {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--slate-800);
  line-height: 1.35;
}
.insight-tile small {
  display: block;
  margin-top: 6px;
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--slate-500);
}
.ai-insights-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.ai-insights-body {
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 0.95rem;
  color: var(--slate-700);
  padding: 12px 0 4px;
}
.ai-prompt-area {
  width: 100%;
  min-height: 180px;
  font-family: inherit;
  font-size: 0.9rem;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--slate-200);
}
.waiter-select { min-width: 160px; max-width: 220px; }

.call-staff-filter {
  position: relative;
  flex: 0 1 240px;
  min-width: 180px;
  max-width: 300px;
}
.call-staff-filter-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--slate-200);
  background: #fff;
  color: var(--slate-900);
  font: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.call-staff-filter-btn.has-selection {
  border-color: rgba(5, 150, 105, 0.45);
  background: rgba(16, 185, 129, 0.04);
}
.call-staff-filter-btn:hover,
.call-staff-filter.open .call-staff-filter-btn {
  border-color: #10b981;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
}
.call-staff-filter-icon {
  flex: none;
  font-size: 0.95rem;
  line-height: 1;
  opacity: 0.72;
}
.call-staff-filter-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.92rem;
  font-weight: 500;
}
.call-staff-filter-count {
  flex: none;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 22px;
  background: #059669;
  color: #fff;
  text-align: center;
}
.call-staff-filter-count.hidden { display: none !important; }
.call-staff-filter-caret {
  flex: none;
  color: var(--slate-500);
  font-size: 0.85rem;
  transition: transform 0.15s ease;
}
.call-staff-filter.open .call-staff-filter-caret { transform: rotate(180deg); }
.call-staff-filter-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: auto;
  z-index: 50;
  width: min(340px, calc(100vw - 24px));
  max-height: min(420px, 58vh);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  border: 1px solid var(--slate-200);
  background: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
}
.call-staff-filter-panel.hidden { display: none !important; }
.call-staff-filter-head {
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--slate-100);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.call-staff-filter-search {
  width: 100%;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--slate-200);
  padding: 0 12px;
  font: inherit;
  font-size: 0.9rem;
  background: var(--slate-50);
  color: var(--slate-900);
}
.call-staff-filter-search:focus {
  outline: none;
  border-color: #10b981;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}
.call-staff-filter-actions {
  display: flex;
  gap: 8px;
}
.call-staff-filter-actions .btn {
  flex: 1;
  justify-content: center;
  min-height: 34px;
  font-size: 0.82rem;
}
.call-staff-filter-list {
  overflow-y: auto;
  padding: 6px 8px;
  flex: 1;
  min-height: 0;
}
.call-staff-filter-foot {
  padding: 8px 12px;
  border-top: 1px solid var(--slate-100);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--slate-500);
  background: var(--slate-50);
}
.call-staff-filter-foot.hidden { display: none !important; }
.call-staff-filter-empty {
  margin: 12px 8px;
  font-size: 0.88rem;
  text-align: center;
}
.call-staff-filter-group + .call-staff-filter-group {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--slate-100);
}
.call-staff-filter-group-title {
  padding: 4px 10px 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--slate-500);
}
.call-staff-filter-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  margin-bottom: 2px;
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s ease;
}
.call-staff-filter-item:hover { background: var(--slate-50); }
.call-staff-filter-item.selected {
  background: rgba(16, 185, 129, 0.1);
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.22);
}
.call-staff-filter-item.inactive { opacity: 0.72; }
.call-staff-filter-item input {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: #059669;
  cursor: pointer;
}
.call-staff-filter-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.call-staff-filter-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--slate-800);
  line-height: 1.3;
  word-break: break-word;
}
.call-staff-filter-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.call-staff-filter-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
}
.call-staff-filter-tag.on {
  background: rgba(16, 185, 129, 0.14);
  color: #047857;
}
.call-staff-filter-tag.off {
  background: rgba(148, 163, 184, 0.18);
  color: var(--slate-600);
}
.call-staff-filter-tag.inactive {
  background: rgba(239, 68, 68, 0.1);
  color: #b91c1c;
}
.call-staff-filter-tag.role {
  background: rgba(2, 132, 199, 0.1);
  color: #0369a1;
}
.tab-badge {
  display: inline-block;
  min-width: 18px;
  padding: 1px 6px;
  margin-left: 4px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  background: #e11d48;
  color: #fff;
  vertical-align: middle;
}
.tab-badge.hidden { display: none !important; }
.admin-tab.tab-has-alerts {
  color: #be123c;
  font-weight: 700;
}
.btn-danger-text { color: #be123c !important; border-color: rgba(190, 18, 60, 0.35) !important; }
.btn-danger { background: #be123c !important; border-color: #be123c !important; }
.btn-danger:hover { background: #e11d48 !important; }
.analytics-reset-modal { max-width: 440px; }
.form-error { color: #be123c; font-size: 0.88rem; margin: 8px 0 0; }
.form-error.hidden { display: none !important; }
.receivers-modal-card {
  width: min(920px, 96vw);
  max-height: 92vh;
  overflow: auto;
  padding: 20px 22px 24px;
  background: #fff;
  border-radius: 14px;
}
.tenant-cred-overlay { z-index: 12000; background: rgba(15, 23, 42, 0.55); backdrop-filter: blur(3px); }
.tenant-credentials-modal {
  width: min(460px, 100%);
  max-height: min(92vh, 640px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 28px 64px rgba(15, 23, 42, 0.28);
  border: 1px solid var(--slate-200);
  overflow: hidden;
}
.tenant-credentials-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--slate-100);
  background: #fafbfc;
}
.tenant-credentials-head h2 { margin: 0 0 4px; font-size: 1.1rem; }
.tenant-credentials-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}
.tenant-credentials-foot {
  padding: 12px 20px 18px;
  border-top: 1px solid var(--slate-100);
  background: #fafbfc;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
}
.tenant-credentials-actions { display: flex; gap: 8px; margin-left: auto; }
.tenant-cred-link-box {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--emerald-50);
  border: 1px solid rgba(5, 150, 105, 0.2);
  margin-bottom: 14px;
}
.tenant-cred-link-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--slate-500);
  margin-bottom: 6px;
}
.tenant-cred-link {
  display: block;
  word-break: break-all;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--emerald-900);
  margin-bottom: 8px;
}
.tenant-cred-field { margin-bottom: 12px; }
.tenant-cred-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--slate-600);
  margin-bottom: 5px;
}
.tenant-cred-field input {
  width: 100%;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--slate-200);
  padding: 0 12px;
  font-size: 0.92rem;
  background: #fff;
  pointer-events: auto;
}
.tenant-credentials-modal input,
#cabinet-login-form input {
  pointer-events: auto;
}
.tenant-cred-field input:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}
.tenant-cred-hint { margin: 6px 0 0; font-size: 0.78rem; }
.password-input-wrap {
  display: flex;
  gap: 6px;
  align-items: center;
}
.password-input-wrap input { flex: 1; min-width: 0; }
.password-toggle { flex-shrink: 0; min-width: 40px; }
.tenant-delete-modal { width: min(440px, 100%); }
.tenant-delete-warn {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #9f1239;
  font-size: 0.86rem;
  line-height: 1.45;
}
.tenant-delete-modal input { width: 100%; height: 42px; border-radius: 10px; border: 1px solid var(--slate-200); padding: 0 12px; }
.tenant-churned-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.receivers-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.receivers-mode-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.receivers-mode-btn.active {
  border-color: var(--emerald-600);
  background: var(--emerald-50);
  color: var(--emerald-900);
}
.receivers-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}
.receivers-add-grid { margin: 12px 0 8px; }
.receivers-add-hint { margin: 8px 0 0; font-size: 0.85rem; }
.receivers-pair-box { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border, #e5e5e5); }
.receivers-pair-box .muted-text { margin: 6px 0 0; font-size: 0.85rem; }
.receivers-pair-status { margin-top: 10px; }
.receivers-pair-waiting { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.85rem; }
.spinner-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f9a825;
  display: inline-block;
  animation: qwik-pulse 1s ease-in-out infinite;
}
@keyframes qwik-pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1); }
}
.receiver-setup-card {
  margin: 14px 0 8px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--slate-200, #e2e8f0);
  background: var(--surface-2, #f8fafc);
}
.receiver-setup-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--slate-800, #1e293b);
}
.receiver-setup-text {
  margin: 0;
  line-height: 1.5;
  color: var(--slate-700, #334155);
  font-size: 0.92rem;
}
.receivers-assign-title { margin: 16px 0 6px; font-size: 1rem; }
#cabinet-receivers-admin.hidden,
#cabinet-receivers-assign.hidden { display: none !important; }
.receivers-list { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.receiver-item {
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  padding: 12px 14px;
  background: #fafafa;
}
.receiver-item.online { border-color: rgba(5, 150, 105, 0.35); }
.receiver-item-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.receiver-key {
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  word-break: break-all;
  color: var(--slate-600);
}
.receivers-assign-scroll {
  max-height: 320px;
  overflow: auto;
  margin-top: 10px;
}
.receiver-assign-block {
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.receiver-assign-block h4 { margin: 0 0 8px; font-size: 0.95rem; }
.rcv-btn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px 10px;
}
.rcv-btn-grid label {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.82rem;
  line-height: 1.3;
}
.admin-errors-scroll {
  max-height: min(70vh, 720px);
  overflow: auto;
}
.admin-errors-table td { vertical-align: top; font-size: 0.85rem; }
.admin-errors-table .err-msg { max-width: 220px; word-break: break-word; }
.admin-errors-table .err-desc { max-width: 260px; color: var(--slate-600); }
.err-row-unresolved { background: rgba(254, 243, 199, 0.45); }
.err-row-system-critical {
  background: rgba(254, 202, 202, 0.55) !important;
  border-left: 3px solid #dc2626;
}
.err-row-system-critical td.err-msg { color: #991b1b; font-weight: 600; }
.err-row-ignored { opacity: 0.72; }
.badge.muted { background: var(--slate-100); color: var(--slate-600); }
.badge-danger, #errors-unresolved-badge.badge-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.tab-badge.badge-danger { background: #dc2626; color: #fff; }
.err-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.analytics-filters {
  display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-end;
}
.filter-block { display: flex; flex-direction: column; gap: 6px; }
.filter-block .filter-select { min-width: 180px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--slate-200); }
.filter-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-label { font-size: 0.8rem; font-weight: 700; color: var(--slate-500); margin-right: 4px; }
.analytics-period.active {
  background: var(--emerald-900) !important;
  color: #fff !important;
  border-color: var(--emerald-900) !important;
}
.analytics-period-group {
  flex: 1 1 100%;
}
.stats-custom-range {
  flex: 1 1 100%;
  align-items: flex-start;
}
.stats-date-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.stats-date-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 150px;
}
.stats-date-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--slate-500);
}
.stats-date-input {
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--slate-200);
  padding: 0 12px;
  background: #fff;
  color: var(--slate-900);
  font: inherit;
}
.stats-date-input:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
}
.chart-box { position: relative; height: 280px; width: 100%; contain: layout paint style; overflow: hidden; }
.chart-box-sm { height: 220px; }
.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 1rem;
  text-align: center;
  color: var(--muted, #64748b);
  font-size: 0.95rem;
  pointer-events: none;
}
#panel-stats .card { contain: layout style; }
#stats-live-badge.pulse { animation: live-pulse 2s infinite; }
@keyframes live-pulse {
  50% { opacity: 0.65; }
}

.debug-console {
  margin-top: 12px;
  min-height: 220px;
  max-height: 480px;
  overflow: auto;
  background: #0f172a;
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  padding: 12px 14px;
  border-radius: 10px;
  white-space: pre-wrap;
  word-break: break-word;
}
.debug-line-api { color: #7dd3fc; }
.debug-line-call { color: #86efac; }
.debug-line-error { color: #fca5a5; }
.debug-line-warn { color: #fcd34d; }

.empty-state {
  text-align: center; padding: 48px 24px; color: var(--slate-500);
}
.empty-state h3 { margin: 0 0 8px; color: var(--slate-700); }

/* PWA + mobile waiter UX */
.mobile-top-bar,
.mobile-bottom-nav,
.pwa-action-bar { display: none; }

@media (max-width: 900px) {
  html {
    overflow-x: hidden;
    overflow-y: auto;
    max-width: 100vw;
    height: auto;
    -webkit-overflow-scrolling: touch;
  }
  body {
    overflow-x: hidden;
    overflow-y: auto;
    max-width: 100vw;
    min-height: 100dvh;
    overscroll-behavior-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y pinch-zoom;
  }
  body.mobile-sidebar-open {
    overflow: hidden;
    height: 100svh;
    height: 100dvh;
    touch-action: none;
  }
  .app-layout {
    flex-direction: column;
    min-height: auto;
    padding-bottom: env(safe-area-inset-bottom, 0);
    overflow: visible;
    max-width: 100vw;
  }
  .main-area {
    overflow: visible;
    flex: 1 0 auto;
    touch-action: pan-y pinch-zoom;
    padding: 12px;
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0));
    max-width: 100vw;
  }
  .card, .page-header, .filters-row, .calls-mobile-list, .assignments-mobile-list {
    max-width: 100%;
    min-width: 0;
  }
  .mobile-banners {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
  }
  .mobile-banners:not(:has(.pwa-action-bar:not(.hidden))) {
    margin-bottom: 0;
  }
  .mobile-top-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 10px 12px;
    padding-top: calc(10px + env(safe-area-inset-top, 0));
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--slate-200);
  }
  .mobile-auth-btn {
    flex-shrink: 0;
    max-width: 42%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .settings-time-grid {
    margin-bottom: 0.75rem;
  }
  .settings-time-status {
    margin: 0.5rem 0 0.75rem;
    font-size: 0.9rem;
  }
  .mobile-menu-btn {
    width: 42px;
    height: 42px;
    border: 1px solid var(--slate-200);
    border-radius: 12px;
    background: #fff;
    font-size: 1.2rem;
    cursor: pointer;
  }
  .mobile-top-title {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .mobile-top-brand { font-weight: 800; font-size: 0.95rem; color: var(--emerald-900); }
  .mobile-top-venue {
    font-size: 0.78rem;
    color: var(--slate-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .push-status-chip {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 6px 8px;
    border-radius: 999px;
    background: var(--slate-100);
    color: var(--slate-600);
    white-space: nowrap;
  }
  .push-status-chip[data-state="on"] { background: #d1fae5; color: #065f46; }
  .push-status-chip[data-state="blocked"] { background: #fee2e2; color: #991b1b; }

  .pwa-action-bar {
    display: block;
    margin: 0;
    padding: 12px 14px;
    border-radius: 14px;
    background: linear-gradient(135deg, #ecfdf5, #f0fdf4);
    border: 1px solid #a7f3d0;
    font-size: 0.82rem;
    line-height: 1.35;
  }
  .pwa-action-bar.hidden { display: none; }
  .pwa-action-bar p { margin: 0 0 10px; color: var(--slate-700); }
  .waiter-push-bar.ok {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border-color: #6ee7b7;
  }
  .waiter-push-bar.warn {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border-color: #fcd34d;
  }
  .pwa-action-btns { display: flex; flex-wrap: wrap; gap: 8px; }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(88vw, 320px);
    max-width: 320px;
    z-index: 60;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    box-shadow: 12px 0 40px rgba(15, 23, 42, 0.18);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: -1;
  }
  .sidebar.mobile-open::after {
    opacity: 1;
    pointer-events: auto;
  }

  .big-alert {
    position: fixed;
    left: 12px;
    right: 12px;
    top: calc(52px + env(safe-area-inset-top, 0));
    z-index: 45;
    margin: 0;
    font-size: 1rem;
    padding: 14px 16px;
    max-height: 28vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  #panel-calls .card:first-of-type,
  #panel-assignments .card { margin-top: 0; }
  .page-header {
    margin-bottom: 10px;
    gap: 8px;
  }
  .page-header h1 { margin: 0 0 4px; line-height: 1.2; }
  .header-badges .badge { font-size: 0.78rem; }
  #calls-stats,
  #panel-calls .page-header > div > p,
  #panel-assignments .page-header > div > p { display: none; }
  .calls-desktop-table,
  .assignments-desktop-table { display: none !important; }
  .calls-mobile-list,
  .assignments-mobile-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: none;
    overflow: visible;
    overscroll-behavior: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y pinch-zoom;
  }
  .call-mobile-card {
    border: 1px solid var(--slate-200);
    border-radius: 14px;
    padding: 12px 14px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
  }
  .call-mobile-card.call-mobile-pending {
    border-color: #fcd34d;
    background: #fffbeb;
  }
  .call-mobile-card.call-mobile-pending-warn {
    border-color: #f59e0b;
    background: #fffbeb;
  }
  .call-mobile-card.call-mobile-pending-alert {
    border-color: #f87171;
    background: #fef2f2;
  }
  .call-mobile-card.call-mobile-guest-order {
    border-color: #f9a8d4;
    background: #fdf2f8;
  }
  .call-mobile-order-hint {
    margin-top: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #9d174d;
    line-height: 1.3;
  }
  .call-mobile-card.call-mobile-cancelled {
    border-color: #fecaca;
    background: #fef2f2;
  }
  .call-mobile-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
  }
  .call-mobile-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--emerald-900);
    line-height: 1.25;
  }
  .call-mobile-func { margin-bottom: 4px; }
  .call-mobile-meta {
    font-size: 0.82rem;
    color: var(--slate-500);
    margin-bottom: 10px;
  }
  .btn-accept-mobile {
    width: 100%;
    min-height: 48px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 12px;
  }
  .assign-mobile-card {
    border: 1px solid var(--slate-200);
    border-radius: 14px;
    padding: 12px 14px;
    background: #fff;
  }
  .assign-mobile-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
  }
  .assign-mobile-head b { font-size: 1rem; }
  .assign-mobile-zone {
    font-size: 0.8rem;
    color: var(--slate-500);
    white-space: nowrap;
  }
  .assign-mobile-staff {
    font-size: 0.88rem;
    line-height: 1.45;
    margin-bottom: 10px;
  }
  .btn-assign-mobile {
    width: 100%;
    min-height: 44px;
    border-radius: 12px;
  }
  .calls-mobile-empty { text-align: center; padding: 24px 8px; }
  .waiter-login-empty {
    margin: 10px 0 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: #fff7ed;
    border: 1px solid #fdba74;
    color: #9a3412;
    font-size: 0.85rem;
    line-height: 1.4;
  }
  #waiter-login-modal.modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  #waiter-login-modal .modal {
    width: 100%;
    max-width: 100%;
    max-height: min(94dvh, 720px);
    border-radius: 20px 20px 0 0;
    margin: 0;
    padding: 20px 18px max(18px, env(safe-area-inset-bottom));
  }
  #waiter-login-modal .modal-head h2 {
    font-size: 1.2rem;
  }
  #waiter-login-modal .modal-head .muted-text {
    font-size: 0.88rem;
    line-height: 1.45;
  }
  #pairing-login-modal.modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  #pairing-login-modal .modal {
    width: 100%;
    max-width: 100%;
    max-height: min(94dvh, 720px);
    border-radius: 20px 20px 0 0;
    margin: 0;
    padding: 0;
  }
  #waiter-login-form select,
  #waiter-login-form input,
  #cabinet-login-form input {
    min-height: 50px;
    font-size: 17px;
    padding: 13px 14px;
  }
  .ios-warn-bar {
    background: #7f1d1d;
    color: #fff;
    border-bottom: 1px solid #991b1b;
  }
  .ios-warn-bar p { color: #fecaca; margin: 0; }
  .yandex-warn-bar {
    background: #422006;
    color: #fff;
    border: 1px solid #b45309;
  }
  .yandex-warn-bar p { color: #fde68a; margin: 0; }

  .yandex-perm-modal { max-width: min(100%, 420px); }
  .yandex-perm-url-label { margin: 0 0 6px; font-size: 0.82rem; }
  .yandex-perm-url-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
    margin-bottom: 14px;
  }
  .yandex-perm-url {
    flex: 1;
    min-width: 0;
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid var(--slate-200);
    font-size: 0.75rem;
    word-break: break-all;
    line-height: 1.35;
  }
  .yandex-perm-steps {
    margin: 0 0 14px;
    padding-left: 1.2rem;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--slate-700);
  }
  .yandex-perm-steps li { margin-bottom: 12px; }
  .yandex-perm-note {
    margin: 0 0 4px;
    font-size: 0.82rem;
    line-height: 1.45;
    padding: 10px 12px;
    border-radius: 10px;
    background: #fff7ed;
    border: 1px solid #fdba74;
  }
  .yandex-perm-actions {
    flex-wrap: wrap;
    gap: 8px;
    justify-content: stretch;
  }
  #yandex-perm-modal .yandex-perm-actions .btn {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
  }
  #yandex-perm-modal .yandex-perm-actions .btn-primary {
    flex: 1 1 100%;
  }

  .page-header h1 { font-size: 1.35rem; }
  .filters-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .filters-row .search-input,
  .filters-row select,
  .filters-row .call-staff-filter {
    width: 100%;
    max-width: none;
    min-width: 0;
    font-size: 16px;
  }
  .filters-row .call-staff-filter { flex: none; width: 100%; max-width: none; }
  .call-staff-filter-panel {
    left: 0;
    right: 0;
    width: auto;
  }
  .stats-date-inputs { flex-direction: column; align-items: stretch; }
  .stats-date-field { width: 100%; min-width: 0; }
  .stats-date-input { width: 100%; font-size: 16px; }
  #stats-date-apply { width: 100%; }

  .mobile-bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    padding: 6px 4px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0));
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--slate-200);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
  }
  .mobile-nav-item {
    display: flex;
    flex: 1 1 0;
    min-width: 0;
    max-width: 5.5rem;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: none;
    background: transparent;
    color: var(--slate-500);
    font-size: 0.62rem;
    font-weight: 600;
    padding: 6px 2px;
    cursor: pointer;
  }
  .mobile-nav-item span:last-child {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile-nav-item.hidden { display: none !important; }
  .mobile-nav-item.active { color: var(--emerald-700); }
  body.waiter-cabinet .mobile-nav-item[data-tab]:not([data-tab="calls"]):not([data-tab="assignments"]):not([data-tab="guest-orders"]) {
    display: none !important;
  }
  body.waiter-cabinet #btn-cabinet-login,
  body.waiter-cabinet #cabinet-auth-bar:not(.hidden) + #waiter-auth-bar,
  body.waiter-cabinet .platform-admin-only,
  body.waiter-cabinet .owner-only-settings,
  body.waiter-cabinet #call-staff-filter {
    display: none !important;
  }
  body.waiter-cabinet #cabinet-auth-bar { display: none !important; }
  body.waiter-cabinet #waiter-auth-bar:not(.hidden) { display: flex !important; }
  .emp-waiter-link-block { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--slate-200); }
  .mobile-nav-icon { font-size: 1.15rem; line-height: 1; }
  .mobile-nav-more.active { color: var(--emerald-700); }

  .nav-list {
    flex-direction: column;
    flex-wrap: nowrap;
    max-height: none;
    overflow: visible;
  }
  .nav-item { flex: none; width: 100%; min-width: 0; }

  /* Bottom nav (~60px + safe-area) would otherwise cover the toast. */
  .toast {
    left: 12px;
    right: 12px;
    bottom: calc(72px + env(safe-area-inset-bottom, 0));
    text-align: center;
  }

  /* Comfortable touch targets on phones (desktop density stays untouched). */
  .btn-small { min-height: 40px; padding: 8px 12px; }

  /* The platform admin panel (admin.html) has no bottom nav / hamburger of its
     own — it just inherits the cabinet's off-canvas sidebar + nav spacing.
     Re-show the sidebar inline (it only holds branding + legal links there)
     and drop the reserved bottom-nav padding so the layout isn't broken. */
  body.admin-page .sidebar {
    position: static;
    transform: none;
    width: 100%;
    height: auto;
    box-shadow: none;
    border-bottom: 1px solid var(--slate-200);
    padding: 12px 16px;
  }
  body.admin-page .main-area {
    padding-bottom: 12px;
  }
  body.admin-page .admin-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  body.admin-page .admin-tab {
    flex: none;
    white-space: nowrap;
  }
}

@media (min-width: 901px) {
  .calls-mobile-list,
  .assignments-mobile-list { display: none !important; }
}

@media (display-mode: standalone) and (max-width: 900px) {
  .mobile-top-bar {
    background: var(--mobile-top-bg, var(--emerald-900));
    color: #fff;
    border-bottom-color: var(--mobile-top-border, var(--emerald-800));
  }
  .mobile-top-brand { color: #fff; }
  .mobile-top-venue { color: rgba(255, 255, 255, 0.78); }
  .mobile-menu-btn {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
  }
  .push-status-chip[data-state="on"] {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
  }
}

.menu-editor { display: flex; flex-direction: column; gap: 16px; }
.menu-empty-state { padding: 8px 0 4px; }
.menu-empty-state p { margin: 0 0 8px; }
.menu-cat-block { border: 1px solid var(--slate-200); border-radius: 12px; padding: 12px; }
.menu-cat-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.menu-cat-name { font-weight: 700; font-size: 1rem; flex: 1; min-width: 160px; padding: 8px; border-radius: 8px; border: 1px solid var(--slate-200); }
.menu-item-row { display: flex; flex-wrap: wrap; gap: 12px; padding: 12px 0; border-top: 1px solid var(--slate-100); }
.menu-item-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.menu-item-thumb-missing { display: inline-flex; align-items: center; justify-content: center; background: var(--slate-100); font-size: 1.4rem; opacity: 0.5; }
.menu-item-fields { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 6px; }
.menu-item-fields input, .menu-item-fields textarea { padding: 8px; border-radius: 8px; border: 1px solid var(--slate-200); }
.menu-item-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.guest-orders-list { display: flex; flex-direction: column; gap: 12px; }
.guest-order-card { background: var(--card-bg, #fff); border-radius: 12px; padding: 14px; border: 1px solid var(--slate-200); }
.guest-order-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.guest-order-lines { margin: 0 0 8px; padding-left: 18px; }
.guest-order-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* Platform storage meter */
.storage-health-banner {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--slate-200, #cbd5e1);
  background: var(--slate-50, #f8fafc);
  font-weight: 600;
  font-size: 0.92rem;
}
.storage-health-banner.is-ok {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}
.storage-health-banner.is-warn {
  border-color: #fcd34d;
  background: #fffbeb;
  color: #92400e;
}
.storage-health-banner.is-critical {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #991b1b;
}
.storage-meter-wrap { max-width: 720px; }
.storage-meter-label { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 6px; font-size: 0.92rem; }
.storage-meter { height: 14px; border-radius: 999px; background: var(--slate-100, #e2e8f0); overflow: hidden; border: 1px solid var(--slate-200, #cbd5e1); }
.storage-meter-fill { height: 100%; width: 0%; border-radius: inherit; background: linear-gradient(90deg, #16a34a, #ca8a04 70%, #dc2626); transition: width 0.35s ease; }
.storage-meter-fill-mem { background: linear-gradient(90deg, #0284c7, #ca8a04 75%, #dc2626); }
.storage-purge-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.storage-purge-row input[type="number"] { width: 72px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--slate-200); }
.storage-tenants-scroll {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--slate-200, #e2e8f0);
  border-radius: 10px;
}
.storage-tenants-scroll.is-scrollable {
  max-height: min(520px, 60vh);
}
.storage-tenants-scroll table { margin: 0; }
.storage-tenants-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--card-bg, #fff);
  box-shadow: 0 1px 0 var(--slate-200, #e2e8f0);
}
.storage-tenant-meta { display: block; font-size: 0.78rem; color: var(--slate-500); margin-top: 2px; }
.storage-live-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
  color: #166534;
  background: #dcfce7;
  border: 1px solid #86efac;
}
.storage-live-badge.is-off {
  color: #64748b;
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.storage-count-flash {
  animation: storageCountFlash 0.7s ease;
}
@keyframes storageCountFlash {
  0% { background: #bbf7d0; }
  100% { background: transparent; }
}

/* Respect the OS-level "reduce motion" accessibility setting: keep the visual
   state (color/shadow) that each animation ends up conveying, just without the
   looping motion. Scoped narrowly so nothing else on the page is affected. */
@media (prefers-reduced-motion: reduce) {
  .pairing-dot { animation: none; opacity: 1; transform: none; }
  .data-table tr.row-cancelled-flash td { animation: none; }
  .receiver-status-on,
  .receiver-status-off { animation: none; }
  #stats-live-badge.pulse { animation: none; }
  .storage-count-flash { animation: none; }
  .main-area,
  .big-alert { animation: none; }
}
