/* ==========================================================================
   Shopeers Dashboard - Pixel-Perfect High-End Stylesheet
   Replication of example.png
   ========================================================================== */

/* --- CSS Variables / Design Tokens --- */
:root {
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* Primary & Accents */
  --primary-blue: #2563eb;
  --primary-blue-hover: #1d4ed8;
  --primary-blue-subtle: #eff6ff;
  --primary-blue-glow: rgba(37, 99, 235, 0.25);
  
  /* Status Colors */
  --color-success: #10b981;
  --color-success-bg: #ecfdf5;
  --color-danger: #ef4444;
  --color-danger-bg: #fef2f2;
  --color-warning: #f59e0b;
  --color-orange: #f97316;
  --color-orange-bg: #fff7ed;
  
  /* Neutral / Slate Palette */
  --bg-app: #f4f6fa;
  --bg-card: #ffffff;
  --border-card: #edf2f7;
  --border-light: #e2e8f0;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  
  /* Card Radii & Elevation */
  --radius-card: 20px;
  --radius-pill: 9999px;
  --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.02), 0 4px 12px rgba(15, 23, 42, 0.015);
  --shadow-hover: 0 4px 20px rgba(15, 23, 42, 0.06);
  --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Global Reset & Box Sizing --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

/* --- Layout Frame --- */
.dashboard-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.sidebar {
  width: 250px;
  background-color: var(--bg-card);
  border-right: 1px solid var(--border-card);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: none; /* Firefox */
}

.sidebar::-webkit-scrollbar {
  display: none; /* Chrome, Safari */
}

/* Brand Header */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 22px 6px;
}

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

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-name {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.03em;
}

.collapse-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 6px;
  transition: var(--transition-fast);
}

.collapse-btn:hover {
  color: var(--text-main);
  background-color: #f1f5f9;
}

/* Navigation Links */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  position: relative;
  transition: var(--transition-fast);
}

.nav-item:hover {
  background-color: #f8fafc;
  color: var(--text-main);
}

.nav-icon-box {
  display: flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  width: 20px;
  height: 20px;
}

.nav-label {
  flex: 1;
}

/* Active Nav State */
.nav-item.active {
  background-color: var(--primary-blue-subtle);
  color: var(--primary-blue);
  font-weight: 600;
}

.nav-item.active .nav-icon-box {
  color: var(--primary-blue);
}

.active-indicator {
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 24px;
  background-color: var(--primary-blue);
  border-radius: 0 4px 4px 0;
}

/* Badges */
.nav-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
}

.green-badge {
  background-color: var(--color-success-bg);
  color: var(--color-success);
}

/* Accordion Nav (Finances) */
.nav-accordion {
  display: flex;
  flex-direction: column;
}

.accordion-header {
  cursor: pointer;
}

.chevron-icon {
  transition: transform 0.2s ease;
  color: var(--text-faint);
}

.nav-accordion.open .chevron-icon {
  transform: rotate(180deg);
}

.submenu {
  display: flex;
  flex-direction: column;
  padding-left: 16px;
  margin-left: 28px;
  border-left: 1.5px solid #e2e8f0;
  gap: 8px;
  margin-top: 6px;
  margin-bottom: 8px;
}

.submenu-item {
  text-decoration: none;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  transition: var(--transition-fast);
}

.submenu-item:hover {
  color: var(--primary-blue);
}

/* Bottom Nav & Upgrade Card */
.nav-footer-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 20px;
}

/* Upgrade Card */
.upgrade-card {
  position: relative;
  background: linear-gradient(145deg, #17326d 0%, #1d4ed8 50%, #0f1c3d 100%);
  border-radius: 18px;
  padding: 18px 16px;
  color: #ffffff;
  margin-top: 20px;
  box-shadow: 0 10px 24px rgba(29, 78, 216, 0.25);
  overflow: hidden;
}

.upgrade-pattern-overlay {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 0);
  background-size: 12px 12px;
  pointer-events: none;
}

.upgrade-icon {
  width: 34px;
  height: 34px;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.upgrade-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.upgrade-desc {
  font-size: 11px;
  color: #bfdbfe;
  line-height: 1.4;
  margin-bottom: 16px;
}

.upgrade-btn {
  width: 100%;
  padding: 9px 0;
  background: linear-gradient(90deg, #2563eb, #3b82f6);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-pill);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
  transition: var(--transition-fast);
}

.upgrade-btn:hover {
  background: linear-gradient(90deg, #1d4ed8, #2563eb);
  transform: translateY(-1px);
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */
.main-content {
  flex: 1;
  padding: 24px 32px 48px 32px;
  display: flex;
  flex-direction: column;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
  min-width: 0;
}

.action-circle-btn.menu-btn,
.sidebar-backdrop {
  display: none;
}

/* --- Top Header (Search & Actions) --- */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.search-container {
  display: flex;
  align-items: center;
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 0 14px;
  width: 320px;
  height: 42px;
  gap: 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
  transition: var(--transition-fast);
}

.search-container:focus-within {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.search-icon {
  flex-shrink: 0;
}

.search-input {
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--font-family);
  font-size: 13px;
  color: var(--text-main);
  flex: 1;
}

.search-input::placeholder {
  color: var(--text-faint);
}

.search-shortcut {
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background-color: #f1f5f9;
  border-radius: 6px;
  padding: 2px 6px;
  border: 1px solid var(--border-light);
}

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

.action-circle-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: var(--transition-fast);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
}

.action-circle-btn:hover {
  background-color: #f8fafc;
  border-color: #cbd5e1;
}

.notification-dot {
  position: absolute;
  top: 9px;
  right: 10px;
  width: 7px;
  height: 7px;
  background-color: var(--color-danger);
  border-radius: 50%;
  border: 1.5px solid var(--bg-card);
}

.user-avatar-wrap {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--bg-card);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
  cursor: pointer;
}

.user-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- Dashboard Title Row --- */
.dashboard-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.03em;
}

.dashboard-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-pill-btn {
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
}

.filter-pill-btn:hover {
  background-color: #f8fafc;
  border-color: #cbd5e1;
}

.btn-white {
  color: var(--text-main);
  font-weight: 600;
}

.primary-btn {
  background-color: var(--primary-blue);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
  transition: var(--transition-fast);
}

.primary-btn:hover {
  background-color: var(--primary-blue-hover);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

/* ==========================================================================
   STATS CARDS ROW (4 CARDS)
   ========================================================================== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  transition: var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.stat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

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

.stat-icon-wrapper {
  width: 24px;
  height: 24px;
  background-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.03em;
}

.trend-pill {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.trend-up {
  background-color: var(--color-success-bg);
  color: var(--color-success);
}

.trend-down {
  background-color: var(--color-danger-bg);
  color: var(--color-danger);
}

.stat-compare {
  font-size: 12px;
  color: var(--text-faint);
  font-weight: 400;
}

/* ==========================================================================
   DASHBOARD 2-COLUMN GRID
   ========================================================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.grid-col-left,
.grid-col-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Common Card Styles */
.dashboard-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

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

.card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.more-btn {
  background: transparent;
  border: none;
  color: var(--text-faint);
  font-size: 18px;
  letter-spacing: 2px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: var(--transition-fast);
}

.more-btn:hover {
  color: var(--text-main);
}

/* ==========================================================================
   TOTAL PROFIT & CUSTOMERS CARD
   ========================================================================== */
.profit-customers-card {
  padding-bottom: 20px;
}

.profit-header {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  margin-bottom: 16px;
  gap: 20px;
}

.profit-title-area {
  min-width: 170px;
  display: flex;
  flex-direction: column;
}

.profit-metric-row {
  margin-top: 60px;
}

.profit-value {
  font-size: 36px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.03em;
  display: block;
}

.profit-badge-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.profit-period-label {
  font-size: 12px;
  color: var(--text-faint);
}

/* SVG Profit Chart Container */
.profit-chart-container {
  flex: 1;
  position: relative;
  height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.profit-chart-svg {
  width: 100%;
  height: 170px;
  overflow: visible;
}

.chart-grid-line {
  stroke: #f1f5f9;
  stroke-width: 1;
}

.chart-grid-line.baseline {
  stroke: #e2e8f0;
}

.chart-axis-label {
  fill: var(--text-faint);
  font-size: 10px;
  font-family: var(--font-family);
  font-weight: 500;
}

.chart-x-labels {
  display: flex;
  justify-content: space-between;
  padding-left: 48px;
  padding-right: 8px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 500;
}

/* Chart Tooltip */
.chart-tooltip {
  position: absolute;
  top: 18px;
  left: 58%;
  transform: translateX(8px);
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 10px 25px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -2px rgba(15, 23, 42, 0.05);
  z-index: 10;
  pointer-events: none;
}

.tooltip-date {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.tooltip-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 1.4;
}

.tooltip-dash {
  font-weight: 800;
  font-size: 13px;
  line-height: 1;
}

.blue-dash {
  color: var(--primary-blue);
}

.grey-dash {
  color: var(--text-faint);
}

.tooltip-val {
  font-weight: 700;
  color: var(--text-main);
}

.tooltip-muted {
  font-size: 11px;
  color: var(--text-faint);
}

/* Hand Cursor Pointer */
.chart-hand-cursor {
  position: absolute;
  top: 42px;
  left: 58%;
  transform: translateX(-16px);
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.18));
}

/* Customers Section inside Card */
.customers-section {
  margin-top: 14px;
  border-top: 1px solid var(--border-card);
  padding-top: 16px;
}

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

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

.customers-distribution {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.customer-stat-col {
  display: flex;
  flex-direction: column;
}

.cust-stat-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cust-icon-box {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cust-blue {
  background-color: var(--primary-blue-subtle);
}

.cust-green {
  background-color: var(--color-success-bg);
}

.cust-orange {
  background-color: var(--color-orange-bg);
}

.cust-number {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.cust-type {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin: 4px 0 10px 0;
}

.cust-progress-bar {
  height: 5px;
  border-radius: 4px;
  width: 100%;
}

.blue-bar-bg {
  background-color: var(--primary-blue);
}

.green-bar-bg {
  background-color: var(--color-success);
}

.orange-bar-bg {
  background-color: var(--color-orange);
}

/* ==========================================================================
   BEST SELLING PRODUCTS TABLE
   ========================================================================== */
.table-card {
  padding-bottom: 12px;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.products-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.products-table th {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 12px 14px 12px;
}

.products-table td {
  padding: 12px;
  font-size: 13px;
  vertical-align: middle;
  border-top: 1px solid #f8fafc;
}

.td-id {
  color: var(--text-muted);
  font-weight: 500;
}

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

.product-thumb {
  width: 36px;
  height: 36px;
  background-color: #f1f5f9;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.product-title {
  font-weight: 600;
  color: var(--text-main);
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.td-sold {
  color: var(--text-muted);
  font-weight: 500;
}

.td-revenue {
  font-weight: 600;
  white-space: nowrap;
}

.revenue-up {
  color: var(--color-success);
}

.revenue-down {
  color: var(--color-danger);
}

.td-rating {
  white-space: nowrap;
}

.star-icon {
  color: var(--color-warning);
  font-size: 14px;
  margin-right: 4px;
}

.rating-val {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

/* ==========================================================================
   MOST DAY ACTIVE BAR CHART
   ========================================================================== */
.active-days-card {
  padding-bottom: 24px;
}

.bar-chart-container {
  height: 180px;
  display: flex;
  align-items: flex-end;
  padding-top: 24px;
}

.bar-chart-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
  height: 100%;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  position: relative;
}

.bar-track {
  flex: 1;
  width: 32px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  margin-bottom: 12px;
}

.bar-fill {
  width: 100%;
  background-color: #f1f5f9;
  border-radius: 9999px;
  transition: height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.primary-active-bar {
  background-color: var(--primary-blue);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.bar-tooltip-val {
  position: absolute;
  top: -12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-main);
}

.bar-day-label {
  font-size: 12px;
  color: var(--text-faint);
  font-weight: 500;
}

.active-day-label {
  color: var(--primary-blue);
  font-weight: 700;
}

/* ==========================================================================
   REPEAT CUSTOMER RATE RADIAL GAUGE
   ========================================================================== */
.customer-rate-card {
  position: relative;
}

.gauge-chart-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0;
}

.gauge-svg-box {
  position: relative;
  width: 240px;
  height: 150px;
  display: flex;
  justify-content: center;
}

.gauge-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.gauge-center-content {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
}

.gauge-percentage {
  font-size: 38px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.03em;
  line-height: 1;
}

.gauge-target {
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 500;
  margin: 6px 0 12px 0;
}

.gauge-details-btn {
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition-fast);
}

.gauge-details-btn:hover {
  background-color: #f8fafc;
  border-color: #cbd5e1;
}

/* ==========================================================================
   AI ASSISTANT (3D Sphere & Prompt Field)
   ========================================================================== */
.ai-assistant-card {
  display: flex;
  flex-direction: column;
}

.expand-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.expand-btn:hover {
  color: var(--text-main);
}

.ai-visual-area {
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.ai-mesh-glow {
  position: absolute;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, rgba(244, 246, 250, 0) 70%);
  pointer-events: none;
}

.ai-sphere-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ai-sphere {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #60a5fa 0%, #2563eb 45%, #1d4ed8 70%, #1e3a8a 95%);
  box-shadow: 
    0 14px 28px rgba(37, 99, 235, 0.38),
    inset 0 2px 6px rgba(255, 255, 255, 0.65),
    inset 0 -8px 14px rgba(15, 23, 42, 0.6);
  position: relative;
  animation: floatSphere 3.5s ease-in-out infinite alternate;
}

.sphere-highlight {
  position: absolute;
  top: 14px;
  left: 20px;
  width: 16px;
  height: 10px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  filter: blur(2px);
}

.sphere-shadow {
  width: 58px;
  height: 10px;
  background: radial-gradient(ellipse, rgba(37, 99, 235, 0.3) 0%, transparent 75%);
  border-radius: 50%;
  margin-top: 12px;
  animation: shadowPulse 3.5s ease-in-out infinite alternate;
}

@keyframes floatSphere {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}

@keyframes shadowPulse {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(0.85); opacity: 0.4; }
}

/* AI Input Bar */
.ai-input-bar {
  background-color: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 30px;
  padding: 5px 8px 5px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  transition: var(--transition-fast);
}

.ai-input-bar:focus-within {
  border-color: var(--primary-blue);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.ai-text-input {
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--font-family);
  font-size: 13px;
  color: var(--text-main);
  flex: 1;
}

.ai-text-input::placeholder {
  color: var(--text-faint);
}

.ai-input-icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 50%;
  transition: var(--transition-fast);
}

.ai-input-icon-btn:hover {
  color: var(--primary-blue);
}

.ai-send-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--primary-blue);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.ai-send-btn:hover {
  background-color: var(--primary-blue-hover);
  transform: scale(1.05);
}

/* ==========================================================================
   RESPONSIVE DESIGN (TABLET & MOBILE BREAKPOINTS)
   ========================================================================== */
@media (max-width: 1280px) {
  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 85vw);
    height: 100vh;
    height: 100dvh;
    z-index: 100;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.25s ease, visibility 0.25s;
  }

  .sidebar.open {
    transform: none;
    visibility: visible;
    box-shadow: 0 0 40px rgba(15, 23, 42, 0.2);
    /* visibility must flip instantly on open so the close button can take focus */
    transition: transform 0.25s ease;
  }

  /* "transition: all" would delay inherited visibility and block focus() on open */
  .collapse-btn {
    transition-property: color, background-color;
  }

  .sidebar-nav {
    flex: none;
  }

  .sidebar.open ~ .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(15, 23, 42, 0.45);
  }

  .action-circle-btn.menu-btn {
    display: flex;
    flex-shrink: 0;
  }

  .top-header {
    gap: 12px;
  }

  .search-container {
    flex: 1;
    width: auto;
    max-width: 420px;
    min-width: 0;
    margin-right: auto;
  }

  .search-input {
    min-width: 0;
    width: 100%;
  }

  .stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .main-content {
    padding: 16px 16px 32px;
  }

  .top-header {
    flex-wrap: wrap;
  }

  .header-actions {
    margin-left: auto;
    gap: 8px;
  }

  .search-container {
    order: 1;
    flex-basis: 100%;
    max-width: none;
  }

  .search-shortcut {
    display: none;
  }

  /* 16px stops iOS from zooming on focus */
  .search-input,
  .ai-text-input {
    font-size: 16px;
  }

  .dashboard-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .filter-pill-btn,
  .primary-btn {
    justify-content: center;
    min-height: 44px;
  }

  .dashboard-controls > :first-child,
  .dashboard-controls .dropdown-btn {
    grid-column: 1 / -1;
  }

  .stats-row {
    gap: 12px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-value {
    font-size: 22px;
  }

  .stat-main {
    flex-wrap: wrap;
    gap: 4px 8px;
  }

  .dashboard-card {
    padding: 16px;
  }

  .profit-header {
    flex-direction: column;
    align-items: stretch;
  }

  .profit-metric-row {
    margin-top: 8px;
  }

  .profit-chart-container {
    flex: none;
    height: auto;
  }

  .profit-chart-svg {
    height: auto;
    aspect-ratio: 520 / 180;
  }

  .chart-x-labels {
    padding-left: 8%;
  }

  .chart-tooltip {
    position: static;
    order: 1; /* below the x-axis labels */
    transform: none !important; /* beats the inline transform set on hover/tap */
    align-self: center;
    margin-top: 12px;
  }

  .chart-hand-cursor {
    display: none;
  }

  .customers-distribution {
    gap: 12px;
  }

  .cust-stat-top {
    gap: 6px;
  }

  .products-table {
    min-width: 560px;
  }

  .bar-track {
    width: min(32px, 70%);
  }
}

@media (max-width: 480px) {
  /* the SVG scales down on phones, so its labels need a bigger source size */
  .chart-axis-label {
    font-size: 15px;
  }
}

@media (max-width: 360px) {
  .stats-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .ai-sphere,
  .sphere-shadow {
    transition: none;
    animation: none;
  }
}

/* ==========================================================================
   MOTION (classes are added by initReveal, which skips reduced-motion users)
   ========================================================================== */
.reveal {
  opacity: 0;
}

.reveal.in {
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --start: calc(var(--delay, 0ms) + 250ms);
  opacity: 1;
  animation: rise 0.6s var(--ease) var(--delay, 0ms) backwards;
}

.reveal.in .chart-line {
  stroke-dasharray: 1;
  animation: draw-line 1.4s cubic-bezier(0.65, 0, 0.35, 1) var(--start) backwards;
}

.reveal.in :is(.chart-area, .chart-past) {
  animation: fade 0.9s ease calc(var(--start) + 500ms) backwards;
}

.reveal.in :is(.chart-point, .chart-tooltip, .chart-hand-cursor) {
  animation: fade 0.4s ease calc(var(--start) + 1200ms) backwards;
}

.reveal.in .bar-fill {
  animation: grow 0.8s var(--ease) var(--start) backwards;
}

.bar-col:nth-child(2) .bar-fill { animation-delay: calc(var(--start) + 60ms); }
.bar-col:nth-child(3) .bar-fill { animation-delay: calc(var(--start) + 120ms); }
.bar-col:nth-child(4) .bar-fill { animation-delay: calc(var(--start) + 180ms); }
.bar-col:nth-child(5) .bar-fill { animation-delay: calc(var(--start) + 240ms); }
.bar-col:nth-child(6) .bar-fill { animation-delay: calc(var(--start) + 300ms); }
.bar-col:nth-child(7) .bar-fill { animation-delay: calc(var(--start) + 360ms); }

.reveal.in .gauge-ticks line {
  animation: fade 0.3s ease calc(var(--start) + var(--i) * 22ms) backwards;
}

.reveal.in .cust-progress-bar {
  animation: wipe 0.9s var(--ease) var(--start) backwards;
}

.reveal.in tbody tr {
  animation: fade 0.5s ease var(--start) backwards;
}

.reveal.in tbody tr:nth-child(2) { animation-delay: calc(var(--start) + 70ms); }
.reveal.in tbody tr:nth-child(3) { animation-delay: calc(var(--start) + 140ms); }
.reveal.in tbody tr:nth-child(4) { animation-delay: calc(var(--start) + 210ms); }
.reveal.in tbody tr:nth-child(5) { animation-delay: calc(var(--start) + 280ms); }

@media (prefers-reduced-motion: no-preference) {
  .sidebar.open ~ .sidebar-backdrop {
    animation: fade 0.25s ease;
  }
}

@keyframes rise {
  from { opacity: 0; translate: 0 16px; }
}

@keyframes fade {
  from { opacity: 0; }
}

@keyframes draw-line {
  from { stroke-dashoffset: 1; }
}

@keyframes grow {
  from { height: 0; }
}

@keyframes wipe {
  from { clip-path: inset(0 100% 0 0); }
}
