:root {
  --bg: #0b101b;
  --panel: #111827;
  --panel-2: #172033;
  --border: rgba(148, 163, 184, 0.16);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --sky: #38bdf8;
  --emerald: #10b981;
  --amber: #f59e0b;
  --rose: #f43f5e;
  --violet: #a78bfa;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(circle at top right, #172554 0%, #0b101b 45%);
  color: var(--text);
  font-family: "Be Vietnam Pro", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

.mono { font-family: "JetBrains Mono", monospace; }
.hidden { display: none !important; }

.admin-shell {
  max-width: 1480px;
  margin: 0 auto;
  padding: 18px 22px 48px;
}

/* TOPBAR */
.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 18px;
  background: rgba(17, 24, 39, 0.88);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  display: grid;
  place-items: center;
  font-size: 22px;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tag-admin {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.16);
  color: var(--sky);
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.brand-sub {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn-primary { background: linear-gradient(135deg, #0284c7, #2563eb); color: #fff; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-sky { background: rgba(56, 189, 248, 0.18); color: #7dd3fc; border-color: rgba(56, 189, 248, 0.45); }
.btn-sky:hover { background: rgba(56, 189, 248, 0.28); }
.btn-emerald { background: rgba(16, 185, 129, 0.16); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.4); }
.btn-danger { background: rgba(244, 63, 94, 0.16); color: #fda4af; border-color: rgba(244, 63, 94, 0.4); }
.btn-danger:hover { background: rgba(244, 63, 94, 0.28); }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--sky); color: #fff; }
.btn-ghost { background: rgba(30, 41, 59, 0.8); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: rgba(51, 65, 85, 0.9); }

/* KPI GRID */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

@media (max-width: 1150px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px) { .kpi-grid { grid-template-columns: 1fr; } }

.kpi-card {
  background: rgba(17, 24, 39, 0.9);
  border: 1px solid var(--border);
  border-top: 3px solid var(--sky);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.kpi-card.accent-emerald { border-top-color: var(--emerald); }
.kpi-card.accent-rose { border-top-color: var(--rose); }
.kpi-card.accent-sky { border-top-color: var(--sky); }
.kpi-card.accent-amber { border-top-color: var(--amber); }
.kpi-card.accent-violet { border-top-color: var(--violet); }

.kpi-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 26px; font-weight: 700; margin: 6px 0 4px; color: #f8fafc; }
.kpi-sub { font-size: 11.5px; color: var(--muted); }

/* TABS */
.tab-bar {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-btn.active { color: #fff; border-bottom-color: var(--sky); }
.tab-count {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.16);
  color: var(--sky);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* TOOLBAR */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.search-input {
  flex: 1;
  min-width: 260px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
}

.search-input:focus { outline: none; border-color: var(--sky); }

.filter-group { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.chip.active { background: rgba(56, 189, 248, 0.18); color: #e0f2fe; border-color: var(--sky); }

/* TABLES */
.table-wrap {
  background: rgba(17, 24, 39, 0.88);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 12px 14px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.6);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  vertical-align: top;
}

.data-table tr:hover td { background: rgba(30, 41, 59, 0.35); }
.empty-cell { text-align: center; color: var(--muted); padding: 28px !important; }

.room-cell { display: flex; gap: 12px; align-items: flex-start; min-width: 240px; }
.room-thumb {
  width: 68px;
  height: 54px;
  border-radius: 8px;
  object-fit: cover;
  background: #1e293b;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.room-code { font-weight: 700; color: var(--sky); font-size: 13.5px; }
.room-name { font-weight: 600; color: #f8fafc; margin-top: 2px; }
.meta-small { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

.pill-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.mini-pill {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(51, 65, 85, 0.7);
  color: #cbd5e1;
}
.mini-pill.unit { background: rgba(56, 189, 248, 0.14); color: #7dd3fc; }
.mini-pill.boss { background: rgba(245, 158, 11, 0.22); color: #fcd34d; font-weight: 600; }

.status-select {
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.status-select.st-available { border-color: rgba(16, 185, 129, 0.5); color: #6ee7b7; }
.status-select.st-rented { border-color: rgba(244, 63, 94, 0.5); color: #fda4af; }
.status-select.st-hidden, .status-select.st-sample_ignored { color: var(--muted); }

.action-cell { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

/* DUAL PANEL TAB 2 */
.dual-section { display: flex; flex-direction: column; gap: 20px; }
.panel-box { display: flex; flex-direction: column; gap: 10px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; }
.panel-head h2 { margin: 0; font-size: 15.5px; }

/* SCENARIOS TAB 3 */
.hint-text { font-size: 12px; color: var(--muted); }
.scenarios-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 960px) { .scenarios-grid { grid-template-columns: 1fr; } }

.scenario-card {
  background: rgba(17, 24, 39, 0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.scenario-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.scenario-key { font-family: "JetBrains Mono", monospace; font-size: 12.5px; color: var(--sky); font-weight: 600; }
.scenario-card label { font-size: 11.5px; color: var(--muted); display: block; margin-bottom: 3px; }
.scenario-card textarea, .scenario-card input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  resize: vertical;
}
.scenario-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }

/* MODAL */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 18px;
}

.modal-dialog {
  background: var(--panel);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 16px;
  width: 100%;
  max-width: 980px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}

.modal-header, .modal-footer {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.modal-footer { border-bottom: none; border-top: 1px solid var(--border); justify-content: flex-end; }
.modal-header h3 { margin: 0; font-size: 16px; }
.btn-icon-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.autoparse-box {
  background: rgba(2, 132, 199, 0.1);
  border: 1px dashed rgba(56, 189, 248, 0.45);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.autoparse-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: #bae6fd; }
.autoparse-box textarea {
  width: 100%;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 780px) { .form-grid { grid-template-columns: repeat(2, 1fr); } }
.span-2 { grid-column: span 2; }
.span-4 { grid-column: span 4; }
@media (max-width: 780px) { .span-4 { grid-column: span 2; } }

.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
.field input[type="text"], .field input[type="number"], .field select, .field textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
}
.checkbox-inline { display: flex; align-items: flex-end; padding-bottom: 6px; }
.checkbox-inline label { display: flex; align-items: center; gap: 6px; color: var(--text); cursor: pointer; margin: 0; }

.section-divider {
  font-size: 13px;
  font-weight: 700;
  color: #bae6fd;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.amenities-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
@media (max-width: 780px) { .amenities-grid { grid-template-columns: repeat(2, 1fr); } }
.amenity-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 7px 9px;
  border-radius: 8px;
  cursor: pointer;
}

.subunits-list { display: flex; flex-direction: column; gap: 8px; }
.subunit-row {
  display: grid;
  grid-template-columns: 110px 140px 150px 1fr 40px;
  gap: 8px;
  align-items: center;
}

.dropzone {
  border: 1.5px dashed rgba(56, 189, 248, 0.45);
  border-radius: 12px;
  padding: 14px;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.dropzone.dragover { background: rgba(56, 189, 248, 0.14); border-color: var(--sky); }
.dropzone p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }

.pending-queue {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.14);
  color: #fde68a;
  font-size: 12px;
}

.thumbs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.thumb-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg);
}
.thumb-item img { width: 100%; height: 92px; object-fit: cover; display: block; }
.thumb-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  font-size: 9.5px;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.88);
  color: #fff;
  font-weight: 700;
}
.thumb-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(244, 63, 94, 0.92);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.cloud-push-bar {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.35);
  font-size: 12.5px;
}
.cloud-push-bar label { display: flex; align-items: center; gap: 8px; cursor: pointer; }

/* TOAST */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}
.toast {
  padding: 11px 16px;
  border-radius: 10px;
  background: #0f172a;
  border: 1px solid var(--sky);
  color: #f8fafc;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
.toast.ok { border-color: var(--emerald); }
.toast.err { border-color: var(--rose); }

/* V8: ADMIN LOCK OVERLAY & UNIFIED VOICE CONFIG BAR */
.lock-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, #172554 0%, #070b14 75%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 300;
}

.lock-card {
  width: min(440px, 95vw);
  background: rgba(17, 24, 39, 0.94);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 18px;
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

.lock-icon {
  font-size: 40px;
  margin-bottom: 10px;
}

.lock-card h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.lock-sub {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.lock-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  margin-bottom: 10px;
}

.lock-input:focus {
  outline: none;
  border-color: var(--sky);
}

.lock-error {
  color: #fda4af;
  font-size: 12.5px;
  margin-bottom: 12px;
}

.lock-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 6px;
}

.voice-config-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 18px;
  background: rgba(2, 132, 199, 0.09);
  border: 1px solid rgba(56, 189, 248, 0.32);
  border-radius: var(--radius);
  margin-bottom: 18px;
}

.voice-config-title {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.voice-config-title strong { font-size: 14px; color: #bae6fd; }
.voice-config-title span { font-size: 12px; color: var(--muted); }

.voice-config-controls {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.voice-config-controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  color: var(--muted);
}

/* V10: REAL-TIME TELEGRAM/WEBHOOK NOTIFICATION CONFIG & LIVE ALERT POPUPS */
.live-alert-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
  font-size: 12px;
  font-weight: 700;
}

.notif-config-card {
  background: rgba(17, 24, 39, 0.9);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 18px;
}

.notif-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.notif-head strong { font-size: 14px; color: #fde68a; }
.notif-guide { margin: 4px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.notif-guide code {
  background: rgba(30, 41, 59, 0.9);
  padding: 1px 5px;
  border-radius: 4px;
  color: #7dd3fc;
  font-family: "JetBrains Mono", monospace;
}

.notif-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

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

.notif-checks {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--text);
}
.notif-checks label { display: flex; align-items: center; gap: 6px; cursor: pointer; }

.live-alert-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  width: min(390px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 260;
}

.live-alert-card {
  background: linear-gradient(145deg, #0f172a, #172554);
  border: 1.5px solid #38bdf8;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.65);
  animation: alertSlideIn 0.25s ease-out;
}

.live-alert-card.lead { border-color: #f59e0b; }

.live-alert-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.live-alert-top strong { font-size: 13.5px; color: #7dd3fc; }
.live-alert-card.lead .live-alert-top strong { color: #fde68a; }

.live-alert-body {
  font-size: 12.5px;
  line-height: 1.55;
  color: #e2e8f0;
  margin-bottom: 10px;
}

.live-alert-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@keyframes alertSlideIn {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

/* V11: SCENARIO FULL CRUD & LEADS HYGIENE STYLES */
.panel-head { gap: 12px; flex-wrap: wrap; }
.panel-head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.panel-sub-note {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.scenario-card.is-custom {
  border-color: rgba(16, 185, 129, 0.45);
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.12) inset;
}

.scenario-head-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.scenario-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}
.scenario-badge.custom {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.45);
}
.scenario-badge.builtin {
  background: rgba(148, 163, 184, 0.14);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.field-label-row label { margin-bottom: 0 !important; }

.modal-md { max-width: 720px; width: min(720px, 95vw); }
.scenario-modal-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.scenario-actions-right {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
