:root {
  --bg-main: #0f1013;
  --bg-card: #17181c;
  --bg-card-hover: #1f2127;
  --bg-input: #23252c;
  --border-color: #2c2f38;
  --border-light: #3d424e;
  
  --re-red: #da291c;
  --re-red-hover: #b82216;
  --re-gold: #e5b324;
  --re-gold-dark: #b88d14;
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-sub: #6b7280;
  
  --badge-active-bg: rgba(34, 197, 94, 0.15);
  --badge-active-text: #4ade80;
  --badge-inactive-bg: rgba(156, 163, 175, 0.15);
  --badge-inactive-text: #9ca3af;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.7);
  --transition: all 0.2s ease-in-out;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  padding-bottom: 60px;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.header {
  background: linear-gradient(180deg, #18191f 0%, #111216 100%);
  border-bottom: 2px solid var(--re-red);
  padding: 24px 20px;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

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

.brand-badge {
  background: var(--re-red);
  color: #fff;
  font-weight: 900;
  letter-spacing: 1.5px;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 1.1rem;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(218, 41, 28, 0.4);
}

.brand-title h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
}

.brand-title p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

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

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: var(--border-color);
  border-color: var(--re-gold);
  color: #fff;
}

/* KPI Banner */
.stats-banner {
  max-width: 1360px;
  margin: 20px auto 0;
  padding: 0 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: rgba(229, 179, 36, 0.1);
  color: var(--re-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-icon.red {
  background: rgba(218, 41, 28, 0.12);
  color: #ff5247;
}

.stat-icon.green {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
}

.stat-info .stat-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
}

.stat-info .stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Navigation & Filter Bar */
.controls-container {
  max-width: 1360px;
  margin: 20px auto 0;
  padding: 0 20px;
}

.controls-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.search-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.search-box {
  flex: 1;
  min-width: 280px;
  position: relative;
}

.search-box input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 16px 12px 42px;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.search-box input:focus {
  border-color: var(--re-red);
  box-shadow: 0 0 0 2px rgba(218, 41, 28, 0.25);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.view-tabs {
  display: flex;
  background: var(--bg-input);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.view-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.view-tab.active {
  background: var(--re-red);
  color: #fff;
  box-shadow: 0 2px 6px rgba(218, 41, 28, 0.4);
}

/* Filter pills row */
.filter-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.pills-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.pill-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-sub);
  text-transform: uppercase;
  margin-right: 4px;
}

.pill {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.pill:hover {
  border-color: var(--border-light);
  color: #fff;
}

.pill.active {
  background: #2a2d36;
  border-color: var(--re-gold);
  color: var(--re-gold);
}

.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.toggle-wrapper input[type="checkbox"] {
  accent-color: var(--re-red);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.toggle-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
}

/* Main Content Area */
.main-content {
  max-width: 1360px;
  margin: 24px auto 0;
  padding: 0 20px;
}

/* Grid View (Cards) */
.bike-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 22px;
}

.bike-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
  position: relative;
}

.bike-card:hover {
  transform: translateY(-4px);
  border-color: #4b5160;
  box-shadow: var(--shadow-lg);
}

.card-top-bar {
  padding: 16px 18px 8px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.bike-heading h3 {
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.3px;
}

.bike-heading .bike-category {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.cc-badge {
  background: rgba(229, 179, 36, 0.15);
  color: var(--re-gold);
  border: 1px solid rgba(229, 179, 36, 0.3);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
}

/* Bike Photo Stage */
.bike-stage {
  width: 100%;
  height: 230px;
  background: radial-gradient(circle, #252833 0%, #15161b 80%);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.bike-img {
  max-width: 95%;
  max-height: 200px;
  object-fit: contain;
  filter: drop-shadow(0 12px 16px rgba(0, 0, 0, 0.7));
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.status-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 9px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  z-index: 2;
}

.status-badge.active {
  background: var(--badge-active-bg);
  color: var(--badge-active-text);
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.status-badge.inactive {
  background: var(--badge-inactive-bg);
  color: var(--badge-inactive-text);
  border: 1px solid rgba(156, 163, 175, 0.3);
}

.version-pill {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  z-index: 2;
}

/* Color Swatches Selector */
.swatch-section {
  padding: 14px 18px 8px;
}

.swatch-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.swatch-title {
  font-size: 0.76rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
}

.selected-color-name {
  font-size: 0.86rem;
  color: #fff;
  font-weight: 700;
}

.swatches-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 80px;
  overflow-y: auto;
  padding: 2px;
}

.swatch-item {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  background-color: #222;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.swatch-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.swatch-item:hover {
  transform: scale(1.12);
  border-color: #fff;
}

.swatch-item.active {
  border-color: var(--re-gold);
  transform: scale(1.15);
  box-shadow: 0 0 0 2px rgba(229, 179, 36, 0.4);
}

.swatch-item.is-inactive {
  opacity: 0.5;
}

/* Card Price & Specs */
.card-body {
  padding: 10px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: auto;
}

.price-box {
  background: var(--bg-input);
  border-radius: 8px;
  padding: 12px 14px;
  border-left: 3px solid var(--re-red);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.price-box .price-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.price-box .price-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
}

.consortium-badge {
  text-align: right;
}

.consortium-badge .c-label {
  font-size: 0.7rem;
  color: var(--text-sub);
  text-transform: uppercase;
}

.consortium-badge .c-val {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--re-gold);
}

/* Mini Specs */
.specs-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

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

.spec-item .s-label {
  font-size: 0.68rem;
  color: var(--text-sub);
  text-transform: uppercase;
}

.spec-item .s-val {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Card Action Buttons */
.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-top: 4px;
}

.btn-card {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-card.primary {
  background: var(--re-red);
  color: #fff;
}

.btn-card.primary:hover {
  background: var(--re-red-hover);
}

.btn-card.outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-card.outline:hover {
  border-color: var(--re-gold);
  color: var(--re-gold);
}

/* Table View */
.table-view-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table-wrapper {
  overflow-x: auto;
}

.sales-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.sales-table thead th {
  background: #121317;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 14px 16px;
  border-bottom: 2px solid var(--re-red);
  white-space: nowrap;
}

.sales-table tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.15s ease;
}

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

.sales-table td {
  padding: 12px 16px;
  vertical-align: middle;
}

.tbl-bike-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tbl-bike-thumb {
  width: 54px;
  height: 40px;
  object-fit: contain;
  background: #252833;
  border-radius: 4px;
  padding: 2px;
}

.tbl-bike-name {
  font-weight: 700;
  color: #fff;
}

.tbl-bike-cc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.tbl-color-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tbl-color-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  object-fit: cover;
}

.tbl-price {
  font-weight: 800;
  color: #fff;
  font-size: 0.95rem;
}

.tbl-consortium {
  color: var(--re-gold);
  font-weight: 600;
  font-size: 0.85rem;
}

/* WhatsApp Generator View */
.quote-generator-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  box-shadow: var(--shadow-md);
}

.quote-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.form-group label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.form-group select,
.form-group input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.form-group select:focus,
.form-group input:focus {
  border-color: var(--re-red);
}

.quote-preview-box {
  background: #0d1418;
  border: 1px solid #1f2c34;
  border-radius: 10px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.quote-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #1f2c34;
}

.wa-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #25d366;
  font-weight: 700;
  font-size: 0.85rem;
}

.quote-text-area {
  background: #111b21;
  border: 1px solid #202c33;
  border-radius: 8px;
  padding: 16px;
  color: #e9edef;
  font-family: monospace;
  font-size: 0.86rem;
  white-space: pre-wrap;
  line-height: 1.5;
  min-height: 240px;
  user-select: all;
}

.quote-preview-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.btn-whatsapp {
  flex: 1;
  background: #25d366;
  color: #fff;
  font-weight: 700;
  border: none;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-whatsapp:hover {
  background: #1eb956;
}

/* Modal Specs */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  max-width: 780px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: 24px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
}

.modal-close:hover {
  color: #fff;
  border-color: var(--re-red);
}

/* Toast Notification */
.toast-notice {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1a1a1f;
  border: 1px solid var(--re-gold);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
}

.toast-notice.show {
  transform: translateY(0);
  opacity: 1;
}

/* Print Styles */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
    padding: 0;
  }
  .header, .controls-container, .stats-banner, .card-actions, .swatches-grid, .btn-secondary, .view-tabs {
    display: none !important;
  }
  .table-view-container {
    border: none;
    box-shadow: none;
  }
  .sales-table thead th {
    background: #f0f0f0 !important;
    color: #000 !important;
    border-bottom: 2px solid #000;
  }
  .sales-table td {
    border-bottom: 1px solid #ddd;
    color: #000 !important;
  }
  .tbl-bike-name, .tbl-price {
    color: #000 !important;
  }
  .tbl-bike-thumb {
    background: transparent !important;
  }
  .print-header {
    display: block !important;
    margin-bottom: 20px;
  }
}

.print-header {
  display: none;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .quote-generator-card {
    grid-template-columns: 1fr;
  }
  .bike-grid {
    grid-template-columns: 1fr;
  }
}
