/* ==========================================================================
   Bitrix24 Real Estate Booking Addon - Design System & Styles
   Vietnamese Real Estate Matrix / Grid / List Views
   ========================================================================== */

:root {
  /* Color Palette - Light Theme */
  --bg-app: #f4f6fa;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-hover: #f1f5f9;
  
  --border-color: #e2e8f0;
  --border-light: #edf2f7;
  --border-focus: #3b82f6;

  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  /* Primary & Bitrix24 Brand */
  --bx-primary: #0080ff;
  --bx-primary-hover: #0066cc;
  --bx-primary-light: #e6f2ff;
  --bx-orange: #ff5722;
  --bx-green: #2fc6f6;
  
  /* Real Estate Status Colors */
  --status-avail: #10b981;
  --status-avail-bg: #ecfdf5;
  --status-avail-border: #a7f3d0;
  --status-avail-text: #065f46;

  --status-meet: #2563eb;
  --status-meet-bg: #eff6ff;
  --status-meet-border: #bfdbfe;
  --status-meet-text: #1e40af;

  --status-book: #d97706;
  --status-book-bg: #fffbeb;
  --status-book-border: #fde68a;
  --status-book-text: #92400e;

  --status-sold: #dc2626;
  --status-sold-bg: #fef2f2;
  --status-sold-border: #fecaca;
  --status-sold-text: #991b1b;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --font-sans: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Plus Jakarta Sans', var(--font-sans);
  --font-mono: 'JetBrains Mono', monospace;

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme Overrides */
body.theme-dark {
  --bg-app: #0b0f19;
  --bg-surface: #131b2e;
  --bg-surface-elevated: #1a243d;
  --bg-subtle: #182238;
  --bg-hover: #223052;
  
  --border-color: #243250;
  --border-light: #1e2942;
  --border-focus: #60a5fa;

  --text-main: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --text-inverse: #0f172a;

  --status-avail: #34d399;
  --status-avail-bg: rgba(16, 185, 129, 0.12);
  --status-avail-border: rgba(52, 211, 153, 0.3);
  --status-avail-text: #6ee7b7;

  --status-meet: #60a5fa;
  --status-meet-bg: rgba(37, 99, 235, 0.15);
  --status-meet-border: rgba(96, 165, 250, 0.35);
  --status-meet-text: #93c5fd;

  --status-book: #fbbf24;
  --status-book-bg: rgba(217, 119, 6, 0.15);
  --status-book-border: rgba(251, 191, 36, 0.35);
  --status-book-text: #fde68a;

  --status-sold: #f87171;
  --status-sold-bg: rgba(220, 38, 38, 0.15);
  --status-sold-border: rgba(248, 113, 113, 0.35);
  --status-sold-text: #fca5a5;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
}

/* Reset & Base Setup */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Layout Container */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ==========================================================================
   TOP BAR: Bitrix24 Header Integration
   ========================================================================== */
.app-header {
  height: 64px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

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

.bx24-logo {
  background: linear-gradient(135deg, #0093ff, #005ce6);
  color: white;
  font-family: var(--font-display);
  font-weight: 800;
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  letter-spacing: -0.5px;
  box-shadow: 0 2px 8px rgba(0, 147, 255, 0.35);
}

.brand-divider {
  width: 1px;
  height: 28px;
  background-color: var(--border-color);
}

.brand-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.app-version {
  font-size: 10px;
  font-weight: 600;
  background-color: var(--bx-primary-light);
  color: var(--bx-primary);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.tenant-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.status-pulse {
  color: #10b981;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.9); }
}

.badge-status-online {
  font-size: 9px;
  text-transform: uppercase;
  background: #dcfce7;
  color: #166534;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
}

/* Quick KPI Header Bar */
.header-center {
  display: flex;
  align-items: center;
}

.quick-kpi-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: var(--radius-lg);
}

.kpi-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: default;
  transition: var(--transition-fast);
}

.kpi-item:hover {
  background: var(--bg-surface);
}

.kpi-num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
}

.kpi-item.total .kpi-num { color: var(--text-main); }
.kpi-item.available .kpi-num { color: var(--status-avail); }
.kpi-item.meeting .kpi-num { color: var(--status-meet); }
.kpi-item.booking .kpi-num { color: var(--status-book); }
.kpi-item.sold .kpi-num { color: var(--status-sold); }

.kpi-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Header Right */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-icon-bubble, .btn-icon-secondary {
  position: relative;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-icon-bubble:hover, .btn-icon-secondary:hover {
  background: var(--bg-hover);
  color: var(--bx-primary);
  border-color: var(--border-focus);
}

.bubble-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: var(--radius-full);
  min-width: 17px;
  height: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px var(--bg-surface);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 6px;
  border-left: 1px solid var(--border-color);
}

.user-avatar img {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid #3b82f6;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.user-role {
  font-size: 10px;
  color: var(--text-muted);
}

/* ==========================================================================
   CONTROL PANEL: Dự án, Tòa, Tìm kiếm, Bộ lọc
   ========================================================================== */
.control-panel {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.hierarchy-selectors {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.select-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.select-group label, .tower-selector-group label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  text-transform: uppercase;
}

.custom-select-wrapper {
  position: relative;
}

.project-dropdown {
  min-width: 280px;
  height: 38px;
  padding: 0 32px 0 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: var(--transition-fast);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
}

.project-dropdown:focus {
  border-color: var(--bx-primary);
  box-shadow: 0 0 0 3px rgba(0, 128, 255, 0.15);
}

.tower-selector-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.tower-pills-container {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.tower-pill-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.tower-pill-btn:hover {
  background: var(--bg-hover);
  border-color: #cbd5e1;
  color: var(--text-main);
}

.tower-pill-btn.active {
  background: var(--bx-primary);
  color: white;
  border-color: var(--bx-primary);
  box-shadow: 0 2px 8px rgba(0, 128, 255, 0.35);
}

.tower-pill-btn .unit-count-badge {
  font-size: 11px;
  background: rgba(0, 0, 0, 0.08);
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.tower-pill-btn.active .unit-count-badge {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

/* Toolbar Controls */
.toolbar-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px dashed var(--border-light);
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 260px;
}

.search-box i.fa-magnifying-glass {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: 13px;
}

.search-box input {
  width: 100%;
  height: 36px;
  padding: 0 32px 0 34px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-main);
  font-size: 12.5px;
  outline: none;
  transition: var(--transition-fast);
}

.search-box input:focus {
  border-color: var(--bx-primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px rgba(0, 128, 255, 0.12);
}

.clear-search-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
}

.status-filters {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.status-btn .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-btn.status-available .dot { background: var(--status-avail); }
.status-btn.status-meeting .dot { background: var(--status-meet); }
.status-btn.status-booking .dot { background: var(--status-book); }
.status-btn.status-sold .dot { background: var(--status-sold); }

.status-btn .badge {
  font-size: 10.5px;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  color: var(--text-muted);
}

.status-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.status-btn.active {
  border-color: var(--bx-primary);
  background: var(--bx-primary-light);
  color: var(--bx-primary);
}

body.theme-dark .status-btn.active {
  background: rgba(0, 128, 255, 0.2);
  color: #60a5fa;
}

.status-btn.active .badge {
  background: rgba(0, 128, 255, 0.2);
  color: var(--bx-primary);
}

/* View Mode Switcher */
.view-mode-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
}

.switcher-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.btn-group-toggle {
  display: flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 2px;
  border-radius: var(--radius-md);
}

.btn-view-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13.5px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-view-toggle:hover {
  color: var(--bx-primary);
  background: rgba(0, 128, 255, 0.08);
}

.btn-view-toggle.active {
  background: var(--bg-surface);
  color: var(--bx-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  font-weight: 700;
}

/* Quick action buttons */
.quick-actions-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-action-primary {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #0080ff, #0060df);
  color: white;
  border: none;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 128, 255, 0.3);
  transition: var(--transition-fast);
}

.btn-action-primary:hover {
  opacity: 0.93;
  transform: translateY(-1px);
}

.btn-action-secondary {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-action-secondary:hover {
  background: var(--bg-hover);
  color: #10b981;
  border-color: #a7f3d0;
}

/* Secondary Filter Bar */
.secondary-filter-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
  font-size: 12px;
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-item label {
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-select-sm {
  height: 28px;
  padding: 0 24px 0 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-main);
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

.status-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  font-size: 11px;
}

.legend-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
}

.legend-avail i { color: var(--status-avail); }
.legend-meet i { color: var(--status-meet); }
.legend-book i { color: var(--status-book); }
.legend-sold i { color: var(--status-sold); }

.btn-reset-filters {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11.5px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-xs);
  transition: var(--transition-fast);
}

.btn-reset-filters:hover {
  color: var(--text-main);
  background: var(--bg-subtle);
}

/* ==========================================================================
   VIEW CONTAINER & SCOPE BANNER
   ========================================================================== */
.view-content-wrapper {
  padding: 16px 24px 40px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.current-scope-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 16px;
}

.scope-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  flex-wrap: wrap;
}

.scope-project {
  font-weight: 700;
  color: var(--text-main);
}

.scope-separator {
  color: var(--text-muted);
  font-size: 15px;
}

.scope-tower {
  font-weight: 600;
  color: var(--bx-primary);
}

.scope-stat-tag {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.density-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.density-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-right: 4px;
}

.btn-density {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
}

.btn-density.active {
  background: var(--bx-primary-light);
  border-color: var(--bx-primary);
  color: var(--bx-primary);
  font-weight: 600;
}

/* Tab View Containers */
.view-container {
  display: none;
}

.view-container.active {
  display: block;
}

/* ==========================================================================
   VIEW 1: MA TRẬN MẶT BẰNG BẢNG HÀNG (MATRIX VIEW) - HIỂN THỊ TỐI ƯU NHẤT
   ========================================================================== */
.matrix-scroll-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: auto;
  max-height: calc(100vh - 270px);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.matrix-table {
  display: grid;
  gap: 3px;
  padding: 12px;
  min-width: max-content;
  user-select: none;
}

/* Matrix Column Header (Trục căn 01 -> 16) */
.matrix-header-row {
  display: contents;
}

.matrix-corner-cell {
  position: sticky;
  left: 0;
  top: 0;
  z-index: 30;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.matrix-col-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
}

/* Floor Label (Tầng 32 -> Tầng 01) */
.matrix-floor-label {
  position: sticky;
  left: 0;
  z-index: 10;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Unit Cell in Matrix */
.matrix-unit-cell {
  position: relative;
  border-radius: var(--radius-sm);
  padding: 5px 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  border: 1px solid transparent;
  min-height: 52px;
}

/* Density Compact */
.matrix-table.density-compact .matrix-unit-cell {
  padding: 3px 5px;
  min-height: 44px;
}
.matrix-table.density-compact .unit-code-txt {
  font-size: 11px;
}
.matrix-table.density-compact .unit-price-txt {
  font-size: 9.5px;
}

/* Density Normal */
.matrix-table.density-normal .matrix-unit-cell {
  padding: 6px 8px;
  min-height: 56px;
}

/* Density Spacious */
.matrix-table.density-spacious .matrix-unit-cell {
  padding: 8px 10px;
  min-height: 68px;
}

.matrix-unit-cell:hover {
  transform: translateY(-2px) scale(1.03);
  z-index: 15;
  box-shadow: var(--shadow-lg);
}

/* Cell Status Themes */
.matrix-unit-cell.status-available {
  background-color: var(--status-avail-bg);
  border-color: var(--status-avail-border);
  color: var(--status-avail-text);
}
.matrix-unit-cell.status-available:hover {
  border-color: var(--status-avail);
}

.matrix-unit-cell.status-meeting {
  background-color: var(--status-meet-bg);
  border-color: var(--status-meet-border);
  color: var(--status-meet-text);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.2);
}
.matrix-unit-cell.status-meeting:hover {
  border-color: var(--status-meet);
}

.matrix-unit-cell.status-booking {
  background-color: var(--status-book-bg);
  border-color: var(--status-book-border);
  color: var(--status-book-text);
}
.matrix-unit-cell.status-booking:hover {
  border-color: var(--status-book);
}

.matrix-unit-cell.status-sold {
  background-color: var(--status-sold-bg);
  border-color: var(--status-sold-border);
  color: var(--status-sold-text);
  opacity: 0.82;
}
.matrix-unit-cell.status-sold:hover {
  opacity: 1;
  border-color: var(--status-sold);
}

/* Inside Unit Cell */
.cell-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
}

.unit-code-txt {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11.5px;
  line-height: 1.1;
}

.cell-status-icon {
  font-size: 10px;
}

.cell-mid-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9.5px;
  opacity: 0.85;
  margin-top: 1px;
}

.unit-type-tag {
  font-weight: 600;
}

.cell-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
}

.unit-price-txt {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
}

/* Special appointment micro-banner inside cell */
.cell-meeting-badge {
  font-size: 9px;
  background: var(--status-meet);
  color: white;
  padding: 1px 4px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
  font-weight: 700;
}

/* ==========================================================================
   HOVER FLOATING TOOLTIP (MA TRẬN CĂN HỘ)
   ========================================================================== */
.matrix-floating-tooltip {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-xl);
  min-width: 260px;
  max-width: 340px;
  font-size: 12px;
  animation: fadeIn 0.1s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.tooltip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 6px;
  margin-bottom: 8px;
}

.tooltip-code {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
}

.tooltip-status {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.tooltip-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tooltip-row {
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
}

.tooltip-row strong {
  color: var(--text-main);
}

/* Tooltip Special Section: Lịch Hẹn Gặp Khách Hàng */
.tooltip-meeting-highlight {
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--status-meet-bg);
  border: 1px solid var(--status-meet-border);
  border-radius: var(--radius-sm);
}

.tooltip-meeting-highlight .meeting-title {
  font-weight: 700;
  color: var(--status-meet-text);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 4px;
}

.tooltip-meeting-highlight .meeting-detail-row {
  font-size: 11px;
  display: flex;
  gap: 6px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.tooltip-meeting-highlight .meeting-time-box {
  background: var(--status-meet);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  display: inline-block;
  margin-top: 4px;
}

/* ==========================================================================
   VIEW 2: GRID THẺ CĂN HỘ (GRID VIEW)
   ========================================================================== */
.units-grid-layout {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.unit-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}

.unit-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: #cbd5e1;
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.card-code {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.2px;
}

.card-type-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

.card-status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 5px;
}

.card-status-badge.available {
  background: var(--status-avail-bg);
  color: var(--status-avail-text);
  border: 1px solid var(--status-avail-border);
}

.card-status-badge.meeting {
  background: var(--status-meet-bg);
  color: var(--status-meet-text);
  border: 1px solid var(--status-meet-border);
}

.card-status-badge.booking {
  background: var(--status-book-bg);
  color: var(--status-book-text);
  border: 1px solid var(--status-book-border);
}

.card-status-badge.sold {
  background: var(--status-sold-bg);
  color: var(--status-sold-text);
  border: 1px solid var(--status-sold-border);
}

/* Card Specs Grid */
.card-specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  padding: 8px 10px;
  border-radius: var(--radius-md);
  font-size: 11.5px;
}

.card-spec-item {
  display: flex;
  flex-direction: column;
}

.spec-key {
  color: var(--text-muted);
  font-size: 10px;
}

.spec-val {
  font-weight: 600;
  color: var(--text-main);
}

/* Card Meeting Banner: Nổi bật ai booking và lúc nào */
.card-meeting-box {
  background: var(--status-meet-bg);
  border: 1px solid var(--status-meet-border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font-size: 11.5px;
}

.meeting-header-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  font-weight: 700;
  color: var(--status-meet-text);
}

.meeting-agent-info {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-main);
}

.meeting-agent-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
}

.meeting-time-pill {
  margin-top: 6px;
  background: #2563eb;
  color: white;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  font-weight: 700;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
}

.card-price {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
}

.btn-card-action {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--bx-primary);
  font-size: 11.5px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-card-action:hover {
  background: var(--bx-primary);
  color: white;
  border-color: var(--bx-primary);
}

/* ==========================================================================
   VIEW 3: BẢNG DANH SÁCH CHI TIẾT (LIST VIEW)
   ========================================================================== */
.table-responsive {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.bds-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  text-align: left;
}

.bds-data-table thead th {
  background: var(--bg-subtle);
  padding: 12px 14px;
  font-weight: 700;
  font-size: 11.5px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.bds-data-table thead th.sortable {
  cursor: pointer;
}

.bds-data-table thead th.sortable:hover {
  color: var(--bx-primary);
}

.bds-data-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background-color var(--transition-fast);
}

.bds-data-table tbody tr:hover {
  background-color: var(--bg-hover);
}

.bds-data-table tbody td {
  padding: 10px 14px;
  vertical-align: middle;
}

.table-unit-code {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-main);
}

.table-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.table-badge.available { background: var(--status-avail-bg); color: var(--status-avail-text); }
.table-badge.meeting { background: var(--status-meet-bg); color: var(--status-meet-text); }
.table-badge.booking { background: var(--status-book-bg); color: var(--status-book-text); }
.table-badge.sold { background: var(--status-sold-bg); color: var(--status-sold-text); }

.table-agent-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-agent-cell .avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

.table-time-tag {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--bx-primary);
  background: var(--bx-primary-light);
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-block;
  white-space: nowrap;
}

body.theme-dark .table-time-tag {
  background: rgba(0, 128, 255, 0.2);
  color: #93c5fd;
}

.table-action-btns {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-table-opt {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: var(--transition-fast);
}

.btn-table-opt:hover {
  background: var(--bx-primary);
  color: white;
  border-color: var(--bx-primary);
}

/* Pagination */
.pagination-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  font-size: 12px;
  color: var(--text-secondary);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 11.5px;
  cursor: pointer;
}

.page-btn.active {
  background: var(--bx-primary);
  color: white;
  border-color: var(--bx-primary);
  font-weight: 700;
}

/* ==========================================================================
   MODAL: CHI TIẾT CĂN HỘ & ĐẶT LỊCH HẸN
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-dialog {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-color);
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-subtle);
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.unit-code-badge {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  background: var(--bx-primary);
  color: white;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  letter-spacing: 0.5px;
}

.modal-heading {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.btn-close-modal {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.btn-close-modal:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.unit-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 20px;
}

.detail-col-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.unit-spec-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12.5px;
}

.spec-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.spec-label {
  color: var(--text-muted);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.spec-value {
  color: var(--text-main);
  font-weight: 600;
}

.spec-row.price-highlight {
  padding-top: 6px;
  border-top: 1px dashed var(--border-color);
}

.spec-row.price-highlight .price-text {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: #0284c7;
}

/* Modal Current Status Card */
.current-status-card {
  padding: 12px;
  border-radius: var(--radius-lg);
  font-size: 12px;
}

.current-status-card.status-available {
  background: var(--status-avail-bg);
  border: 1px solid var(--status-avail-border);
  color: var(--status-avail-text);
}

.current-status-card.status-meeting {
  background: var(--status-meet-bg);
  border: 1px solid var(--status-meet-border);
  color: var(--status-meet-text);
}

.current-status-card.status-booking {
  background: var(--status-book-bg);
  border: 1px solid var(--status-book-border);
  color: var(--status-book-text);
}

.current-status-card.status-sold {
  background: var(--status-sold-bg);
  border: 1px solid var(--status-sold-border);
  color: var(--status-sold-text);
}

/* Modal Actions Column */
.detail-col-actions {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.action-tab-header {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-subtle);
}

.action-tab-header .tab-btn {
  flex: 1;
  padding: 10px 14px;
  border: none;
  background: transparent;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-bottom: 2px solid transparent;
}

.action-tab-header .tab-btn.active {
  color: var(--bx-primary);
  border-bottom-color: var(--bx-primary);
  background: var(--bg-surface);
}

.tab-pane {
  display: none;
  padding: 16px;
}

.tab-pane.active {
  display: block;
}

/* Form Styles */
.appointment-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-control {
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-main);
  font-size: 12.5px;
  outline: none;
  transition: var(--transition-fast);
}

textarea.form-control {
  height: auto;
  padding: 8px 12px;
  resize: vertical;
}

.form-control:focus {
  border-color: var(--bx-primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px rgba(0, 128, 255, 0.12);
}

.bitrix-sync-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  font-size: 11px;
  color: #166534;
}

body.theme-dark .bitrix-sync-indicator {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.2);
  color: #86efac;
}

.form-action-buttons {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.btn-submit-meeting {
  flex: 1;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  border: none;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.btn-cancel-meeting {
  background: var(--bg-subtle);
  color: #ef4444;
  border: 1px solid #fecaca;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
}

/* Tab 2: Quick Status Options */
.section-subdesc {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.status-options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.btn-status-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: left;
}

.btn-status-option strong {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.btn-status-option span {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-status-option.opt-available:hover {
  background: var(--status-avail-bg);
  border-color: var(--status-avail);
  color: var(--status-avail-text);
}

.btn-status-option.opt-booking:hover {
  background: var(--status-book-bg);
  border-color: var(--status-book);
  color: var(--status-book-text);
}

.btn-status-option.opt-sold:hover {
  background: var(--status-sold-bg);
  border-color: var(--status-sold);
  color: var(--status-sold-text);
}

.booking-extra-fields {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-confirm-booking-action {
  background: #d97706;
  color: white;
  border: none;
  padding: 9px 14px;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
}

/* ==========================================================================
   DRAWER: DANH SÁCH LỊCH HẸN GẶP KHÁCH TRONG NGÀY
   ========================================================================== */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1050;
}

.appointments-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  max-width: 90vw;
  height: 100vh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-color);
  box-shadow: var(--shadow-xl);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  transition: right 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.appointments-drawer.open {
  right: 0;
}

.drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-title-wrap h3 {
  font-size: 15px;
  font-weight: 700;
}

.btn-close-drawer {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
}

.drawer-filter-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  padding: 4px 12px;
  background: var(--bg-subtle);
  gap: 6px;
}

.drawer-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 6px 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.drawer-tab.active {
  background: var(--bg-surface);
  color: var(--bx-primary);
  box-shadow: var(--shadow-sm);
}

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

.appointment-card-item {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.appointment-card-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-focus);
}

.appt-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.appt-unit-code {
  font-weight: 800;
  font-size: 13px;
  color: var(--bx-primary);
}

.appt-time-badge {
  background: #2563eb;
  color: white;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
}

.appt-agent {
  font-size: 12px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.appt-client {
  font-size: 11.5px;
  color: var(--text-secondary);
}

.appt-loc {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  color: var(--text-main);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  border-left: 4px solid var(--bx-primary);
  font-size: 12.5px;
  font-weight: 600;
  min-width: 280px;
  animation: slideInRight 0.25s ease;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.success { border-left-color: #10b981; }
.toast.info { border-left-color: #0080ff; }
.toast.warning { border-left-color: #f59e0b; }
.toast.error { border-left-color: #ef4444; }

/* ==========================================================================
   MULTI-PORTAL HEADER & TOP ACTIONS
   ========================================================================== */
.portal-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  background: var(--bg-subtle);
  padding: 4px 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.portal-select-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.portal-select-input {
  font-size: 12px;
  font-weight: 700;
  color: var(--bx-primary);
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  padding-right: 18px;
}

.btn-top-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-top-action:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--border-focus);
}

.btn-portal-settings {
  color: #7c3aed;
  border-color: rgba(124, 58, 237, 0.25);
  background: rgba(124, 58, 237, 0.05);
}
.btn-portal-settings:hover {
  background: rgba(124, 58, 237, 0.12);
  border-color: #7c3aed;
  color: #7c3aed;
}

.btn-spa-hub {
  color: #0284c7;
  border-color: rgba(2, 132, 199, 0.25);
  background: rgba(2, 132, 199, 0.05);
}
.btn-spa-hub:hover {
  background: rgba(2, 132, 199, 0.12);
  border-color: #0284c7;
  color: #0284c7;
}

.btn-public-link {
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.25);
  background: rgba(16, 185, 129, 0.05);
}
.btn-public-link:hover {
  background: rgba(16, 185, 129, 0.12);
  border-color: #10b981;
  color: #059669;
}

.btn-test-realtime {
  color: #d97706;
  border-color: rgba(217, 119, 6, 0.25);
  background: rgba(217, 119, 6, 0.05);
}
.btn-test-realtime:hover {
  background: rgba(217, 119, 6, 0.15);
  border-color: #d97706;
  color: #b45309;
}

.portal-active-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  padding: 2px 8px;
  background: rgba(0, 128, 255, 0.1);
  color: var(--bx-primary);
  border-radius: var(--radius-full);
  margin-left: 10px;
}

/* Realtime Live Status Pill in Header */
.realtime-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #10b981;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  margin-left: 6px;
  user-select: none;
}

.realtime-pulse-dot {
  width: 7px;
  height: 7px;
  background-color: #10b981;
  border-radius: 50%;
  animation: realtimeDotPulse 1.8s infinite;
}

@keyframes realtimeDotPulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.2); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.realtime-status-pill.offline {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}
.realtime-status-pill.offline .realtime-pulse-dot {
  background-color: #ef4444;
  animation: none;
}

/* Real-time Glowing Pulse Animation for updated cells, cards, rows */
@keyframes realtimeHighlight {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(0, 128, 255, 0.9), inset 0 0 15px rgba(0, 128, 255, 0.7);
    outline: 2px solid #0080ff;
  }
  35% {
    transform: scale(1.1);
    box-shadow: 0 0 25px 8px rgba(0, 128, 255, 0.95), inset 0 0 20px rgba(0, 128, 255, 0.9);
    outline: 3px solid #60a5fa;
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(0, 128, 255, 0);
    outline: 2px solid transparent;
  }
}

.realtime-updated {
  animation: realtimeHighlight 2.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
  z-index: 60 !important;
  position: relative;
}

/* ==========================================================================
   ACCESS DENIED VIEW (403 FORBIDDEN SCREEN)
   ========================================================================== */
.access-denied-container {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: radial-gradient(circle at center, #1e1b4b 0%, #09090b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.denied-card {
  max-width: 540px;
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-xl);
  padding: 40px 32px;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(220, 38, 38, 0.25);
  color: #ffffff;
  animation: scaleUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleUp {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.denied-icon-wrap {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  background: rgba(239, 68, 68, 0.15);
  border: 2px solid rgba(239, 68, 68, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: #f87171;
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.3);
}

.badge-denied-code {
  display: inline-block;
  padding: 3px 12px;
  border-radius: var(--radius-full);
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  margin-bottom: 12px;
}

.denied-title {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 12px;
  color: #ffffff;
}

.denied-desc {
  font-size: 14px;
  color: #cbd5e1;
  line-height: 1.6;
  margin-bottom: 24px;
}

.token-highlight {
  color: #f87171;
  background: rgba(239, 68, 68, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

.denied-alert-box {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  font-size: 12.5px;
  color: #fcd34d;
  margin-bottom: 28px;
}

.denied-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.denied-actions .btn-primary {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 700;
  cursor: pointer;
}
.denied-actions .btn-primary:hover {
  background: #b91c1c;
}

.denied-actions .btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
}
.denied-actions .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* ==========================================================================
   PUBLIC SIMPLE LOGIN & TOP BANNER
   ========================================================================== */
.login-modal-content {
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
}

.login-header {
  text-align: center;
  padding: 30px 24px 20px;
  background: linear-gradient(135deg, rgba(0, 128, 255, 0.08) 0%, rgba(99, 102, 241, 0.08) 100%);
  border-bottom: 1px solid var(--border-color);
}

.login-brand-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: var(--radius-lg);
  background: var(--bx-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 10px 20px -5px rgba(0, 128, 255, 0.4);
}

.login-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

.login-form {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Thẻ Nhận Diện Portal từ Link /booking/<token> */
.login-portal-detected-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(16, 185, 129, 0.08) 100%);
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: var(--radius-lg);
  position: relative;
  transition: all var(--transition-fast);
}

.login-portal-detected-card:hover {
  border-color: rgba(37, 99, 235, 0.38);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.detected-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--bx-primary) 0%, #2563eb 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.detected-card-info {
  flex: 1;
  min-width: 0;
}

.detected-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #059669;
  margin-bottom: 2px;
}

.detected-portal-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.detected-portal-domain {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: monospace;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-change-portal-public {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface, #ffffff);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-change-portal-public:hover {
  color: var(--bx-primary);
  border-color: var(--bx-primary);
  background: rgba(37, 99, 235, 0.05);
}

.login-security-notice {
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-login-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  font-size: 14px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--bx-primary) 0%, #2563eb 100%);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  transition: all var(--transition-fast);
}

.btn-login-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

/* Public Mode Top Banner */
.public-user-banner {
  background: linear-gradient(90deg, #1e293b 0%, #0f172a 100%);
  color: #ffffff;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--bx-primary);
  z-index: 100;
}

.public-user-banner .banner-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal-badge-public {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #60a5fa;
}

.filter-notice-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: var(--radius-full);
}

.public-user-banner .banner-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.public-client-info {
  font-size: 12.5px;
  color: #e2e8f0;
}

.btn-logout-public {
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}
.btn-logout-public:hover {
  background: #dc2626;
  color: white;
}

.login-error-alert {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #ef4444;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.login-pwd-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.login-pwd-wrapper input {
  padding-right: 42px;
}

.btn-toggle-login-pwd {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  font-size: 14px;
}
.btn-toggle-login-pwd:hover {
  color: var(--text-main);
}

.domain-tag-public {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: #94a3b8;
  font-family: monospace;
}

.badge-public-role {
  display: inline-flex;
  align-items: center;
  background: rgba(14, 165, 233, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.3);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.header-role-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-role-admin {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 700;
}

.badge-role-user {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 700;
}

.btn-preview-toggle {
  background: rgba(245, 158, 11, 0.12) !important;
  color: #f59e0b !important;
  border: 1px solid rgba(245, 158, 11, 0.3) !important;
  font-size: 11.5px !important;
  padding: 4px 10px !important;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.btn-preview-toggle:hover {
  background: rgba(245, 158, 11, 0.25) !important;
}

.badge-code-display {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.btn-copy-cred {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #10b981 !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
}
.btn-copy-cred:hover {
  background: rgba(16, 185, 129, 0.28) !important;
}

/* ==========================================================================
   PORTAL SETTINGS MODAL & TABS
   ========================================================================== */
.settings-tab-nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 14px;
  margin-bottom: 20px;
}

.settings-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.settings-tab-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.settings-tab-btn.active {
  background: var(--bx-primary-light);
  color: var(--bx-primary);
  font-weight: 700;
}

.settings-tab-pane {
  display: none;
}
.settings-tab-pane.active {
  display: block;
}

/* Portal List & Form Layout */
.portal-mgmt-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
}

.portal-sidebar-list {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.sidebar-header h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.btn-add-portal-sm {
  background: var(--bx-primary);
  color: white;
  border: none;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.portal-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.portal-card-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.portal-card-item:hover {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-sm);
}

.portal-card-item.active {
  border-color: var(--bx-primary);
  background: var(--bx-primary-light);
}

.portal-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.portal-card-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
}

.portal-card-domain {
  font-size: 11px;
  color: var(--text-muted);
}

.badge-portal-active {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: #10b981;
  color: white;
}

/* Webhook Input Group */
.webhook-input-group, .token-input-group, .url-copy-box {
  display: flex;
  gap: 8px;
}

.btn-test-webhook {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #f59e0b;
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.btn-test-webhook:hover {
  background: #d97706;
}

.webhook-test-result {
  margin-top: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.webhook-test-result.success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.webhook-test-result.error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* Cart Display Settings Tab */
.cart-display-settings-box {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.setting-feature-card {
  display: flex;
  gap: 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.feature-details {
  flex: 1;
}

.feature-toggle-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.feature-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
}

.feature-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Switch UI */
.switch-ui {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}
.switch-ui input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider-ui {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 34px;
}
.slider-ui:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}
input:checked + .slider-ui {
  background-color: #10b981;
}
input:checked + .slider-ui:before {
  transform: translateX(24px);
}

.status-matrix-settings {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
}
.status-matrix-settings h5 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
}

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

.status-checkbox-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px;
  cursor: pointer;
}
.status-checkbox-label input {
  margin-bottom: 4px;
}
.status-checkbox-label small {
  font-size: 11px;
  color: var(--text-muted);
}

.save-cart-settings-bar {
  display: flex;
  justify-content: flex-end;
}

/* Public URL Mgmt */
.public-link-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.public-link-card h4 {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 12px;
}

.url-copy-box {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.btn-copy-action, .btn-open-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn-copy-action {
  background: var(--bx-primary);
  color: white;
  border: none;
}
.btn-open-action {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.url-features-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.feat-item {
  font-size: 12.5px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   SPA HUB & DATA LIÊN KẾT (LINKED DATA)
   ========================================================================== */
.spa-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.spa-subheading {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
}

.spa-cart-filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Linked Data Field styling */
.linked-data-group {
  background: rgba(0, 128, 255, 0.04);
  border: 1px solid rgba(0, 128, 255, 0.25);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 16px;
}

.linked-label-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.badge-linked-type {
  font-size: 10px;
  font-weight: 800;
  background: rgba(0, 128, 255, 0.15);
  color: var(--bx-primary);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.project-linked-select {
  font-size: 13.5px;
  font-weight: 700;
  border-color: rgba(0, 128, 255, 0.4);
}

.linked-project-preview {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--bx-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Status select list (dropdown) */
.status-dropdown-group {
  margin-bottom: 16px;
}
.status-select-list {
  font-weight: 700;
}

/* Multiple file images upload */
.unit-images-upload-group {
  margin-bottom: 20px;
}
.images-label-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.photo-count-indicator {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--bx-primary);
}

.file-dropzone {
  border: 2px dashed rgba(0, 128, 255, 0.35);
  background: var(--bg-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.file-dropzone:hover {
  border-color: var(--bx-primary);
  background: var(--bx-primary-light);
}
.dropzone-icon {
  font-size: 32px;
  color: var(--bx-primary);
  margin-bottom: 8px;
}
.dropzone-text {
  font-size: 13px;
  color: var(--text-main);
  margin-bottom: 4px;
}
.dropzone-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.sample-images-bar {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
.btn-sample-action {
  font-size: 11.5px;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  cursor: pointer;
}
.btn-sample-action:hover {
  background: rgba(99, 102, 241, 0.2);
}

.btn-clear-photos {
  font-size: 11.5px;
  font-weight: 600;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  cursor: pointer;
}

.images-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.preview-photo-card {
  position: relative;
  aspect-ratio: 4/3;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: #000;
}
.preview-photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-fast);
}
.preview-photo-card:hover img {
  transform: scale(1.05);
}

.btn-remove-photo {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  cursor: pointer;
}
.btn-remove-photo:hover {
  background: #dc2626;
}

.badge-featured-photo {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: #f59e0b;
  color: white;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 3px;
}

/* ==========================================================================
   UNIT DETAIL MULTIPLE IMAGES CAROUSEL
   ========================================================================== */
.unit-image-carousel {
  margin-bottom: 16px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border-color);
}

.carousel-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16/10;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
}

.carousel-main-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.25s ease;
}

.carousel-photo-badge {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  color: var(--text-main);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-fast);
}
.carousel-arrow:hover {
  background: white;
  transform: translateY(-50%) scale(1.1);
}
.carousel-arrow.prev { left: 10px; }
.carousel-arrow.next { right: 10px; }

.carousel-thumbnails-strip {
  display: flex;
  gap: 6px;
  padding: 8px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  overflow-x: auto;
}

.carousel-thumb-item {
  width: 60px;
  height: 42px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: 0.7;
  transition: all var(--transition-fast);
}
.carousel-thumb-item.active {
  border-color: var(--bx-primary);
  opacity: 1;
}
.carousel-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Card image in Grid View */
.unit-card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16/10;
  overflow: hidden;
  background: #1e293b;
}
.unit-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-normal);
}
.unit-card:hover .unit-card-media img {
  transform: scale(1.06);
}
.unit-card-photo-tag {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.65);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .header-center { display: none; }
  .unit-detail-grid { grid-template-columns: 1fr; }
  .portal-mgmt-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .app-header { padding: 0 14px; }
  .control-panel { padding: 12px 14px; }
  .view-content-wrapper { padding: 12px 14px 30px; }
  .status-filters { overflow-x: auto; max-width: 100%; }
  .btn-top-action span { display: none; }
}

/* ==========================================================================
   ADMIN QUICK BAR: CẤU HÌNH WEBHOOK & LINK BOOKING PUBLIC & SPA BUTTONS (HÌNH 1)
   ========================================================================== */
.admin-quick-bar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-xs);
}

.admin-quick-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-quick-row.secondary-row {
  justify-content: space-between;
  padding-top: 6px;
  border-top: 1px dashed var(--border-color);
}

.admin-quick-col {
  flex: 1;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quick-col-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.portal-tag {
  background: rgba(37, 99, 235, 0.1);
  color: var(--bx-primary);
  padding: 1px 8px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 11px;
}

.quick-input-btn-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.quick-input-btn-group input {
  flex: 1;
  font-size: 12px;
  padding: 7px 12px;
  height: 36px;
}

.btn-quick-test {
  height: 36px;
  padding: 0 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}
.btn-quick-test:hover {
  background: var(--bg-hover);
  border-color: var(--bx-primary);
  color: var(--bx-primary);
}

.btn-quick-save {
  height: 36px;
  padding: 0 14px;
  background: var(--bx-primary);
  border: 1px solid var(--bx-primary);
  border-radius: var(--radius-sm);
  color: white;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}
.btn-quick-save:hover {
  background: var(--bx-primary-hover);
}

.btn-quick-copy {
  height: 36px;
  padding: 0 12px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-sm);
  color: var(--success);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}
.btn-quick-copy:hover {
  background: var(--success);
  color: white;
}

.btn-quick-open {
  height: 36px;
  padding: 0 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-quick-open:hover {
  color: var(--bx-primary);
  border-color: var(--bx-primary);
}

/* 4 Nút thao tác SPA từ Hình 1 (Rút gọn, chuẩn UI) */
.spa-actions-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-spa-short {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

/* Nút 1: Green filled - Lưu & Đồng bộ */
.btn-spa-short.btn-save-sync {
  background: #059669;
  border: 1px solid #059669;
  color: white;
}
.btn-spa-short.btn-save-sync:hover {
  background: #047857;
  transform: translateY(-1px);
}

/* Nút 2: White with Blue border - Tạo Custom Fields */
.btn-spa-short.btn-custom-fields {
  background: white;
  border: 1px solid #0284c7;
  color: #0284c7;
}
.btn-spa-short.btn-custom-fields:hover {
  background: rgba(2, 132, 199, 0.08);
  transform: translateY(-1px);
}

/* Nút 3: Blue filled - Đồng bộ toàn bộ */
.btn-spa-short.btn-sync-all {
  background: #0284c7;
  border: 1px solid #0284c7;
  color: white;
}
.btn-spa-short.btn-sync-all:hover {
  background: #0369a1;
  transform: translateY(-1px);
}

/* Nút 4: White with Gray border - Tải từ Bitrix24 */
.btn-spa-short.btn-reload-spa {
  background: white;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}
.btn-spa-short.btn-reload-spa:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

/* HOT EVENT MODE SWITCH & BANNER */
.hot-event-mode-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hot-switch-ui {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.hot-switch-ui input { opacity: 0; width: 0; height: 0; }
.hot-slider-ui {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 24px;
}
.hot-slider-ui:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}
.hot-switch-ui input:checked + .hot-slider-ui {
  background-color: #dc2626;
}
.hot-switch-ui input:checked + .hot-slider-ui:before {
  transform: translateX(20px);
}

.hot-switch-label {
  display: flex;
  flex-direction: column;
}
.hot-switch-label .hot-tag {
  font-size: 12px;
  font-weight: 700;
  color: #dc2626;
}
.hot-switch-label .hot-subtext {
  font-size: 10px;
  color: var(--text-muted);
}

.hot-event-live-banner {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.12) 0%, rgba(245, 158, 11, 0.12) 100%);
  border: 1px solid rgba(220, 38, 38, 0.35);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: fadeIn 0.3s ease-out;
}
.hot-banner-content {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-main);
}
.hot-banner-content strong {
  color: #dc2626;
}
.btn-quick-hot-demo {
  background: #dc2626;
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
}
.btn-quick-hot-demo:hover {
  background: #b91c1c;
}

/* HOT EVENT CARD IN UNIT MODAL */
.hot-event-unit-card {
  margin-top: 14px;
  background: linear-gradient(180deg, rgba(220, 38, 38, 0.05) 0%, var(--bg-surface) 100%);
  border: 1px solid rgba(220, 38, 38, 0.3);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hot-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.hot-card-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  color: #dc2626;
}
.badge-hot-count {
  background: #dc2626;
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}
.hot-card-desc {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.hot-sales-queue-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
}

.hot-queue-item {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.hot-queue-item.confirmed {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
}
.hot-queue-item.missed {
  opacity: 0.6;
}

.queue-sale-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.queue-order-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  width: fit-content;
}
.queue-order-badge.ut1 { background: #fee2e2; color: #dc2626; }
.queue-order-badge.ut2 { background: #fef3c7; color: #d97706; }
.queue-order-badge.ut3 { background: #e0f2fe; color: #0284c7; }

.queue-sale-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
}
.queue-client-detail {
  font-size: 11px;
  color: var(--text-muted);
}

.queue-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-lock-deposit {
  background: #10b981;
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all var(--transition-fast);
}
.btn-lock-deposit:hover {
  background: #059669;
  transform: scale(1.03);
}

.btn-hot-add-queue {
  width: 100%;
  padding: 7px;
  background: var(--bg-subtle);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-hot-add-queue:hover {
  background: var(--bg-hover);
  border-color: #dc2626;
  color: #dc2626;
}

.hot-queue-input-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hot-input-buttons {
  display: flex;
  gap: 8px;
}
.btn-confirm-hot-queue {
  flex: 1;
  background: #dc2626;
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.btn-cancel-hot-queue {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 11px;
  cursor: pointer;
}

/* Special button for Vo Tien in quick status change */
.btn-status-option.opt-vo-tien {
  border-color: #f59e0b;
}
.btn-status-option.opt-vo-tien:hover {
  background: rgba(245, 158, 11, 0.08);
}

/* DUAL PRICE TAGS STYLING */
.price-rent-highlight {
  background: rgba(14, 165, 233, 0.06);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}
.price-rent-text {
  color: #0284c7;
  font-size: 14px;
}
.badge-price-dual {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.badge-price-dual .price-b {
  font-weight: 700;
  color: var(--text-main);
}
.badge-price-dual .price-r {
  font-size: 10px;
  color: #0284c7;
  font-weight: 600;
}
.matrix-hot-queue-tag {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #dc2626;
  color: white;
  font-size: 8px;
  font-weight: 800;
  padding: 1px 3px;
  border-radius: 2px;
  line-height: 1;
  z-index: 2;
}
.matrix-hot-queue-tag.queue {
  background: #ea580c;
}
.matrix-hot-queue-tag.locked {
  background: #dc2626;
  box-shadow: 0 0 6px rgba(220, 38, 38, 0.7);
  animation: pulse-ring 1.8s infinite;
}

.unit-rent-price-txt {
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 600;
  color: #0284c7;
  display: block;
  line-height: 1.1;
}

.matrix-table.density-compact .unit-rent-price-txt {
  font-size: 7.5px;
}
.matrix-table.density-spacious .unit-rent-price-txt {
  font-size: 9.5px;
}

/* ==========================================================================
   MULTI-PORTAL & SPA CONFIGURATION BAR & MODAL STYLES
   ========================================================================== */

.portal-selector-badge-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.form-select-portal {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--bx-primary);
  cursor: pointer;
  height: 24px;
}
.form-select-portal:focus {
  outline: none;
  border-color: var(--bx-primary);
}

.spa-config-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 8px 12px;
}

.spa-quick-col {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  flex: 1;
}

.spa-quick-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.spa-quick-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.spa-quick-select-action {
  display: flex;
  align-items: center;
  gap: 4px;
}

.spa-select {
  min-width: 170px;
  max-width: 240px;
  height: 30px;
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  text-overflow: ellipsis;
}
.spa-select:focus {
  border-color: var(--bx-primary);
  outline: none;
}

.btn-quick-create-spa {
  height: 30px;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(37, 99, 235, 0.1);
  color: var(--bx-primary);
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
}
.btn-quick-create-spa:hover {
  background: var(--bx-primary);
  color: white;
}

.spa-quick-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-quick-scan-spa {
  height: 30px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: all var(--transition-fast);
}
.btn-quick-scan-spa:hover {
  background: var(--bg-hover);
  color: var(--bx-primary);
  border-color: var(--bx-primary);
}

.spa-optional-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px dashed rgba(37, 99, 235, 0.3);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--bx-primary);
  font-weight: 500;
  white-space: nowrap;
}

/* Modal Portal SPA Config Box */
.portal-spa-config-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 14px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.spa-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.spa-box-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-main);
}

.btn-scan-spas-sm {
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all var(--transition-fast);
}
.btn-scan-spas-sm:hover {
  border-color: var(--bx-primary);
  color: var(--bx-primary);
}

.spa-box-notice {
  font-size: 11.5px;
  color: var(--text-secondary);
  background: rgba(37, 99, 235, 0.06);
  border-left: 3px solid var(--bx-primary);
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.4;
}

.spa-input-action-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.spa-input-action-group select {
  flex: 1;
}

.btn-create-spa-inline {
  height: 38px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(37, 99, 235, 0.1);
  color: var(--bx-primary);
  border: 1px solid rgba(37, 99, 235, 0.3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all var(--transition-fast);
}
.btn-create-spa-inline:hover {
  background: var(--bx-primary);
  color: white;
}

/* SPA Hub Top Card */
.spa-hub-top-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.spa-hub-portal-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.portal-badge-pill {
  background: var(--bx-primary);
  color: white;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.webhook-badge-pill {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.spa-hub-quick-selectors {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.spa-hub-select-unit {
  display: flex;
  align-items: center;
  gap: 5px;
}

.spa-hub-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-create-spa-mini {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: var(--radius-xs);
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.3);
  color: var(--bx-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: all var(--transition-fast);
}
.btn-create-spa-mini:hover {
  background: var(--bx-primary);
  color: white;
}

.btn-hub-reload {
  height: 28px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bx-primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all var(--transition-fast);
}
.btn-hub-reload:hover {
  background: var(--bx-primary-hover);
}




