/* ==========================================================================
   PROPSALES PRO - DESIGN SYSTEM & LUXURY REAL ESTATE STYLESHEET
   Aesthetics: Deep Luxury Navy, Champagne Gold, Emerald Accents, Glassmorphism
   Responsive: Mobile-First + Tablet & Ultra-wide Desktop Support
   ========================================================================== */

:root {
  /* Core Color Palette */
  --bg-deep: #070a14;
  --bg-surface: #0e1526;
  --bg-card: #151f36;
  --bg-card-hover: #1c2947;
  --bg-card-subtle: #111a2e;
  
  --border-light: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.15);
  --border-focus: #3b82f6;

  /* Text Colors */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-gold: #f59e0b;
  --text-gold-light: #fde68a;
  --text-emerald: #10b981;
  --text-cyan: #06b6d4;

  /* Brand Accents */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-glow: rgba(37, 99, 235, 0.35);
  
  --gold: #d97706;
  --gold-gradient: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);
  --gold-glow: rgba(245, 158, 11, 0.25);

  --emerald: #10b981;
  --emerald-gradient: linear-gradient(135deg, #10b981 0%, #047857 100%);
  
  --purple: #8b5cf6;
  --purple-gradient: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);

  --danger: #ef4444;
  --warning: #f59e0b;

  /* Unit Status Colors */
  --status-avail: #10b981;
  --status-holding: #f59e0b;
  --status-dep: #ef4444;
  --status-sold: #64748b;

  /* Shadows & Glassmorphism */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
  --glass-bg: rgba(21, 31, 54, 0.75);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-blur: blur(12px);

  /* Dimensions */
  --header-height: 64px;
  --sidebar-width: 250px;
  --mobile-nav-height: 68px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Transitions */
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   RESET & BASE
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-deep);
}
::-webkit-scrollbar-thumb {
  background: #25334e;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3b82f6;
}

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

/* ==========================================================================
   TOP HEADER
   ========================================================================== */
.app-header {
  height: var(--header-height);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.logo-icon {
  font-size: 24px;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(37, 99, 235, 0.3);
  padding: 4px 8px;
  border-radius: var(--radius-md);
}

.brand-title {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.5px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-vip {
  font-size: 0.65rem;
  font-weight: 800;
  background: var(--gold-gradient);
  color: #000;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 1px;
}

.brand-sub {
  display: block;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

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

.quick-metric {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  background: rgba(255, 255, 255, 0.03);
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-light);
}

.metric-label {
  color: var(--text-muted);
}
.metric-val {
  font-weight: 700;
}

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

.user-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  padding: 4px 10px 4px 6px;
  border-radius: 24px;
  border: 1px solid var(--border-medium);
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
}

.user-dropdown {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}
.user-dropdown option {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* ==========================================================================
   APP CONTAINER & DESKTOP SIDEBAR
   ========================================================================== */
.app-container {
  display: flex;
  flex: 1;
}

.desktop-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 14px;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  position: relative;
  width: 100%;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  transform: translateX(3px);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.2) 0%, rgba(37, 99, 235, 0.05) 100%);
  color: #60a5fa;
  border-left: 3px solid #3b82f6;
}

.nav-icon {
  font-size: 1.2rem;
}

.nav-text {
  flex: 1;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quick-action-card {
  background: linear-gradient(145deg, #18233d 0%, #111a2f 100%);
  border: 1px solid rgba(59, 130, 246, 0.25);
  padding: 14px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.quick-action-card h4 {
  font-size: 0.85rem;
  margin-bottom: 4px;
  color: var(--text-gold);
}
.quick-action-card p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.version-tag {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
}

/* ==========================================================================
   MAIN CONTENT & TABS
   ========================================================================== */
.main-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  max-width: 1600px;
}

.tab-panel {
  display: none;
  animation: fadeIn 0.25s ease-out;
}
.tab-panel.active {
  display: block;
}

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

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}

.panel-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.3px;
}
.panel-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 3px;
}

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

/* ==========================================================================
   BUTTONS & FORM CONTROLS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: white;
  box-shadow: 0 2px 10px var(--primary-glow);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 4px 14px var(--primary-glow);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border-color: var(--border-medium);
  color: var(--text-primary);
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-zalo {
  background: #0068ff;
  color: white;
  box-shadow: 0 2px 8px rgba(0, 104, 255, 0.3);
}
.btn-zalo:hover {
  background: #0053cc;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}
.btn-lg {
  padding: 14px 24px;
  font-size: 1rem;
}
.btn-block {
  width: 100%;
}

.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-group label .req {
  color: var(--danger);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.9rem;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.input-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-row {
  display: flex;
  gap: 14px;
}
.col-6 {
  flex: 1;
}

.search-input-wrapper {
  position: relative;
  min-width: 240px;
}
.search-input-wrapper input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: 20px;
  padding: 8px 14px 8px 36px;
  font-size: 0.85rem;
  color: white;
  outline: none;
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ==========================================================================
   TAB 1: CRM KANBAN BOARD
   ========================================================================== */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(280px, 1fr));
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 24px;
}

.kanban-col {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  min-height: 520px;
  max-height: 80vh;
}

.kanban-col-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-top: 3px solid transparent;
}
.border-blue { border-top-color: #3b82f6; }
.border-purple { border-top-color: #8b5cf6; }
.border-gold { border-top-color: #f59e0b; }
.border-orange { border-top-color: #f97316; }
.border-green { border-top-color: #10b981; }

.col-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.9rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.dot-blue { background: #3b82f6; }
.dot-purple { background: #8b5cf6; }
.dot-gold { background: #f59e0b; }
.dot-orange { background: #f97316; }
.dot-green { background: #10b981; }

.col-count {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 700;
}

.kanban-cards-wrapper {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  flex: 1;
}

/* Lead Card */
.lead-card {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: grab;
  transition: var(--transition);
  position: relative;
  box-shadow: var(--shadow-sm);
}
.lead-card:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: var(--shadow-md);
}

.lead-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.lead-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
}
.lead-channel-tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(37, 99, 235, 0.2);
  color: #93c5fd;
}

.lead-phone {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.lead-budget {
  font-size: 0.82rem;
  color: var(--text-gold);
  font-weight: 600;
  margin-bottom: 6px;
}

.lead-notes {
  font-size: 0.78rem;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.2);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  line-height: 1.4;
}

.lead-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 8px;
}

.lead-contact-btns {
  display: flex;
  gap: 6px;
}

.btn-icon-link {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 0.8rem;
  transition: var(--transition);
}
.btn-icon-link:hover {
  background: var(--primary);
  transform: scale(1.1);
}

.stage-select-mini {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 0.72rem;
  border-radius: 4px;
  padding: 3px 6px;
  outline: none;
  cursor: pointer;
}

/* ==========================================================================
   TAB 2: GIỎ HÀNG THỜI GIAN THỰC (INVENTORY)
   ========================================================================== */
.inventory-status-summary {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.inv-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
}

.chip-color {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.chip-avail .chip-color { background: var(--status-avail); }
.chip-holding .chip-color { background: var(--status-holding); }
.chip-dep .chip-color { background: var(--status-dep); }
.chip-sold .chip-color { background: var(--status-sold); }

.filters-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.units-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 18px;
}

/* Unit Card */
.unit-card {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 18px;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.unit-card:hover {
  border-color: rgba(59, 130, 246, 0.4);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.unit-badge-status {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-available {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-holding {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
  animation: pulseAmber 2s infinite;
}
.badge-deposited {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.badge-sold {
  background: rgba(100, 116, 139, 0.2);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.3);
}

@keyframes pulseAmber {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.unit-top-info {
  margin-bottom: 12px;
}
.unit-project-name {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.unit-code {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  margin-top: 2px;
}

.unit-specs-chips {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.spec-chip {
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}

.unit-price-box {
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 14px;
}
.price-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.price-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.price-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-gold);
}

/* Holding Countdown Timer in Card */
.holding-timer-banner {
  background: rgba(245, 158, 11, 0.12);
  border: 1px dashed rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  margin-bottom: 12px;
  font-size: 0.78rem;
  color: #fbbf24;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.timer-digits {
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 1px;
}

.unit-card-actions {
  display: flex;
  gap: 8px;
}

/* ==========================================================================
   TAB 3: QUICK QUOTE BUILDER & PREVIEW
   ========================================================================== */
.quote-builder-layout {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 24px;
  align-items: start;
}

.quote-config-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.card-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-inline {
  display: flex;
  gap: 10px;
}

.payment-plan-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.plan-radio-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}
.plan-radio-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(59, 130, 246, 0.4);
}
.plan-radio-card.active {
  border-color: #3b82f6;
  background: rgba(37, 99, 235, 0.1);
}

.plan-info {
  flex: 1;
}
.plan-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.plan-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: #fff;
}
.plan-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.2);
  color: var(--text-gold);
}
.plan-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Quote Preview Sheet */
.quote-preview-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.preview-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 16px;
}

.preview-badge {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-gold-light);
}

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

/* Printable Luxury Real Estate Quote Sheet */
.quote-sheet {
  background: #ffffff;
  color: #0f172a;
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
  font-size: 0.9rem;
  line-height: 1.5;
}

.qs-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #0f172a;
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.qs-logo {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: #1e3a8a;
}
.qs-sub {
  font-size: 0.85rem;
  font-weight: 700;
  color: #475569;
  margin-top: 2px;
}

.qs-meta {
  text-align: right;
  font-size: 0.8rem;
  color: #64748b;
}
.qs-code {
  font-weight: 800;
  color: #0f172a;
}

.qs-banner {
  background: #1e3a8a;
  color: #ffffff;
  text-align: center;
  font-weight: 800;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  margin-bottom: 20px;
}

.qs-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.qs-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 14px;
}
.qs-box-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: #1e3a8a;
  border-bottom: 1px solid #cbd5e1;
  padding-bottom: 6px;
  margin-bottom: 8px;
}
.qs-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 4px;
  color: #334155;
}
.qs-row b {
  color: #0f172a;
}

/* Tables inside Quote */
.qs-table, .qs-table-mini {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}
.qs-table th, .qs-table-mini th {
  background: #f1f5f9;
  color: #334155;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 8px 12px;
  text-align: left;
  border-bottom: 2px solid #cbd5e1;
}
.qs-table td, .qs-table-mini td {
  padding: 8px 12px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.85rem;
  color: #1e293b;
}

.highlight-row-discount td {
  background: #ecfdf5;
  font-weight: 600;
}
.text-emerald {
  color: #059669 !important;
}

.total-row td {
  background: #eff6ff;
  border-top: 2px solid #2563eb;
  border-bottom: 2px solid #2563eb;
  padding: 12px;
}
.total-price {
  font-size: 1.15rem;
  color: #1d4ed8;
}

.qs-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  margin-top: 20px;
}

.broker-card {
  display: flex;
  align-items: center;
  gap: 12px;
}
.broker-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #1e3a8a;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
}
.broker-tag {
  font-size: 0.7rem;
  font-weight: 800;
  color: #2563eb;
  letter-spacing: 0.5px;
}
.broker-name {
  font-weight: 800;
  font-size: 1rem;
  color: #0f172a;
}
.broker-phone {
  font-size: 0.85rem;
  font-weight: 700;
  color: #059669;
}
.broker-team {
  font-size: 0.75rem;
  color: #64748b;
}

.qs-qr-box {
  text-align: center;
}
.qr-placeholder {
  border: 1px dashed #94a3b8;
  padding: 8px 14px;
  border-radius: 6px;
  background: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.qr-code-img {
  font-size: 2rem;
}
.qr-placeholder span {
  font-size: 0.7rem;
  font-weight: 600;
  color: #475569;
}

.qs-disclaimer {
  font-size: 0.72rem;
  color: #94a3b8;
  text-align: center;
  margin-top: 14px;
  font-style: italic;
}

/* ==========================================================================
   TAB 4: KPI & COMMISSION TRACKER
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.kpi-card {
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  border: 1px solid var(--border-medium);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.bg-gradient-blue { background: linear-gradient(135deg, #132247 0%, #0e172e 100%); border-color: rgba(59, 130, 246, 0.3); }
.bg-gradient-gold { background: linear-gradient(135deg, #33210d 0%, #171108 100%); border-color: rgba(245, 158, 11, 0.3); }
.bg-gradient-emerald { background: linear-gradient(135deg, #0d2e23 0%, #081712 100%); border-color: rgba(16, 185, 129, 0.3); }
.bg-gradient-purple { background: linear-gradient(135deg, #261642 0%, #120921 100%); border-color: rgba(139, 92, 246, 0.3); }

.kpi-icon {
  font-size: 2rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 8px 12px;
  border-radius: var(--radius-md);
}

.kpi-content {
  display: flex;
  flex-direction: column;
}
.kpi-title {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
}
.kpi-value {
  font-size: 1.45rem;
  font-weight: 800;
  color: #fff;
  margin: 4px 0 2px 0;
}
.kpi-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.card-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.table-responsive {
  overflow-x: auto;
}
.app-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.app-table th {
  text-align: left;
  padding: 12px 14px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-medium);
  font-weight: 600;
  background: rgba(0, 0, 0, 0.15);
}
.app-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}

/* ==========================================================================
   MODALS & TOAST NOTIFICATION
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal-backdrop.active {
  display: flex;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  animation: modalPop 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}
.modal-dialog-sm {
  max-width: 420px;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
}
.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
}
.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}
.modal-close-btn:hover {
  color: white;
}

.modal-body {
  padding: 20px;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 14px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid var(--border-light);
  background: rgba(0, 0, 0, 0.2);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 80px;
  right: 24px;
  background: #1e293b;
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: white;
  padding: 12px 20px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ==========================================================================
   MOBILE NAVIGATION (BOTTOM BAR)
   ========================================================================== */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--mobile-nav-height);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--border-medium);
  z-index: 99;
  justify-content: space-around;
  align-items: center;
  padding: 0 8px;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  gap: 3px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  position: relative;
  transition: var(--transition);
}

.mobile-nav-item .nav-icon {
  font-size: 1.25rem;
}

.mobile-nav-item.active {
  color: #60a5fa;
}
.mobile-nav-item.active .nav-icon {
  transform: translateY(-2px);
}

.mobile-badge {
  position: absolute;
  top: 4px;
  right: 14px;
  background: #ef4444;
  color: white;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 10px;
}

/* Helpers */
.text-right { text-align: right; }
.text-gold { color: var(--text-gold) !important; }
.text-emerald { color: var(--text-emerald) !important; }
.text-cyan { color: var(--text-cyan) !important; }
.text-blue { color: #2563eb !important; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-3 { margin-bottom: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ==========================================================================
   RESPONSIVE BREAKPOINTS (MOBILE & TABLET)
   ========================================================================== */
@media (max-width: 1024px) {
  .quote-builder-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .header-center {
    display: none;
  }
  .desktop-sidebar {
    display: none;
  }
  .mobile-bottom-nav {
    display: flex;
  }
  .hide-mobile {
    display: none;
  }
  .main-content {
    padding: 16px;
    padding-bottom: calc(var(--mobile-nav-height) + 20px);
  }
  .app-header {
    padding: 0 14px;
  }
  .panel-header {
    flex-direction: column;
    align-items: stretch;
  }
  .panel-actions {
    flex-direction: column;
  }
  .search-input-wrapper {
    width: 100%;
  }
  .btn {
    width: 100%;
  }
  .quote-sheet {
    padding: 18px;
  }
  .qs-grid-2 {
    grid-template-columns: 1fr;
  }
  .qs-footer {
    flex-direction: column;
    gap: 14px;
    text-align: center;
  }
  .broker-card {
    flex-direction: column;
  }
}

/* ==========================================================================
   PRINT STYLESHEET (PROFESSIONAL QUOTE PRINTING)
   ========================================================================== */
@media print {
  body {
    background: white !important;
    color: black !important;
  }
  .app-header, .desktop-sidebar, .mobile-bottom-nav, .preview-actions-bar, .quote-config-card, .toast, .panel-header {
    display: none !important;
  }
  .main-content, .app-layout, .app-container {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
  }
  .quote-builder-layout {
    display: block !important;
  }
  .quote-sheet {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    width: 100% !important;
  }
}
