/* ===================================
   STOCK MANAGEMENT — DESIGN SYSTEM
   Premium Dark Glassmorphism Theme
   =================================== */

/* Google Font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Custom Properties ── */
:root {
  /* Background */
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-tertiary: #1a2035;

  /* Glass */
  --glass-bg: rgba(255, 255, 255, 0.04);
  --glass-bg-hover: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(255, 255, 255, 0.14);
  --glass-blur: 20px;

  /* Solid surfaces (referenced by inline styles in index.html) */
  --bg-card: #1a2035;
  --surface-secondary: rgba(255, 255, 255, 0.05);

  /* Accent Gradients */
  --accent-primary: #6C63FF;
  --accent-primary-light: #8B83FF;
  --accent-secondary: #00D9A6;
  --accent-secondary-light: #33E4BC;
  --gradient-primary: linear-gradient(135deg, #6C63FF, #A855F7);
  --gradient-secondary: linear-gradient(135deg, #00D9A6, #06B6D4);
  --gradient-danger: linear-gradient(135deg, #EF4444, #F97316);
  --gradient-warning: linear-gradient(135deg, #F59E0B, #EAB308);
  --gradient-bg: linear-gradient(160deg, #0a0e1a 0%, #111827 40%, #0f172a 100%);

  /* Text */
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-tertiary: #64748B;
  --text-accent: #6C63FF;

  /* Status */
  --status-success: #10B981;
  --status-warning: #F59E0B;
  --status-danger: #EF4444;
  --status-info: #3B82F6;

  /* Spacing (4px scale) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow-primary: 0 0 20px rgba(108, 99, 255, 0.3);
  --shadow-glow-success: 0 0 20px rgba(16, 185, 129, 0.3);
  --shadow-glow-danger: 0 0 20px rgba(239, 68, 68, 0.3);
  --shadow-glow-warning: 0 0 20px rgba(245, 158, 11, 0.3);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 300ms ease;
  --transition-slow: 500ms ease;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-xs: 0.6875rem;
  --font-sm: 0.8125rem;
  --font-base: 0.9375rem;
  --font-md: 1rem;
  --font-lg: 1.125rem;
  --font-xl: 1.3125rem;
  --font-2xl: 1.625rem;
  --font-3xl: 2rem;

  /* Layout */
  --nav-height: 68px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-height: 60px;
  --content-padding: var(--space-5);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background: var(--gradient-bg);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
}

/* Ambient glow orbs */
body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.15;
}

body::before {
  width: 400px;
  height: 400px;
  background: var(--accent-primary);
  top: -100px;
  right: -100px;
}

body::after {
  width: 350px;
  height: 350px;
  background: var(--accent-secondary);
  bottom: 100px;
  left: -120px;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  outline: none;
  background: none;
}

input, select, textarea {
  font-family: inherit;
  border: none;
  outline: none;
  background: none;
}

ul, ol {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: var(--radius-full);
}

/* ── App Shell ── */
#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 20px);
}

/* ── Header ── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--content-padding);
  height: var(--header-height);
  background: rgba(13, 18, 36, 0.94);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  gap: var(--space-3);
}

.app-brand-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 0;
  font-size: 1.25rem;
  font-weight: 800;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
}

.app-brand-badge,
.app-brand-img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.55), 0 0 12px rgba(0, 240, 255, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
  display: block;
}

.app-brand-name {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: #FFFFFF;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-accent {
  color: #00F0FF !important;
  -webkit-text-fill-color: #00F0FF !important;
  font-weight: 900;
  margin-left: 3px;
  letter-spacing: 0.5px;
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.9), 0 0 24px rgba(52, 211, 153, 0.6);
}

.app-header h1 {
  font-size: var(--font-lg);
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -0.3px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.header-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.header-btn {
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-size: var(--font-sm);
  font-weight: 600;
  white-space: nowrap;
  transition: all var(--transition-base);
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
}

.header-btn:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.header-btn:active {
  transform: scale(0.95);
  background: var(--glass-bg-hover);
}

.header-btn .nav-text {
  font-size: var(--font-xs);
  font-weight: 600;
}

@media (max-width: 580px) {
  .header-actions {
    gap: 6px;
  }

  .header-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
  }

  .header-btn .nav-text {
    display: none;
  }
}

/* Small phones (~320px): five header buttons + the title no longer fit. */
@media (max-width: 400px) {
  :root {
    --content-padding: var(--space-4);
  }

  .header-actions {
    gap: 4px;
  }

  .header-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 4px;
  }
}

/* ── Page Header ── */
.page-header {
  padding: var(--space-5) var(--content-padding) var(--space-3);
}

.page-header h2 {
  font-size: var(--font-2xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-1);
}

.page-header p {
  color: var(--text-secondary);
  font-size: var(--font-sm);
}

.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

#dashStoreBadge {
  padding: 8px 18px;
  font-size: var(--font-md);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 14px rgba(0, 217, 166, 0.2);
  transition: all var(--transition-base);
}

#dashStoreNameText {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* ── View / Page containers ── */
.view {
  display: none;
  animation: fadeSlideUp 0.4s ease forwards;
}

.view.active {
  display: block;
}

.view-content {
  padding: 0 var(--content-padding) var(--space-6);
}

/* ── Glass Card ── */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: all var(--transition-base);
}

.glass-card:active {
  transform: scale(0.98);
}

.glass-card-hoverable:hover,
.glass-card-hoverable:active {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-hover);
}

/* ── KPI Cards ── */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  padding: 0 var(--content-padding);
  margin-bottom: var(--space-6);
}

.kpi-card {
  position: relative;
  overflow: hidden;
  padding: var(--space-5);
  border-radius: var(--radius-xl);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  transition: all var(--transition-base);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.kpi-card.kpi-total::before { background: var(--gradient-primary); }
.kpi-card.kpi-low::before { background: var(--gradient-danger); }
.kpi-card.kpi-value::before { background: var(--gradient-secondary); }
.kpi-card.kpi-categories::before { background: var(--gradient-warning); }

.kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-lg);
  margin-bottom: var(--space-3);
}

.kpi-total .kpi-icon { background: rgba(108, 99, 255, 0.15); color: var(--accent-primary); }
.kpi-low .kpi-icon { background: rgba(239, 68, 68, 0.15); color: var(--status-danger); }
.kpi-value .kpi-icon { background: rgba(0, 217, 166, 0.15); color: var(--accent-secondary); }
.kpi-categories .kpi-icon { background: rgba(245, 158, 11, 0.15); color: var(--status-warning); }

.kpi-value-text {
  font-size: var(--font-2xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-1);
}

.kpi-label {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

/* ── Section Headers ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--content-padding);
}

.section-header h3 {
  font-size: var(--font-md);
  font-weight: 700;
}

.section-header .view-all {
  font-size: var(--font-sm);
  color: var(--accent-primary);
  font-weight: 600;
  transition: opacity var(--transition-fast);
}

.section-header .view-all:active {
  opacity: 0.7;
}

/* ── Chart Container ── */
.chart-container {
  margin: 0 var(--content-padding) var(--space-6);
  padding: var(--space-5);
  border-radius: var(--radius-xl);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
}

.chart-title {
  font-size: var(--font-base);
  font-weight: 700;
  margin-bottom: var(--space-4);
}

.chart-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
}

.chart-canvas-wrap {
  position: relative;
  width: 130px;
  height: 130px;
  flex-shrink: 0;
}

.chart-canvas-wrap canvas {
  width: 100%;
  height: 100%;
}

.chart-center-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.chart-center-label .num {
  font-size: var(--font-xl);
  font-weight: 800;
  display: block;
}

.chart-center-label .sub {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
}

.chart-legend {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
  min-width: 0;
  /* keep each count next to its label instead of stranded at the card edge */
  max-width: 420px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-sm);
  color: var(--text-secondary);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-count {
  font-weight: 600;
  color: var(--text-primary);
}

/* ── Search Bar ── */
.search-bar {
  margin: 0 var(--content-padding) var(--space-4);
  position: relative;
}

.search-bar .search-icon {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: var(--font-base);
  pointer-events: none;
}

.search-bar input {
  width: 100%;
  height: 46px;
  padding: 0 var(--space-4) 0 44px;
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-size: var(--font-base);
  transition: all var(--transition-base);
}

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

.search-bar input:focus {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-glow-primary);
}

/* ── Filter Pills ── */
.filter-pills {
  display: flex;
  gap: var(--space-2);
  padding: 0 var(--content-padding);
  margin-bottom: var(--space-4);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filter-pills::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  flex-shrink: 0;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-size: var(--font-sm);
  font-weight: 500;
  transition: all var(--transition-base);
  white-space: nowrap;
}

.filter-pill.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
  box-shadow: var(--shadow-glow-primary);
}

.filter-pill:active {
  transform: scale(0.95);
}

/* ── Product List ── */
.product-list {
  padding: 0 var(--content-padding);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.product-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  transition: all var(--transition-base);
  cursor: pointer;
  animation: fadeSlideUp 0.4s ease forwards;
  opacity: 0;
}

.product-card:active {
  transform: scale(0.98);
  background: var(--glass-bg-hover);
}

.product-thumb {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
  overflow: hidden;
}

.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.product-name {
  font-size: var(--font-base);
  font-weight: 600;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-meta {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.product-right {
  text-align: right;
  flex-shrink: 0;
}

.product-qty {
  font-size: var(--font-md);
  font-weight: 700;
  margin-bottom: 2px;
}

.stock-badge {
  display: inline-block;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stock-badge.in-stock {
  background: rgba(16, 185, 129, 0.15);
  color: var(--status-success);
}

.stock-badge.low-stock {
  background: rgba(245, 158, 11, 0.15);
  color: var(--status-warning);
}

.stock-badge.out-of-stock {
  background: rgba(239, 68, 68, 0.15);
  color: var(--status-danger);
}

/* ── Activity Feed ── */
.activity-list {
  padding: 0 var(--content-padding);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.activity-item {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  animation: fadeSlideUp 0.4s ease forwards;
  opacity: 0;
}

.activity-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-sm);
  flex-shrink: 0;
}

.activity-icon.add { background: rgba(16, 185, 129, 0.15); color: var(--status-success); }
.activity-icon.remove { background: rgba(239, 68, 68, 0.15); color: var(--status-danger); }
.activity-icon.edit { background: rgba(108, 99, 255, 0.15); color: var(--accent-primary); }
.activity-icon.alert { background: rgba(245, 158, 11, 0.15); color: var(--status-warning); }

.activity-text {
  flex: 1;
  min-width: 0;
}

.activity-text strong {
  font-weight: 600;
}

.activity-text p {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  line-height: 1.4;
}

.activity-text .time {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  margin-top: 2px;
  display: block;
}

/* ── Form ── */
.form-container {
  padding: 0 var(--content-padding);
}

.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  height: 48px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-size: var(--font-base);
  transition: all var(--transition-base);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-tertiary);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394A3B8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

select option,
.form-input option,
.form-select option {
  background: #ffffff;
  color: #0f172a;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
}

[data-theme="dark"] select option,
[data-theme="dark"] .form-input option,
[data-theme="dark"] .form-select option {
  background: #1e293b;
  color: #f8fafc;
}

.form-textarea {
  height: 100px;
  padding: var(--space-3) var(--space-4);
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-3);
}

@media (max-width: 576px) {
  .form-row-3 {
    grid-template-columns: 1fr 1fr;
  }
  .form-row-3 .form-group:nth-child(3) {
    grid-column: span 2;
  }
}

.form-hint {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}

/* Image upload */
.image-upload {
  width: 100%;
  height: 120px;
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  border: 2px dashed var(--glass-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  cursor: pointer;
  transition: all var(--transition-base);
  color: var(--text-tertiary);
  font-size: var(--font-sm);
  position: relative;
  overflow: hidden;
}

.image-upload:active {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.image-upload .upload-icon {
  font-size: 1.5rem;
}

.image-upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.image-upload.has-image {
  border-style: solid;
  border-color: var(--glass-border-hover);
}

.image-upload .preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-size: var(--font-base);
  font-weight: 600;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: var(--shadow-glow-primary);
}

.btn-primary:active {
  box-shadow: 0 0 30px rgba(108, 99, 255, 0.5);
}

.btn-secondary {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--gradient-danger);
  color: #fff;
  box-shadow: var(--shadow-glow-danger);
}

.btn-success {
  background: var(--gradient-secondary);
  color: #fff;
  box-shadow: var(--shadow-glow-success);
}

.btn-block {
  width: 100%;
  height: 50px;
  border-radius: var(--radius-lg);
  font-size: var(--font-md);
}

.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-sm);
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: var(--radius-md);
  font-size: var(--font-lg);
}

/* ── Bottom Navigation ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  height: calc(var(--nav-height) + var(--safe-bottom));
  background: rgba(10, 14, 26, 0.94);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border-top: 1px solid var(--glass-border);
  display: flex;
  align-items: stretch;
  padding: 0 var(--space-1);
  padding-bottom: var(--safe-bottom);
}

/* Equal columns. Sized by content, five labels of different lengths gave
   tap targets from 52px to 78px wide and overflowed the bar below ~340px. */
.nav-item {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 2px;
  border: none;
  background: none;
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  cursor: pointer;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--transition-base);
}

.nav-icon-slot {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  max-width: 100%;
  height: 26px;
  border-radius: var(--radius-full);
  background: transparent;
  transition: background var(--transition-base), transform var(--transition-fast);
}

.nav-item .nav-icon {
  font-size: 1.15rem;
  line-height: 1;
  transition: transform var(--transition-base);
}

.nav-label {
  max-width: 100%;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Active state: a filled pill behind the icon, so the selected tab is
   readable at a glance instead of relying on a 3px sliver at the top. */
.nav-item.active {
  color: var(--accent-primary-light, var(--accent-primary));
}

.nav-item.active .nav-icon-slot {
  background: rgba(108, 99, 255, 0.18);
}

.nav-item.active .nav-icon {
  transform: translateY(-1px) scale(1.06);
}

@media (hover: hover) {
  .nav-item:hover { color: var(--text-secondary); }
  .nav-item:hover .nav-icon-slot { background: rgba(255, 255, 255, 0.06); }
  .nav-item.active:hover { color: var(--accent-primary-light, var(--accent-primary)); }
  .nav-item.active:hover .nav-icon-slot { background: rgba(108, 99, 255, 0.24); }
}

.nav-item:active .nav-icon-slot { transform: scale(0.92); }

.nav-item:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: -3px;
}

/* Alert count, anchored to the icon rather than to the button box —
   the button width changes with the label, the icon does not. */
.nav-badge {
  position: absolute;
  top: -3px;
  left: 50%;
  margin-left: 5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--status-danger);
  border: 2px solid #0a0e1a;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* Billing action button */
.nav-item.nav-add .nav-icon-wrap {
  width: 48px;
  height: 48px;
  /* -20px lifts the circle out of the bar while leaving exactly 26px of
     layout height, so "Bills" stays on the same line as its neighbours. */
  margin-top: -22px;
  border-radius: 50%;
  background: var(--gradient-primary);
  border: 3px solid #0a0e1a;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(108, 99, 255, 0.45);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.nav-item.nav-add:active .nav-icon-wrap {
  transform: scale(0.92);
  box-shadow: 0 3px 10px rgba(108, 99, 255, 0.4);
}

.nav-item.nav-add .nav-icon {
  color: #fff;
  font-size: 1.35rem;
}

.nav-item.nav-add.active { color: var(--accent-primary-light, var(--accent-primary)); }

.nav-item.nav-add.active .nav-icon-wrap {
  box-shadow: 0 6px 22px rgba(108, 99, 255, 0.65);
}

/* Narrow phones: "Dashboard" and "Inventory" still have to fit five across */
@media (max-width: 360px) {
  .nav-label { font-size: 9px; letter-spacing: 0; }
  .nav-icon-slot { width: 38px; }
  .nav-item .nav-icon { font-size: 1.05rem; }
  .nav-item.nav-add .nav-icon-wrap { width: 44px; height: 44px; margin-top: -20px; }
}

@media (prefers-reduced-motion: reduce) {
  .nav-item,
  .nav-icon-slot,
  .nav-item .nav-icon,
  .nav-item.nav-add .nav-icon-wrap { transition: none; }
  .nav-item.active .nav-icon { transform: none; }
}

/* ── Product Detail ── */
.detail-hero {
  margin: 0 var(--content-padding) var(--space-5);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
}

.detail-image {
  width: 100%;
  height: 200px;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  position: relative;
}

.detail-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-back {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: var(--font-lg);
  z-index: 2;
}

.detail-actions-top {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  display: flex;
  gap: var(--space-2);
  z-index: 2;
}

.detail-actions-top button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: var(--font-base);
}

.detail-body {
  padding: var(--space-5);
}

.detail-name {
  font-size: var(--font-xl);
  font-weight: 800;
  margin-bottom: var(--space-1);
}

.detail-sku {
  font-size: var(--font-sm);
  color: var(--text-tertiary);
  margin-bottom: var(--space-4);
}

.detail-stats {
  display: grid;
  /* minmax(0,…) so a long total like ₹21,840.00 shrinks instead of
     blowing the row past the viewport on small phones */
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.detail-stat {
  min-width: 0;
  text-align: center;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
}

.detail-stat .stat-value {
  font-size: var(--font-lg);
  font-weight: 700;
  margin-bottom: 2px;
  overflow-wrap: anywhere;
}

.detail-stat .stat-label {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Stock Adjuster */
.stock-adjuster {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-xl);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
}

.adjuster-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: var(--font-xl);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
}

.adjuster-btn.minus {
  background: rgba(239, 68, 68, 0.15);
  color: var(--status-danger);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.adjuster-btn.plus {
  background: rgba(16, 185, 129, 0.15);
  color: var(--status-success);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.adjuster-btn:active {
  transform: scale(0.9);
}

.adjuster-input {
  width: 80px;
  text-align: center;
  font-size: var(--font-2xl);
  font-weight: 800;
  color: var(--text-primary);
  background: transparent;
}

.adjuster-input::-webkit-inner-spin-button,
.adjuster-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* The quick-adjust row and its save button sit directly in the view with no
   wrapper, so they need the same gutters every other block gets. */
#viewDetail > .form-row,
#viewDetail > .btn-block {
  margin-left: var(--content-padding);
  margin-right: var(--content-padding);
}

#viewDetail > .form-row {
  width: auto;
  align-items: end;
}

/* buttons size to their content, so .btn-block's 100% needs the gutters back out */
#viewDetail > .btn-block {
  width: calc(100% - 2 * var(--content-padding));
}

/* ── Transaction History ── */
.transaction-list {
  padding: 0 var(--content-padding);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.transaction-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
}

.transaction-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-sm);
  flex-shrink: 0;
}

.transaction-icon.in {
  background: rgba(16, 185, 129, 0.15);
  color: var(--status-success);
}

.transaction-icon.out {
  background: rgba(239, 68, 68, 0.15);
  color: var(--status-danger);
}

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

.transaction-info .txn-type {
  font-size: var(--font-sm);
  font-weight: 600;
}

.transaction-info .txn-time {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
}

.transaction-qty {
  font-size: var(--font-base);
  font-weight: 700;
}

.transaction-qty.positive { color: var(--status-success); }
.transaction-qty.negative { color: var(--status-danger); }

/* ── Detail Info List ── */
.detail-info-list {
  padding: 0 var(--content-padding);
  margin-bottom: var(--space-5);
}

.detail-info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--glass-border);
}

.detail-info-item:last-child {
  border-bottom: none;
}

.detail-info-label {
  font-size: var(--font-sm);
  color: var(--text-tertiary);
}

.detail-info-value {
  font-size: var(--font-sm);
  font-weight: 600;
  text-align: right;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Alerts View ── */
.alert-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  transition: all var(--transition-base);
  animation: fadeSlideUp 0.4s ease forwards;
  opacity: 0;
}

.alert-card:active {
  transform: scale(0.98);
}

.alert-card .alert-indicator {
  width: 4px;
  height: 40px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.alert-card .alert-indicator.warning {
  background: var(--gradient-warning);
}

.alert-card .alert-indicator.danger {
  background: var(--gradient-danger);
}

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

.alert-card .alert-product-name {
  font-weight: 600;
  font-size: var(--font-base);
  margin-bottom: 2px;
}

.alert-card .alert-detail {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
}

.alert-card .alert-qty {
  font-size: var(--font-lg);
  font-weight: 800;
  flex-shrink: 0;
}

.alert-card .alert-qty.warning { color: var(--status-warning); }
.alert-card .alert-qty.danger { color: var(--status-danger); }

/* ── Settings ── */
.settings-group {
  padding: 0 var(--content-padding);
  margin-bottom: var(--space-5);
}

.settings-group-title {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  margin-bottom: var(--space-3);
  padding-left: var(--space-1);
}

.settings-card {
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  overflow: hidden;
}

.settings-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: 1px solid var(--glass-border);
  transition: background var(--transition-fast);
  cursor: pointer;
}

.settings-item:last-child {
  border-bottom: none;
}

.settings-item:active {
  background: var(--glass-bg-hover);
}

.settings-item .settings-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-base);
  flex-shrink: 0;
}

.settings-icon.purple { background: rgba(108, 99, 255, 0.15); color: var(--accent-primary); }
.settings-icon.green { background: rgba(16, 185, 129, 0.15); color: var(--status-success); }
.settings-icon.blue { background: rgba(59, 130, 246, 0.15); color: var(--status-info); }
.settings-icon.red { background: rgba(239, 68, 68, 0.15); color: var(--status-danger); }
.settings-icon.amber { background: rgba(245, 158, 11, 0.15); color: var(--status-warning); }

.settings-item .settings-text {
  flex: 1;
  min-width: 0;
}

.settings-item .settings-text .label {
  font-size: var(--font-base);
  font-weight: 500;
}

.settings-item .settings-text .desc {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  margin-top: 1px;
}

.settings-item .settings-chevron {
  color: var(--text-tertiary);
  font-size: var(--font-sm);
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  transition: all var(--transition-base);
  cursor: pointer;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-secondary);
  transition: all var(--transition-base);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
  background: #fff;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

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

.modal-content {
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  background: var(--bg-secondary);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  padding: var(--space-6);
  transform: translateY(100%);
  transition: transform var(--transition-base);
  overflow-y: auto;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-handle {
  width: 36px;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--glass-border);
  margin: 0 auto var(--space-5);
}

.modal-title {
  font-size: var(--font-lg);
  font-weight: 700;
  margin-bottom: var(--space-5);
}

/* ── Toast ── */
.toast-container {
  position: fixed;
  top: var(--space-4);
  left: 50%;
  transform: translateX(-50%);
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
  width: calc(100% - 40px);
  max-width: 400px;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  font-size: var(--font-sm);
  font-weight: 500;
  pointer-events: auto;
  animation: toastIn 0.4s ease forwards;
}

.toast.toast-success { border-left: 3px solid var(--status-success); }
.toast.toast-error { border-left: 3px solid var(--status-danger); }
.toast.toast-warning { border-left: 3px solid var(--status-warning); }
.toast.toast-info { border-left: 3px solid var(--status-info); }

.toast .toast-icon {
  font-size: var(--font-lg);
  flex-shrink: 0;
}

.toast .toast-message {
  flex: 1;
}

.toast.removing {
  animation: toastOut 0.3s ease forwards;
}

/* ── Empty State ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
  text-align: center;
}

.empty-state .empty-icon {
  font-size: 3.5rem;
  margin-bottom: var(--space-4);
  opacity: 0.4;
}

.empty-state h3 {
  font-size: var(--font-lg);
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.empty-state p {
  font-size: var(--font-sm);
  color: var(--text-tertiary);
  margin-bottom: var(--space-5);
  max-width: 260px;
}

/* ── Category badge ── */
.category-badge {
  display: inline-block;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  background: rgba(108, 99, 255, 0.15);
  color: var(--accent-primary-light);
}

/* ── Detail Actions Bar ── */
.detail-actions-bar {
  display: flex;
  gap: var(--space-3);
  padding: 0 var(--content-padding);
  margin-top: var(--space-5);
  margin-bottom: var(--space-6);
}

/* ── App version ── */
.app-version {
  text-align: center;
  padding: var(--space-6) 0;
  font-size: var(--font-xs);
  color: var(--text-tertiary);
}

/* ── Sort dropdown ── */
.sort-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--content-padding);
  margin-bottom: var(--space-3);
}

.sort-row .result-count {
  font-size: var(--font-sm);
  color: var(--text-tertiary);
}

.sort-select {
  height: 34px;
  padding: 0 var(--space-8) 0 var(--space-3);
  border-radius: var(--radius-full);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-size: var(--font-xs);
  font-weight: 500;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%2394A3B8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.sort-select option {
  background: var(--bg-secondary);
}

/* ── Animations ── */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes scaleIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Stagger animations for lists */
.product-card:nth-child(1) { animation-delay: 0.02s; }
.product-card:nth-child(2) { animation-delay: 0.06s; }
.product-card:nth-child(3) { animation-delay: 0.10s; }
.product-card:nth-child(4) { animation-delay: 0.14s; }
.product-card:nth-child(5) { animation-delay: 0.18s; }
.product-card:nth-child(6) { animation-delay: 0.22s; }
.product-card:nth-child(7) { animation-delay: 0.26s; }
.product-card:nth-child(8) { animation-delay: 0.30s; }
.product-card:nth-child(9) { animation-delay: 0.34s; }
.product-card:nth-child(10) { animation-delay: 0.38s; }

.activity-item:nth-child(1) { animation-delay: 0.02s; }
.activity-item:nth-child(2) { animation-delay: 0.06s; }
.activity-item:nth-child(3) { animation-delay: 0.10s; }
.activity-item:nth-child(4) { animation-delay: 0.14s; }
.activity-item:nth-child(5) { animation-delay: 0.18s; }

.alert-card:nth-child(1) { animation-delay: 0.02s; }
.alert-card:nth-child(2) { animation-delay: 0.06s; }
.alert-card:nth-child(3) { animation-delay: 0.10s; }
.alert-card:nth-child(4) { animation-delay: 0.14s; }
.alert-card:nth-child(5) { animation-delay: 0.18s; }

/* ── Responsive ── */
@media (min-width: 480px) {
  :root {
    --content-padding: var(--space-8);
  }
}

@media (min-width: 768px) {
  .kpi-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  :root {
    --content-padding: var(--space-10);
  }
}

/* Above ~1120px the gutters grow instead of the content, so the app keeps a
   readable column width rather than stretching edge to edge. Every layout
   block already uses --content-padding, so this centres the whole app. */
@media (min-width: 1120px) {
  body {
    --content-padding: max(var(--space-10), calc(50% - 520px));
  }

  /* the bar stays full-bleed; its items line up with the content column */
  .bottom-nav {
    padding-inline: max(var(--space-2), calc(50% - 520px));
  }
}

/* ── Barcode Scanner & Expiry Badge Styles ── */
.scan-inline-btn {
  position: absolute;
  right: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--gradient-primary);
  color: #fff;
  font-size: var(--font-xs);
  font-weight: 600;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-glow-primary);
  transition: all var(--transition-fast);
}

.scan-inline-btn:active {
  transform: translateY(-50%) scale(0.94);
}

/* base styles live in the "Scan / Text Action Button" block below */
.btn-text-action:active {
  transform: scale(0.95);
  background: var(--accent-primary);
  color: #fff;
}

/* Expiry Tags */
.expiry-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.expiry-tag.expired {
  background: rgba(239, 68, 68, 0.2);
  color: #FCA5A5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.expiry-tag.expiring-soon {
  background: rgba(245, 158, 11, 0.2);
  color: #FCD34D;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.expiry-tag.fresh {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-secondary);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Scanner Modal */
.scanner-modal-content {
  max-width: 480px;
  padding: var(--space-5);
  background: var(--bg-primary);
}

.scanner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.scanner-reader {
  width: 100%;
  min-height: 260px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--glass-border);
  position: relative;
}

.scanner-footer {
  margin-top: var(--space-4);
  text-align: center;
}

.scanner-status {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
}

/* html5-qrcode UI overrides */
#scannerReader video {
  border-radius: var(--radius-lg);
  object-fit: cover !important;
}

#scannerReader__scan_region {
  background: transparent !important;
}

#scannerReader__dashboard {
  padding: 10px 0 !important;
  background: transparent !important;
  color: var(--text-secondary) !important;
}

#scannerReader__dashboard_section_csr button,
#scannerReader__dashboard_section_swaplink {
  background: var(--glass-bg) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--glass-border) !important;
  border-radius: var(--radius-md) !important;
  padding: 6px 14px !important;
  font-size: var(--font-xs) !important;
  cursor: pointer;
}

/* ── Scan / Text Action Button ── */
.btn-text-action {
  background: none;
  border: 1px solid var(--glass-border);
  color: var(--accent-primary-light);
  font-size: var(--font-xs);
  font-weight: 600;
  font-family: var(--font-family);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-text-action:hover {
  background: rgba(108, 99, 255, 0.12);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* ── Scanner Result Banner ── */
.scanner-result-banner {
  margin-top: var(--space-4);
  background: rgba(0, 217, 166, 0.08);
  border: 1px solid rgba(0, 217, 166, 0.3);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  animation: fadeInUp 0.3s ease;
}

.scan-result-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.scan-result-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  min-width: 0;
}

.scan-result-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.scan-result-label {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.scan-result-date {
  font-size: var(--font-lg);
  font-weight: 700;
  color: var(--accent-secondary);
  letter-spacing: 0.02em;
}

.scan-result-source {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ══════════════════════════════
   BILLING MODULE
══════════════════════════════ */

/* ── Bill Stats ── */
.bill-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  gap: var(--space-3);
}

.bill-stat-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  text-align: center;
}

.bill-stat-card.accent {
  background: rgba(0, 217, 166, 0.07);
  border-color: rgba(0, 217, 166, 0.25);
}

.bill-stat-value {
  font-size: var(--font-xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 2px;
}

.bill-stat-card.accent .bill-stat-value {
  color: var(--accent-secondary);
}

.bill-stat-label {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* ── Bill List Card ── */
.bill-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  animation: fadeSlideUp 0.35s ease forwards;
  opacity: 0;
}

.bill-card:active {
  transform: scale(0.98);
  background: var(--glass-bg-hover);
}

.bill-card-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  min-width: 0;
}

.bill-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(108, 99, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

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

.bill-card-number {
  font-size: var(--font-sm);
  font-weight: 700;
  color: var(--text-primary);
}

.bill-card-customer {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bill-card-time {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  margin-top: 2px;
}

.bill-card-total {
  font-size: var(--font-md);
  font-weight: 800;
  color: var(--accent-secondary);
  flex-shrink: 0;
}

/* ── Bill Builder — Search ── */
.bill-search-wrapper {
  position: relative;
}

.bill-search-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  z-index: 50;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  max-height: 280px;
  overflow-y: auto;
}

.bill-suggestion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--glass-border);
}

.bill-suggestion-item:last-child { border-bottom: none; }

.bill-suggestion-item:hover { background: var(--glass-bg-hover); }

.bill-suggestion-item.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.bill-suggestion-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  min-width: 0;
}

.bill-suggestion-emoji { font-size: 1.25rem; flex-shrink: 0; }

.bill-suggestion-name {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bill-suggestion-meta {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
}

.bill-suggestion-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.bill-suggestion-item.active { background: var(--glass-bg-hover); }

.bill-suggestion-name mark {
  background: transparent;
  color: var(--accent-primary, inherit);
  font-weight: 800;
}

.bill-suggestion-empty {
  padding: var(--space-4);
  text-align: center;
  color: var(--text-tertiary);
  font-size: var(--font-sm);
}

/* ── Bill Item Rows ── */
.bill-items-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.bill-item-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  animation: fadeSlideUp 0.25s ease forwards;
  opacity: 0;
}

.bill-item-info {
  flex: 1;
  min-width: 0;
}

.bill-item-name {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bill-item-price {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
}

.bill-item-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.qty-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--glass-bg-hover);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-size: var(--font-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  line-height: 1;
}

.qty-btn:active { transform: scale(0.88); background: var(--accent-primary); color: #fff; }

.qty-val {
  font-size: var(--font-sm);
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}

.bill-qty-input {
  width: 64px;
  height: 32px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--surface-tertiary, rgba(255, 255, 255, 0.08));
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.15));
  color: var(--text-primary);
  font-size: var(--font-sm);
  font-weight: 700;
  text-align: center;
  outline: none;
  transition: border-color var(--transition-fast);
}

.bill-qty-input:focus {
  border-color: var(--accent-primary, #6C63FF);
}

.bill-unit-select {
  height: 32px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--surface-tertiary, rgba(255, 255, 255, 0.08));
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.15));
  color: var(--accent-primary, #6C63FF);
  font-size: var(--font-xs);
  font-weight: 700;
  outline: none;
  cursor: pointer;
}

.bill-unit-label {
  font-size: var(--font-xs);
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0 var(--space-1);
}

.subtotal-equiv {
  font-size: 10px;
  font-weight: normal;
  color: var(--text-tertiary);
}

.bill-item-subtotal {
  font-size: var(--font-sm);
  font-weight: 700;
  color: var(--accent-secondary);
  flex-shrink: 0;
  min-width: 60px;
  text-align: right;
}

.bill-item-remove {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--status-danger);
  font-size: var(--font-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.bill-item-remove:active { background: var(--status-danger); color: #fff; }

/* ── Bill Summary Box ── */
.bill-summary-box {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.bill-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) 0;
  font-size: var(--font-sm);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--glass-border);
}

.bill-summary-row:last-child { border-bottom: none; }

.bill-total-row {
  font-size: var(--font-md);
  font-weight: 800;
  color: var(--text-primary);
  padding-top: var(--space-3);
}

.bill-total-row span:last-child {
  color: var(--accent-secondary);
}

.bill-discount-input {
  width: 70px;
  height: 32px;
  padding: 0 var(--space-2);
  text-align: right;
  border-radius: var(--radius-sm);
  background: var(--glass-bg-hover);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-size: var(--font-sm);
  font-weight: 600;
  font-family: inherit;
}

.bill-discount-input:focus {
  border-color: var(--accent-primary);
  outline: none;
}

/* ── Receipt Card ── */
.receipt-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  /* a receipt reads better narrow than stretched across a desktop window */
  max-width: 560px;
  margin: 0 auto var(--space-4);
}

.receipt-header {
  background: var(--gradient-primary);
  padding: var(--space-6) var(--space-5);
  text-align: center;
}

.receipt-logo {
  font-size: var(--font-xl);
  font-weight: 800;
  color: #fff;
  margin-bottom: var(--space-1);
}

.receipt-tagline {
  font-size: var(--font-xs);
  letter-spacing: 0.15em;
  color: rgba(255,255,255,0.75);
  font-weight: 600;
  text-transform: uppercase;
}

.receipt-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  padding: var(--space-5);
}

.receipt-meta-label {
  display: block;
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.receipt-meta-val {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.receipt-divider {
  height: 1px;
  background: var(--glass-border);
  margin: 0 var(--space-4);
}

.receipt-items {
  padding: var(--space-4) var(--space-5);
}

.receipt-item-header {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: var(--space-3);
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: var(--space-3);
}

.receipt-item-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: var(--space-3);
  font-size: var(--font-sm);
  padding: var(--space-2) 0;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.receipt-item-row:last-child { border-bottom: none; }

.receipt-item-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.receipt-totals {
  padding: var(--space-4) var(--space-5);
}

.receipt-total-row {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-sm);
  color: var(--text-secondary);
  padding: var(--space-2) 0;
}

.receipt-total-row.discount-row { color: var(--status-success); }

.receipt-total-row.grand-total-row {
  font-size: var(--font-lg);
  font-weight: 800;
  color: var(--text-primary);
  border-top: 2px solid var(--glass-border);
  padding-top: var(--space-3);
  margin-top: var(--space-2);
}

.receipt-total-row.grand-total-row span:last-child {
  color: var(--accent-secondary);
}

.receipt-footer {
  text-align: center;
  padding: var(--space-5);
  font-size: var(--font-sm);
  color: var(--text-tertiary);
  border-top: 1px solid var(--glass-border);
}

/* ── Empty State Button ── */
.empty-state .btn {
  margin-top: var(--space-4);
}

/* ── Print Styles ── */
@media print {
  .app-header, .bottom-nav, #btnDeleteBill,
  #btnPrintBill, #btnCloseBillDetail, .toast-container { display: none !important; }

  body { background: #fff !important; color: #000 !important; }

  .receipt-card {
    background: #fff !important;
    border: 1px solid #ddd !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }

  .receipt-header { background: #1a1a2e !important; -webkit-print-color-adjust: exact; }
  .receipt-logo, .receipt-tagline { color: #fff !important; -webkit-print-color-adjust: exact; }
}

/* ══════════════════════════════
   VOICE INVENTORY ASSISTANT
══════════════════════════════ */
.voice-mic-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-4) 0;
}

.voice-mic-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 2px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  position: relative;
}

.voice-mic-btn.is-listening {
  background: var(--gradient-primary);
  border-color: var(--accent-primary);
  box-shadow: 0 0 35px rgba(108, 99, 255, 0.6);
  animation: micPulse 1.4s infinite ease-in-out;
}

@keyframes micPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(108, 99, 255, 0.7); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 18px rgba(108, 99, 255, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(108, 99, 255, 0); }
}

.voice-status-label {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  margin-top: var(--space-3);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.voice-transcript-box {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  min-height: 64px;
  max-height: 100px;
  overflow-y: auto;
  font-size: var(--font-sm);
  color: var(--text-primary);
  line-height: 1.45;
  margin-bottom: var(--space-4);
}

.transcript-placeholder {
  color: var(--text-tertiary);
  font-style: italic;
}

.voice-fields-card {
  background: rgba(0, 217, 166, 0.06);
  border: 1px solid rgba(0, 217, 166, 0.25);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  animation: fadeInUp 0.3s ease;
}

.voice-fields-title {
  font-size: var(--font-xs);
  font-weight: 700;
  color: var(--accent-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-3);
}

.voice-fields-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.voice-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  font-size: var(--font-xs);
  font-weight: 600;
}

.voice-chip span.label { color: var(--text-tertiary); }
.voice-chip span.val { color: var(--text-primary); }

.voice-examples {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  line-height: 1.5;
}

/* ══════════════════════════════
   LOGIN VIEW & PROFILE MODAL
══════════════════════════════ */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px);
  padding: var(--space-4);
}

.login-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  padding: var(--space-6) var(--space-5);
  width: 100%;
  max-width: 420px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  animation: fadeSlideUp 0.4s ease forwards;
}

.login-brand {
  text-align: center;
  margin-bottom: var(--space-6);
}

.login-logo,
.login-logo-img {
  width: 80px;
  height: 80px;
  border-radius: 22px;
  object-fit: cover;
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.6), 0 0 25px rgba(0, 240, 255, 0.4);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  margin-bottom: var(--space-3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: inline-block;
}

.login-logo:hover,
.login-logo-img:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 14px 35px rgba(99, 102, 241, 0.8), 0 0 30px rgba(0, 240, 255, 0.6);
}

.login-brand h1 {
  font-size: 1.95rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: #FFFFFF;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7), 0 0 24px rgba(99, 102, 241, 0.6);
  margin-bottom: 4px;
}

.login-brand p {
  font-size: var(--font-xs);
  color: #CBD5E1;
  font-weight: 500;
}

.profile-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  margin-top: var(--space-3);
}

.profile-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.profile-user-info {
  flex: 1;
  min-width: 0;
}

.profile-name {
  font-size: var(--font-md);
  font-weight: 700;
  color: var(--text-primary);
}

.profile-email {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

/* ── AUTHENTICATION & VERIFICATION VIEW STYLES ── */
.verify-card {
  /* sizing/padding live in the VERIFY PAGE block further down */
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-2xl);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.pulse-icon {
  animation: pulseGlow 2.5s infinite ease-in-out;
}

@keyframes pulseGlow {
  0% { transform: scale(1); filter: drop-shadow(0 0 6px rgba(108, 99, 255, 0.5)); }
  50% { transform: scale(1.1); filter: drop-shadow(0 0 20px rgba(168, 85, 247, 0.8)); }
  100% { transform: scale(1); filter: drop-shadow(0 0 6px rgba(108, 99, 255, 0.5)); }
}

.verification-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  padding: var(--space-3) var(--space-5);
  margin-bottom: var(--space-5);
  gap: var(--space-3);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3);
}

.verify-step-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-xs);
  font-weight: 600;
  transition: all var(--transition-base);
}

.verify-step-indicator .step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-tertiary);
  transition: all var(--transition-base);
}

.verify-step-indicator.verified .step-num {
  background: linear-gradient(135deg, var(--status-success), #059669);
  color: #fff;
  border-color: var(--status-success);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
}

.verify-step-divider {
  flex: 1;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  min-width: 20px;
}

.step-status-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-weight: 700;
  letter-spacing: 0.3px;
}

.step-status-badge.pending {
  background: rgba(245, 158, 11, 0.15);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.step-status-badge.verified {
  background: rgba(16, 185, 129, 0.15);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

/* Dispatched OTP Banner Alert inside Step Cards */
.dispatched-otp-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  background: rgba(108, 99, 255, 0.12);
  border: 1px dashed rgba(108, 99, 255, 0.4);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  margin-top: var(--space-2);
  margin-bottom: var(--space-3);
}

.dispatched-otp-banner.phone-banner {
  background: rgba(0, 217, 166, 0.1);
  border-color: rgba(0, 217, 166, 0.35);
}

.banner-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.banner-icon {
  font-size: 1.3rem;
}

.banner-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.banner-sub {
  font-size: 11px;
  color: var(--text-secondary);
}

.banner-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.banner-otp-code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 3px;
  color: #818CF8;
  background: rgba(0, 0, 0, 0.35);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(129, 140, 248, 0.3);
}

.banner-otp-code.phone-code {
  color: #34D399;
  border-color: rgba(52, 211, 153, 0.3);
}

.btn-autofill {
  font-size: 11px;
  font-weight: 800;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent-primary), #A855F7);
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(108, 99, 255, 0.3);
  transition: all var(--transition-fast);
  cursor: pointer;
  white-space: nowrap;
}

.btn-autofill:hover {
  transform: translateY(-1px) scale(1.05);
  box-shadow: 0 6px 16px rgba(108, 99, 255, 0.45);
}

.btn-autofill.phone-autofill {
  background: linear-gradient(135deg, var(--accent-secondary), #059669);
  box-shadow: 0 4px 12px rgba(0, 217, 166, 0.3);
}

.btn-autofill.phone-autofill:hover {
  box-shadow: 0 6px 16px rgba(0, 217, 166, 0.45);
}

.email-inbox-icon {
  font-size: 1.4rem;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: rgba(168, 85, 247, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.email-inbox-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.email-inbox-text strong {
  font-size: var(--font-xs);
  color: var(--text-primary);
}

.email-inbox-text span {
  font-size: 11px;
  color: var(--text-secondary);
}

.btn-inbox-link {
  font-size: 11px;
  font-weight: 700;
  color: #818CF8;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
}

.btn-inbox-link:hover {
  background: rgba(99, 102, 241, 0.3);
  color: #A5B4FC;
  transform: scale(1.05);
}

.verify-demo-notice {
  background: rgba(99, 102, 241, 0.08);
  border: 1px dashed rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  font-size: var(--font-xs);
}

.demo-notice-header {
  color: var(--accent-primary-light);
  margin-bottom: var(--space-1);
}

.demo-notice-body {
  display: flex;
  gap: var(--space-4);
  color: var(--text-secondary);
}

.otp-code-highlight {
  font-family: monospace;
  font-size: var(--font-sm);
  letter-spacing: 2px;
  color: var(--accent-secondary);
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(0, 217, 166, 0.2);
}

.verification-section {
  background: rgba(17, 24, 39, 0.85);
  border: 1.5px solid rgba(129, 140, 248, 0.35);
  border-radius: var(--radius-xl);
  padding: 24px;
  margin-bottom: var(--space-5);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
}

.verify-step-indicator.active .step-num {
  background: var(--gradient-primary);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-glow-primary);
}

.verify-step-indicator.active {
  color: var(--text-primary);
}

.verify-step-indicator.active .step-label {
  color: var(--text-primary);
}

.verification-section#sectionEmailVerify {
  margin-bottom: 0;
}

.verification-section#sectionEmailVerify .section-sub strong {
  color: var(--accent-secondary-light);
  font-weight: 600;
  overflow-wrap: anywhere;
  word-break: normal;
}

.verification-section::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  border-radius: var(--radius-xl) 0 0 var(--radius-xl);
  background: linear-gradient(180deg, #6366f1, #a855f7);
}

.verification-section.verified-section {
  border-color: rgba(16, 185, 129, 0.6);
  background: rgba(16, 185, 129, 0.08);
}

.verification-section.verified-section::before {
  background: #22c55e;
}

/* Scoped to the verification card so it does not override the global
   .section-header used on dashboard / inventory / reports pages. */
.verification-section .section-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-3);
  padding: 0;
  margin-bottom: var(--space-4);
}

.section-icon {
  font-size: 1.6rem;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(108, 99, 255, 0.15);
  border: 1px solid rgba(108, 99, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.section-icon.phone-icon {
  background: rgba(0, 217, 166, 0.15);
  border-color: rgba(0, 217, 166, 0.3);
}

.verification-section .section-header h3 {
  font-size: var(--font-sm);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.section-sub {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  margin-top: 3px;
}

.otp-input-group {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: var(--space-5) 0;
  flex-wrap: nowrap;
  width: 100%;
}

.otp-box {
  flex: 1;
  max-width: 58px;
  height: 64px;
  font-size: 2rem;
  font-weight: 900;
  font-family: 'Inter', system-ui, monospace;
  text-align: center;
  border-radius: 14px;
  background: #ffffff;
  color: #0f172a;
  border: 3px solid #6366f1;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(99, 102, 241, 0.3);
}

.otp-box:hover {
  border-color: #818cf8;
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(99, 102, 241, 0.45);
}

/* Email OTP Box Specific High-Contrast Colors */
.email-otp-box {
  background: #ffffff;
  border-color: #6366f1;
  color: #0f172a;
}

.email-otp-box:focus {
  outline: none;
  background: #ffffff;
  border-color: #9333ea;
  color: #4f46e5;
  box-shadow: 0 0 0 4px rgba(147, 51, 234, 0.35), 0 8px 25px rgba(99, 102, 241, 0.5);
  transform: translateY(-4px) scale(1.08);
}

.email-otp-box.filled {
  background: #f0fdf4;
  border-color: #22c55e;
  color: #15803d;
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.35);
}

/* Mobile OTP Box Specific High-Contrast Colors */
.phone-otp-box {
  background: #ffffff;
  border-color: #0d9488;
  color: #042f2e;
}

.phone-otp-box:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--status-success);
  color: #059669;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.35), 0 8px 25px rgba(13, 148, 136, 0.5);
  transform: translateY(-4px) scale(1.08);
}

.phone-otp-box.filled {
  background: #ecfdf5;
  border-color: var(--status-success);
  color: #047857;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.35);
}

.verify-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.verification-success-card {
  text-align: center;
  padding: var(--space-7) var(--space-5);
  background: rgba(16, 185, 129, 0.12);
  border: 1.5px solid rgba(16, 185, 129, 0.4);
  border-radius: var(--radius-xl);
  animation: fadeSlideUp 0.5s ease;
  box-shadow: var(--shadow-glow-success);
}

.verification-success-card .success-icon {
  font-size: 3.5rem;
  margin-bottom: var(--space-3);
}

.verification-success-card h2 {
  font-size: var(--font-xl);
  font-weight: 800;
  color: #34D399;
  margin-bottom: var(--space-2);
}

.verification-success-card p {
  font-size: var(--font-sm);
  color: var(--text-secondary);
}

/* ── VIRTUAL EMAIL INBOX MODAL STYLES ── */
.email-modal-content {
  background: #0f172a !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

.email-message-card {
  background: #1e293b;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.email-meta-header {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.email-sender-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-primary), #A855F7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.email-meta-info {
  flex: 1;
}

.email-meta-subject {
  font-size: 14px;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 4px;
}

.email-meta-from {
  font-size: 12px;
  color: var(--text-secondary);
}

.email-meta-to {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.email-body-preview {
  padding: 16px;
  max-height: 340px;
  overflow-y: auto;
}

/* ═══════════════════════════════════════════════════════════════
   SECURITY AUTHENTICATION PAGE
   ═══════════════════════════════════════════════════════════════ */

#viewVerify {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
}

#viewVerify.active {
  display: block !important;
}

/* The auth screens own the whole viewport — no app chrome behind them. */
body:has(#viewVerify.active) .bottom-nav,
body:has(#viewVerify.active) .app-header,
body:has(#viewLogin.active) .bottom-nav,
body:has(#viewSignup.active) .bottom-nav {
  display: none !important;
}

.verify-page {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background: var(--gradient-bg);
}

.verify-bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  opacity: 0.55;
}

.verify-bg-glow--1 {
  width: 420px;
  height: 420px;
  top: -120px;
  left: -100px;
  background: rgba(108, 99, 255, 0.35);
  animation: verifyFloat 8s ease-in-out infinite;
}

.verify-bg-glow--2 {
  width: 360px;
  height: 360px;
  bottom: -80px;
  right: -60px;
  background: rgba(0, 217, 166, 0.22);
  animation: verifyFloat 10s ease-in-out infinite reverse;
}

@keyframes verifyFloat {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(24px, 18px); }
}

.verify-container {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--space-6) var(--space-4);
}

.verify-card {
  max-width: 480px;
  padding: var(--space-8) var(--space-6);
  animation: fadeSlideUp 0.5s ease forwards;
}

.verify-brand {
  margin-bottom: var(--space-5);
}

.verify-brand h1 {
  font-size: var(--font-2xl);
}

.verify-brand p {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  max-width: 320px;
  margin: 0 auto;
  line-height: 1.5;
}

.verify-progress {
  margin-bottom: var(--space-5);
}

.verify-progress .verify-step-indicator {
  flex: 1;
}

.verify-otp-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#sectionEmailVerify .dispatched-otp-banner {
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: var(--space-4);
}

#sectionEmailVerify .banner-left {
  flex: 1 1 200px;
  min-width: 0;
}

#sectionEmailVerify .banner-right {
  margin-left: auto;
  flex-shrink: 0;
}

#sectionEmailVerify .otp-input-group {
  margin: var(--space-4) 0 var(--space-5);
}

.verify-resend {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1);
}

.verify-resend-text {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  white-space: nowrap;
}

.verify-footer {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--glass-border);
  text-align: center;
}

.verify-back-link {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.verify-back-link:hover {
  color: var(--accent-secondary);
}

.verify-success-loader {
  width: 36px;
  height: 36px;
  margin: var(--space-4) auto 0;
  border: 3px solid rgba(16, 185, 129, 0.2);
  border-top-color: var(--status-success);
  border-radius: 50%;
  animation: verifySpin 0.8s linear infinite;
}

@keyframes verifySpin {
  to { transform: rotate(360deg); }
}

@media (max-width: 480px) {
  .verify-card {
    padding: var(--space-6) var(--space-4);
  }

  .verification-section {
    padding: 18px 14px;
  }

  #sectionEmailVerify .dispatched-otp-banner {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
  }

  /* reset the row-direction flex sizing so the banner does not stretch tall */
  #sectionEmailVerify .banner-left {
    flex: 0 0 auto;
  }

  #sectionEmailVerify .banner-right {
    flex: 0 0 auto;
    margin-left: 0;
    justify-content: flex-end;
  }

  .verify-action-row {
    flex-direction: column;
    align-items: stretch;
  }

  .verify-resend {
    align-items: center;
  }

  .otp-box {
    max-width: 48px;
    height: 56px;
    font-size: 1.5rem;
  }

  .otp-input-group {
    gap: 6px;
  }
}


/* ══════════════════════════════════════════════════════
   REPORTS PAGE
   Everything here is scoped to #viewReports (or to .rpt-*
   classes that only the Reports view uses), so no other
   screen in the app is affected.
   ══════════════════════════════════════════════════════ */

#viewReports {
  /* Local surface scale — solid, not translucent. Large scrolling
     surfaces with backdrop-filter cause paint smearing and cost a lot
     on mid-range phones, which is what this screen runs on. */
  --rpt-surface: #131a2b;
  --rpt-surface-2: #1a2236;
  --rpt-line: rgba(255, 255, 255, 0.07);
  --rpt-line-strong: rgba(255, 255, 255, 0.12);
  --rpt-gap: var(--space-4);
  --rpt-radius: 16px;
  --rpt-toolbar-h: 56px;
  padding-bottom: var(--space-10);
}

#viewReports .page-header {
  padding-bottom: var(--space-3);
}

/* ══ Timeframe toolbar ══════════════════════════════════ */

.rpt-toolbar {
  position: sticky;
  top: var(--header-height);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--content-padding);
  margin-bottom: var(--space-5);
  background: rgba(12, 17, 30, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rpt-line);
}

/* Segmented control rather than loose pills — one visual object,
   so the selected range reads as a state and not as a stray button. */
.rpt-toolbar .filter-pills {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  margin: 0;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--rpt-line);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.rpt-toolbar .filter-pills::-webkit-scrollbar { display: none; }

.rpt-toolbar .filter-pill {
  flex: 0 0 auto;
  padding: 7px 16px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-tertiary);
  font-size: var(--font-xs);
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.rpt-toolbar .filter-pill:hover { color: var(--text-secondary); }

.rpt-toolbar .filter-pill.active {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 2px 10px rgba(108, 99, 255, 0.35);
}

.rpt-range-label {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-xs);
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.rpt-range-label::before {
  content: '📅';
  font-size: 11px;
  opacity: 0.8;
}

.rpt-range-label:empty { display: none; }

@media (max-width: 640px) {
  .rpt-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
    padding: var(--space-3) var(--content-padding);
  }

  .rpt-toolbar .filter-pills { width: 100%; }
  .rpt-toolbar .filter-pill { flex: 1 1 0; text-align: center; padding: 7px 8px; }

  /* The range label stays — knowing which dates the numbers cover
     matters more on a small screen, not less. */
  .rpt-range-label {
    justify-content: flex-start;
    font-size: 11px;
  }
}

/* ══ KPI grid ═══════════════════════════════════════════ */

.rpt-kpi-grid {
  display: grid;
  /* Two columns even on the narrowest phone: eight single-file cards
     buried every chart below a screen and a half of scrolling. */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  padding: 0 var(--content-padding);
  margin-bottom: var(--space-6);
}

@media (min-width: 900px) {
  .rpt-kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--rpt-gap);
  }
}

.rpt-kpi-grid .kpi-card {
  --kpi-accent: var(--accent-primary);
  --kpi-accent-soft: rgba(108, 99, 255, 0.14);
  position: relative;
  /* Grid, so the label can sit beside the icon while the value spans
     the full width — without depending on source order. */
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "icon  label"
    "value value";
  grid-template-rows: auto minmax(0, 1fr);
  align-items: center;
  column-gap: var(--space-2);
  row-gap: var(--space-3);
  min-height: 0;
  padding: var(--space-4);
  overflow: hidden;
  border-radius: var(--rpt-radius);
  background: var(--rpt-surface);
  border: 1px solid var(--rpt-line);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: border-color var(--transition-base), transform var(--transition-base);
}

/* Accent is a hairline down the leading edge, not a bar across the top:
   it survives the card getting shorter and reads as a category marker. */
.rpt-kpi-grid .kpi-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  height: auto;
  border-radius: 0;
  background: var(--kpi-accent);
}

.rpt-kpi-grid .kpi-card::after { content: none; }

@media (hover: hover) {
  .rpt-kpi-grid .kpi-card:hover {
    transform: translateY(-2px);
    border-color: var(--rpt-line-strong);
  }
}

/* Label first, value second: the label is how you find the card,
   the value is what you read once you have. */
.rpt-kpi-grid .kpi-icon {
  grid-area: icon;
  width: 30px;
  height: 30px;
  margin: 0;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  line-height: 1;
  background: var(--kpi-accent-soft);
  border: none;
}

.rpt-kpi-grid .kpi-label {
  grid-area: label;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.25;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
}

.rpt-kpi-grid .kpi-value-text {
  grid-area: value;
  align-self: end;
  margin: 0;
  font-size: clamp(1.05rem, 4.2vw, 1.35rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

@media (min-width: 900px) {
  .rpt-kpi-grid .kpi-card { padding: var(--space-5); }
  .rpt-kpi-grid .kpi-value-text { font-size: var(--font-2xl); }
}

/* Every card gets its own accent — previously four of the eight fell
   back to the generic purple, which made the grid look half-finished. */
.rpt-kpi-grid .kpi-total          { --kpi-accent: #6C63FF; --kpi-accent-soft: rgba(108, 99, 255, 0.16); }
.rpt-kpi-grid .kpi-profit         { --kpi-accent: #10B981; --kpi-accent-soft: rgba(16, 185, 129, 0.16); }
.rpt-kpi-grid .kpi-value          { --kpi-accent: #06B6D4; --kpi-accent-soft: rgba(6, 182, 212, 0.16); }
.rpt-kpi-grid .kpi-categories     { --kpi-accent: #F59E0B; --kpi-accent-soft: rgba(245, 158, 11, 0.16); }
.rpt-kpi-grid .kpi-units          { --kpi-accent: #8B5CF6; --kpi-accent-soft: rgba(139, 92, 246, 0.16); }
.rpt-kpi-grid .kpi-orders         { --kpi-accent: #3B82F6; --kpi-accent-soft: rgba(59, 130, 246, 0.16); }
.rpt-kpi-grid .kpi-wholesaler-dues { --kpi-accent: #F43F5E; --kpi-accent-soft: rgba(244, 63, 94, 0.16); }
.rpt-kpi-grid .kpi-customer-udhar  { --kpi-accent: #EF4444; --kpi-accent-soft: rgba(239, 68, 68, 0.16); }

.rpt-kpi-grid .kpi-profit .kpi-value-text { color: #34D399; }
.rpt-kpi-grid .kpi-wholesaler-dues .kpi-value-text { color: #FB7185; }
.rpt-kpi-grid .kpi-customer-udhar .kpi-value-text { color: #F87171; }

/* ══ Chart cards ════════════════════════════════════════ */

.rpt-chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--rpt-gap);
  padding: 0 var(--content-padding);
  margin-bottom: var(--space-6);
}

@media (min-width: 900px) {
  .rpt-chart-grid {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    align-items: stretch;
  }
}

.rpt-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: var(--space-5);
  border-radius: var(--rpt-radius);
  background: var(--rpt-surface);
  border: 1px solid var(--rpt-line);
}

.rpt-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.rpt-card-headings { min-width: 0; flex: 1 1 180px; }

.rpt-card-title {
  font-size: var(--font-base);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.rpt-card-sub {
  margin-top: 3px;
  font-size: var(--font-xs);
  line-height: 1.35;
  color: var(--text-tertiary);
}

.rpt-card-right-group {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.rpt-chart-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--rpt-line);
}

.rpt-toggle-btn {
  min-width: 34px;
  padding: 5px 9px;
  border-radius: var(--radius-full);
  font-size: var(--font-xs);
  line-height: 1;
  font-weight: 600;
  color: var(--text-tertiary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.rpt-toggle-btn:hover { color: var(--text-primary); }

.rpt-toggle-btn.active {
  background: var(--accent-primary);
  color: #fff;
}

.rpt-card-stat {
  flex-shrink: 0;
  text-align: right;
  line-height: 1.2;
}

.rpt-card-stat-num {
  display: block;
  font-size: var(--font-md);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--accent-secondary);
}

.rpt-card-stat-label {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-tertiary);
  font-weight: 600;
}

/* ── Trend chart ── */
.rpt-canvas-wrap {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 200px;
  height: 240px;
  /* The card stretches to match the donut card; the plot should not
     stretch with it past the point where bars stop reading as bars. */
  max-height: 340px;
  /* When the card stretches to match its neighbour, the spare height
     splits above and below the plot instead of pooling underneath. */
  margin-block: auto;
  touch-action: pan-y;
}

@media (max-width: 640px) { .rpt-canvas-wrap { height: 200px; } }
@media (min-width: 900px) { .rpt-canvas-wrap { height: 280px; } }

.rpt-canvas-wrap canvas,
#salesTrendChart,
#categoryRevenueChart {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: pan-y;
}

.rpt-tooltip {
  position: absolute;
  z-index: 5;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: #0d1424;
  border: 1px solid var(--rpt-line-strong);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  font-size: var(--font-xs);
  line-height: 1.35;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -100%);
  transition: opacity var(--transition-fast);
}

.rpt-tooltip.is-visible { opacity: 1; }

.rpt-tooltip .rpt-tt-day { color: var(--text-tertiary); font-weight: 600; }

.rpt-tooltip .rpt-tt-val {
  display: block;
  margin-top: 2px;
  color: #00D9A6;
  font-weight: 800;
  font-size: var(--font-sm);
}

/* ── Donut ── */
.rpt-donut-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-5);
}

@media (min-width: 560px) and (max-width: 899px) {
  .rpt-donut-body {
    flex-direction: row;
    align-items: center;
    gap: var(--space-6);
  }
  .rpt-legend { flex: 1; min-width: 0; }
}

.rpt-donut-wrap {
  position: relative;
  width: 176px;
  height: 176px;
  flex-shrink: 0;
}

.rpt-donut-wrap canvas { display: block; width: 100%; height: 100%; }

.rpt-donut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.rpt-donut-num {
  font-size: var(--font-md);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.rpt-donut-label {
  margin-top: 3px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-tertiary);
  font-weight: 700;
}

.rpt-legend {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.rpt-legend-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px var(--space-3);
  align-items: center;
}

.rpt-legend-name {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  font-size: var(--font-sm);
  color: var(--text-secondary);
}

.rpt-legend-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rpt-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex-shrink: 0;
}

.rpt-legend-val {
  font-size: var(--font-sm);
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rpt-legend-val em {
  font-style: normal;
  font-weight: 600;
  color: var(--text-tertiary);
  font-size: var(--font-xs);
  margin-left: 6px;
}

.rpt-legend-bar {
  grid-column: 1 / -1;
  height: 4px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.rpt-legend-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width var(--transition-slow);
}

/* ══ Report sections ════════════════════════════════════
   One wrapper per report block so the heading, its controls
   and its table share a single inset and a single rhythm.
   ══════════════════════════════════════════════════════ */

.rpt-section {
  padding: 0 var(--content-padding);
  margin-bottom: var(--space-6);
}

.rpt-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: 0 0 var(--space-3);
  margin: 0;
}

/* Legacy wrapper kept working: it dissolves so its children become
   the flex items of the section head. */
.rpt-head-row { display: contents; }

.rpt-section-head h3 {
  font-size: var(--font-md);
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
}

.rpt-section-note {
  display: block;
  margin-top: 2px;
  font-size: var(--font-xs);
  line-height: 1.35;
  color: var(--text-tertiary);
  font-weight: 600;
}

.rpt-section-titles { min-width: 0; flex: 1 1 220px; }

.rpt-table-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* Filter pills inside a section head match the toolbar's segmented look */
.rpt-section-head .filter-pills {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  margin: 0;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--rpt-line);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.rpt-section-head .filter-pills::-webkit-scrollbar { display: none; }

.rpt-section-head .filter-pill {
  flex: 0 0 auto;
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-tertiary);
  font-size: var(--font-xs);
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.rpt-section-head .filter-pill:hover { color: var(--text-secondary); }

.rpt-section-head .filter-pill.active {
  background: var(--accent-primary);
  color: #fff;
}

.rpt-search-box {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 180px;
  min-width: 0;
}

.rpt-search-icon {
  position: absolute;
  left: 11px;
  font-size: 12px;
  line-height: 1;
  color: var(--text-tertiary);
  pointer-events: none;
}

.rpt-search-input {
  width: 100%;
  height: 34px;
  padding: 0 12px 0 31px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--rpt-line);
  color: var(--text-primary);
  font-size: var(--font-xs);
  outline: none;
  transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

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

/* No width jump on focus — a control that resizes under the cursor
   shoves the neighbouring select sideways mid-interaction. */
.rpt-search-input:focus {
  border-color: var(--accent-primary);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.2);
}

.rpt-select-filter {
  height: 34px;
  padding: 0 30px 0 12px;
  border-radius: var(--radius-full);
  background-color: var(--rpt-surface-2);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%2394a3b8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  border: 1px solid var(--rpt-line);
  color: var(--text-secondary);
  font-size: var(--font-xs);
  font-weight: 600;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color var(--transition-fast);
}

.rpt-select-filter:focus { border-color: var(--accent-primary); }

@media (max-width: 720px) {
  .rpt-section-head {
    align-items: stretch;
    gap: var(--space-3);
  }
  .rpt-table-controls { width: 100%; }
  .rpt-select-filter { flex: 1 1 130px; }
}

/* ══ Report table ═══════════════════════════════════════
   One table component shared by all three report blocks.
   Alignment is per-column and explicit; nothing is blanket
   right-aligned, so text columns read left as text should.
   ══════════════════════════════════════════════════════ */

.rpt-table-scroll {
  width: 100%;
  border-radius: var(--rpt-radius);
  background: var(--rpt-surface);
  border: 1px solid var(--rpt-line);
  overflow: hidden;
}

/* The horizontal scroller lives inside the card, so the card's own
   rounded edge and border stay put while the columns slide. */
.rpt-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.rpt-table-wrap::-webkit-scrollbar { height: 8px; }
.rpt-table-wrap::-webkit-scrollbar-track { background: transparent; }
.rpt-table-wrap::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-full);
}

.rpt-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: var(--font-sm);
  background: transparent;
  border: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.rpt-table th,
.rpt-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--rpt-line);
}

.rpt-table tbody tr:last-child td { border-bottom: none; }

.rpt-table thead th {
  /* Not sticky: the wrapper scrolls horizontally, which makes it the
     sticky scrollport, and a header pinned to a box that never scrolls
     vertically either does nothing or floats into the rows. */
  position: static;
  background: var(--rpt-surface-2);
  border-bottom: 1px solid var(--rpt-line-strong);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* Column alignment helpers */
.rpt-table .ta-right,
.rpt-table td.rpt-num,
.rpt-table th.rpt-num { text-align: right; }

.rpt-table .ta-center { text-align: center; }

/* The sort button fills its cell by bleeding out over the cell padding,
   so the whole header cell is the hit target without needing :has(). */
.rpt-sort-btn {
  width: calc(100% + var(--space-4) * 2);
  margin: calc(var(--space-3) * -1) calc(var(--space-4) * -1);
  padding: var(--space-3) var(--space-4);
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.rpt-table th.ta-right .rpt-sort-btn,
.rpt-table th.rpt-num .rpt-sort-btn { justify-content: flex-end; }

.rpt-sort-btn:hover { color: var(--text-secondary); }

.rpt-sort-btn[aria-sort]:not([aria-sort="none"]) { color: var(--accent-primary-light); }

.rpt-sort-arrow {
  font-size: 8px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.rpt-sort-btn[aria-sort]:not([aria-sort="none"]) .rpt-sort-arrow { opacity: 1; }

.rpt-table tbody tr { transition: background var(--transition-fast); }

@media (hover: hover) {
  .rpt-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
}

/* ── Entity cell (product / wholeseller / customer) ── */
.rpt-prod-cell {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.rpt-prod-emoji,
.rpt-prod-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--rpt-line);
  font-size: 1rem;
  line-height: 1;
}

.rpt-prod-titles,
.rpt-prod-cell > span:last-child {
  display: block;
  min-width: 0;
}

.rpt-prod-name,
.rpt-prod-titles > strong {
  display: block;
  font-size: var(--font-sm);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

.rpt-prod-cat {
  display: block;
  margin-top: 2px;
  font-size: var(--font-xs);
  line-height: 1.3;
  color: var(--text-tertiary);
}

/* ── Numeric cells ── */
.rpt-num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rpt-num-muted { color: var(--text-tertiary); }
.rpt-num-sold { color: var(--text-primary); font-weight: 600; }
.rpt-num-rev { color: var(--status-success); font-weight: 700; }
.rpt-num-due { color: #F87171; font-weight: 700; }

.rpt-sub { display: block; margin-top: 2px; font-size: var(--font-xs); color: var(--text-tertiary); }

.rpt-invest-cell {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  min-width: 96px;
}

.rpt-invest-val { font-weight: 700; color: var(--text-primary); }

.rpt-invest-bar {
  width: 100%;
  height: 4px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.rpt-invest-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--gradient-primary);
}

/* ── Row actions ── */
.rpt-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.rpt-actions .btn,
.rpt-actions .btn-whatsapp-sm,
.rpt-actions .btn-settle-sm {
  white-space: nowrap;
}

/* Empty states sit inside the table card, so they need their own padding */
.rpt-table-scroll .empty-state {
  padding: var(--space-8) var(--space-5) !important;
  text-align: center;
}

.rpt-table-scroll .empty-state .empty-icon {
  font-size: 2rem;
  margin-bottom: var(--space-2);
}

/* ══ Card mode on narrow screens ════════════════════════
   Below 760px the tables stop being tables. A 620px-wide grid
   inside a 390px phone hides every number that matters behind a
   horizontal scroll nobody discovers; one card per row does not.
   ══════════════════════════════════════════════════════ */

@media (max-width: 760px) {
  .rpt-table-scroll {
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
  }

  .rpt-table-wrap { overflow: visible; }

  .rpt-table {
    display: block;
    min-width: 0;
    width: 100%;
    font-size: var(--font-sm);
  }

  .rpt-table thead { display: none; }

  .rpt-table tbody { display: flex; flex-direction: column; gap: var(--space-3); }

  .rpt-table tbody tr {
    display: block;
    padding: var(--space-4);
    border-radius: var(--rpt-radius);
    background: var(--rpt-surface);
    border: 1px solid var(--rpt-line);
  }

  .rpt-table tbody tr:hover { background: var(--rpt-surface); }

  .rpt-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 2px var(--space-3);
    padding: 7px 0;
    text-align: right;
    border-bottom: 1px dashed var(--rpt-line);
  }

  /* A secondary line belongs under its value, not beside the label. */
  .rpt-table td > .rpt-sub { flex: 1 0 100%; text-align: right; }

  .rpt-table td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    text-align: left;
  }

  /* The first cell is the row's identity — it gets the full width,
     no label, and a heavier rule under it. */
  .rpt-table td.rpt-cell-primary,
  .rpt-table tbody tr > td:first-child {
    display: block;
    padding: 0 0 var(--space-3);
    margin-bottom: var(--space-1);
    text-align: left;
    border-bottom: 1px solid var(--rpt-line);
  }

  .rpt-table tbody tr > td:first-child::before { content: none; }

  .rpt-table td:last-child { border-bottom: none; padding-bottom: 0; }

  .rpt-table td.rpt-col-action {
    display: block;
    padding-top: var(--space-3);
    text-align: left;
  }

  .rpt-table td.rpt-col-action::before { content: none; }

  .rpt-actions {
    display: flex;
    width: 100%;
    gap: var(--space-2);
  }

  .rpt-actions > * {
    flex: 1 1 0;
    justify-content: center;
    text-align: center;
    margin: 0 !important;
  }

  .rpt-invest-cell { min-width: 120px; }

  .rpt-table-scroll .empty-state {
    background: var(--rpt-surface);
    border: 1px solid var(--rpt-line);
    border-radius: var(--rpt-radius);
  }
}

@media (max-width: 400px) {
  .rpt-kpi-grid { gap: var(--space-2); }
  .rpt-kpi-grid .kpi-card { padding: var(--space-3); row-gap: var(--space-2); }
  .rpt-kpi-grid .kpi-icon { width: 26px; height: 26px; font-size: 0.85rem; }
  .rpt-kpi-grid .kpi-label { font-size: 9px; letter-spacing: 0.04em; }
}

/* ══ Print ══════════════════════════════════════════════ */

@media print {
  body { background: #fff !important; color: #000 !important; }
  body::before, body::after { display: none !important; }

  .app-header,
  .bottom-nav,
  #viewReports .rpt-toolbar .filter-pills,
  #viewReports .rpt-tooltip,
  #viewReports .rpt-table-controls,
  #viewReports .rpt-section-head .filter-pills,
  #viewReports .rpt-chart-toggle,
  #viewReports .rpt-col-action,
  #viewReports .header-actions { display: none !important; }

  /* Only print the Reports view, and only when it is the open one —
     forcing it visible from another screen printed the wrong page. */
  #viewReports.active { display: block !important; padding: 0 !important; }

  #viewReports .rpt-toolbar {
    position: static;
    background: none !important;
    border-bottom: 1px solid #cbd5e1 !important;
    padding-left: 0;
    padding-right: 0;
  }

  .rpt-range-label { color: #334155 !important; }

  .rpt-kpi-grid,
  .rpt-chart-grid,
  .rpt-section { padding-left: 0 !important; padding-right: 0 !important; }

  .rpt-kpi-grid { grid-template-columns: repeat(4, 1fr) !important; gap: 8px !important; }
  .rpt-chart-grid { grid-template-columns: 1fr 1fr !important; }

  .rpt-card,
  .rpt-table-scroll,
  #viewReports .kpi-card {
    background: #fff !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: none !important;
    color: #000 !important;
    break-inside: avoid;
  }

  #viewReports .kpi-card::before { background: #94a3b8 !important; }

  .rpt-table { min-width: 0 !important; }
  .rpt-table thead th { background: #f1f5f9 !important; color: #1e293b !important; border-color: #cbd5e1 !important; }
  .rpt-table th, .rpt-table td { border-color: #e2e8f0 !important; }
  .rpt-table tbody tr { break-inside: avoid; }

  .kpi-value-text,
  .rpt-card-title,
  .rpt-prod-name,
  .rpt-donut-num,
  .rpt-section-head h3,
  .rpt-prod-titles > strong,
  .rpt-legend-val,
  .rpt-invest-val,
  .rpt-num-sold,
  strong { color: #000 !important; }

  .rpt-legend-val em,
  .rpt-num-muted,
  .rpt-sub { color: #64748b !important; }

  .rpt-legend-bar,
  .rpt-invest-bar { background: #e2e8f0 !important; }

  .rpt-card-sub,
  .rpt-section-note,
  .rpt-prod-cat,
  .kpi-label,
  .rpt-legend-name { color: #475569 !important; }

  .rpt-prod-emoji,
  .rpt-prod-icon { background: #f1f5f9 !important; border-color: #e2e8f0 !important; }
}

/* ══════════════════════════════════════════════════════
   ADD / EDIT PRODUCT FORM
   Scoped to #viewAddProduct so other forms keep their look.
   ══════════════════════════════════════════════════════ */

#viewAddProduct .form-container {
  padding-bottom: var(--space-4);
}

/* ── Grouped field cards ── */
.fcard {
  position: relative;
  margin-bottom: var(--space-4);
  border-radius: var(--radius-xl);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  overflow: hidden;
  transition: border-color var(--transition-base);
}

.fcard:focus-within {
  border-color: rgba(108, 99, 255, 0.45);
}

.fcard-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.02);
}

.fcard-step {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(108, 99, 255, 0.16);
  color: var(--accent-primary-light);
  font-size: var(--font-xs);
  font-weight: 800;
}

.fcard:focus-within .fcard-step {
  background: var(--gradient-primary);
  color: #fff;
}

.fcard-headings { min-width: 0; }

.fcard-title {
  font-size: var(--font-base);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.fcard-sub {
  margin-top: 1px;
  font-size: var(--font-xs);
  color: var(--text-tertiary);
}

.fcard-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  padding: var(--space-5);
}

.fcard-body-3 { grid-template-columns: 1fr 1fr 1fr; }

.fcard-body .form-group { margin-bottom: 0; }

.fspan-2 { grid-column: span 2; }
.fspan-all { grid-column: 1 / -1; }

@media (max-width: 560px) {
  .fcard-body,
  .fcard-body-3 { grid-template-columns: 1fr 1fr; gap: var(--space-3); }

  .fcard-body-3 .form-group:nth-child(3) { grid-column: span 2; }

  /* labels with an inline action button need the full width on a phone */
  .fcard-body-stack > .form-group { grid-column: span 2; }

  .fcard-head { padding: var(--space-3) var(--space-4); }

  .fcard-body { padding: var(--space-4); }
}

/* Keep the form to a comfortable reading width on large screens instead of
   stretching inputs across the whole page. */
@media (min-width: 768px) {
  #viewAddProduct .fcard,
  #viewAddProduct .form-actionbar {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
  }

  /* keep the heading on the same left edge as the cards */
  #viewAddProduct .page-header {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 0;
    padding-right: 0;
  }
}

/* ── Labels ── */
#viewAddProduct .form-label {
  font-size: var(--font-xs);
  letter-spacing: 0.06em;
}

.flabel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.flabel-row .form-label { margin-bottom: 0; }

.flabel-note {
  font-weight: 500;
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  text-transform: none;
  letter-spacing: 0;
}

.freq {
  color: var(--accent-primary-light);
  font-weight: 700;
}

/* ── Master Catalog Autocomplete ── */
.master-catalog-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 9999px;
  transition: all 0.2s ease;
}

.master-catalog-badge:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.45);
}

.autocomplete-container {
  position: relative;
}

.autocomplete-input-wrap {
  position: relative;
  width: 100%;
}

.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 340px;
  overflow-y: auto;
  overflow-x: hidden;
  background: #151c2e;
  background: linear-gradient(180deg, #182238 0%, #111827 100%);
  border: 1px solid rgba(108, 99, 255, 0.35);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.08);
  z-index: 1050;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: autocompleteFadeIn 0.15s ease-out;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

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

.autocomplete-dropdown::-webkit-scrollbar {
  width: 6px;
}
.autocomplete-dropdown::-webkit-scrollbar-track {
  background: transparent;
}
.autocomplete-dropdown::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.autocomplete-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.1s ease;
  user-select: none;
  border: 1px solid transparent;
}

.autocomplete-item:hover,
.autocomplete-item.is-selected {
  background: rgba(108, 99, 255, 0.15);
  border-color: rgba(108, 99, 255, 0.3);
}

.autocomplete-item-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.autocomplete-item-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary, #f8fafc);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.autocomplete-highlight {
  color: #38bdf8;
  font-weight: 800;
  background: rgba(56, 189, 248, 0.18);
  padding: 0 2px;
  border-radius: 3px;
}

.autocomplete-item-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.72rem;
}

.autocomplete-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary, #94a3b8);
}

.autocomplete-tag-company {
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.12);
}

.autocomplete-tag-cat {
  color: #34d399;
  background: rgba(52, 211, 153, 0.12);
}

.autocomplete-tag-sku {
  font-family: monospace;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
}

.autocomplete-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  margin-left: 12px;
  flex-shrink: 0;
}

.autocomplete-item-price {
  font-size: 0.95rem;
  font-weight: 700;
  color: #10b981;
}

.autocomplete-item-stock {
  font-size: 0.72rem;
  color: var(--text-tertiary, #64748b);
}

.autocomplete-empty,
.autocomplete-header {
  padding: 10px 12px;
  font-size: 0.8rem;
  color: var(--text-tertiary, #64748b);
}

.autocomplete-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 4px;
  padding-bottom: 6px;
  font-weight: 600;
  color: var(--text-secondary, #94a3b8);
}

/* ── Inputs ── */
#viewAddProduct .form-input,
#viewAddProduct .form-select,
#viewAddProduct .form-textarea {
  background: rgba(255, 255, 255, 0.03);
}

#viewAddProduct .form-input:hover:not(:focus),
#viewAddProduct .form-select:hover:not(:focus),
#viewAddProduct .form-textarea:hover:not(:focus) {
  border-color: var(--glass-border-hover);
}

/* only flags a field once the user has actually interacted with it */
#viewAddProduct .form-input:user-invalid {
  border-color: rgba(239, 68, 68, 0.7);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

/* the spinner arrows fight with the ₹ / % affixes — hide them */
#viewAddProduct input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

#viewAddProduct input[type="number"]::-webkit-outer-spin-button,
#viewAddProduct input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#viewAddProduct input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  cursor: pointer;
}

/* ── ₹ prefix / % suffix ── */
.input-affix {
  position: relative;
  display: block;
}

.input-prefix,
.input-suffix {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--font-base);
  font-weight: 600;
  color: var(--text-tertiary);
  pointer-events: none;
}

.input-prefix { left: var(--space-4); }
.input-suffix { right: var(--space-4); }

.form-input.has-prefix { padding-left: 34px; }
.form-input.has-suffix { padding-right: 34px; }

.input-affix:focus-within .input-prefix,
.input-affix:focus-within .input-suffix { color: var(--text-secondary); }

/* ── Selling price readout ── */
.price-result {
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: rgba(108, 99, 255, 0.07);
  border: 1px solid rgba(108, 99, 255, 0.22);
}

.price-result-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.price-result-label {
  font-size: var(--font-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.price-result-label em {
  display: block;
  margin-top: 2px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent-primary-light);
}

.price-result-main .input-affix {
  width: 170px;
  flex-shrink: 0;
}

#viewAddProduct .price-result-input {
  background: rgba(10, 14, 26, 0.55);
  border-color: rgba(108, 99, 255, 0.3);
  color: var(--accent-primary-light);
  font-size: var(--font-lg);
  font-weight: 800;
  cursor: not-allowed;
}

.price-result-main .input-prefix {
  color: var(--accent-primary-light);
  font-weight: 800;
}

.price-result-note {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid rgba(108, 99, 255, 0.16);
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  line-height: 1.5;
}

.price-result-note strong {
  color: var(--status-success);
  font-weight: 700;
}

@media (max-width: 480px) {
  .price-result-main .input-affix { width: 100%; }
}

/* ── Expiry callout when the category is perishable ── */
#expiryGroup {
  border-radius: var(--radius-lg);
  transition: background var(--transition-base), box-shadow var(--transition-base), padding var(--transition-base);
}

#expiryGroup.is-perishable {
  padding: var(--space-4);
  background: rgba(0, 217, 166, 0.07);
  box-shadow: inset 3px 0 0 var(--accent-secondary);
}

#expiryGroup.is-perishable .flabel-note {
  color: var(--accent-secondary);
  font-weight: 700;
}

/* ── Sticky save bar ── */
.form-actionbar {
  position: sticky;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + var(--space-3));
  z-index: 30;
  display: flex;
  gap: var(--space-3);
  margin: var(--space-5) var(--content-padding) var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-xl);
  background: rgba(13, 18, 32, 0.94);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg);
}

.form-actionbar .btn {
  height: 48px;
  margin: 0;
}

.form-actionbar #btnCancelFormBottom { flex: 1; }

.form-actionbar #btnSubmitProduct { flex: 2.2; }

@media (min-width: 700px) {
  .form-actionbar { justify-content: flex-end; }

  .form-actionbar .btn { flex: none !important; min-width: 140px; }

  .form-actionbar #btnSubmitProduct { min-width: 200px; }
}

/* ── Payment Status Badges ── */
.pay-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: var(--font-xs);
  font-weight: 700;
  letter-spacing: 0.2px;
}

.pay-badge-paid {
  background: rgba(16, 185, 129, 0.15);
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.pay-badge-pending {
  background: rgba(245, 158, 11, 0.15);
  color: #F59E0B;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.pay-badge-partial {
  background: rgba(59, 130, 246, 0.15);
  color: #3B82F6;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.pay-badge-credit {
  background: rgba(168, 85, 247, 0.15);
  color: #A855F7;
  border: 1px solid rgba(168, 85, 247, 0.3);
}


/* ══════════════════════════════════════════════════
   SIGNUP WIZARD  (3-step account creation)
   ══════════════════════════════════════════════════ */

.signup-card {
  max-width: 480px;
}

/* ── Step indicator ── */
.wizard-steps {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  list-style: none;
  margin: 0 0 var(--space-3);
  padding: 0;
  gap: var(--space-2);
}

.wizard-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  opacity: 0.45;
  transition: opacity var(--transition-base);
}

.wizard-step.is-active,
.wizard-step.is-done {
  opacity: 1;
}

.wizard-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: var(--font-xs);
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  transition: all var(--transition-base);
}

.wizard-step.is-active .wizard-dot {
  background: var(--gradient-primary);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 0 0 4px rgba(108, 99, 255, 0.18);
}

.wizard-step.is-done .wizard-dot {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.5);
  color: #34D399;
}

.wizard-step.is-done .wizard-dot {
  font-size: 0;            /* hides the bare "1"/"2" text node */
}

.wizard-step.is-done .wizard-dot::after {
  content: '✓';
  font-size: var(--font-sm);
  line-height: 1;
}

.wizard-caption {
  margin: var(--space-3) 0 var(--space-5);
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.wizard-caption strong {
  color: var(--text-primary);
  font-weight: 700;
}

/* ── Progress bar ── */
.wizard-track {
  height: 4px;
  border-radius: 999px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  overflow: hidden;
}

.wizard-track-fill {
  height: 100%;
  width: 33.33%;
  border-radius: 999px;
  background: var(--gradient-primary);
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Panels ── */
.wizard-panel {
  display: none;
}

.wizard-panel.is-active {
  display: block;
  animation: wizardIn 0.28s ease forwards;
}

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

.wizard-panel.is-active.is-back {
  animation-name: wizardInBack;
}

@keyframes wizardInBack {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Nav buttons ── */
.wizard-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

/* .btn-block is width:100% — inside the flex row it must share instead */
.wizard-nav .btn-block {
  width: auto;
  flex: 1 1 auto;
}

.wizard-nav .btn {
  height: 48px;
  font-size: var(--font-sm);
}

.wizard-nav #btnSignupBack {
  flex: 0 0 auto;
  min-width: 96px;
}

/* ── Segmented store-mode picker ── */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.segmented-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-base);
}

.segmented-option:hover {
  border-color: rgba(108, 99, 255, 0.45);
}

.segmented-option.is-active {
  border-color: var(--accent-primary);
  background: rgba(108, 99, 255, 0.12);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

.segmented-icon {
  font-size: 1.15rem;
  line-height: 1;
  margin-bottom: 2px;
}

.segmented-title {
  font-size: var(--font-sm);
  font-weight: 700;
  color: var(--text-primary);
}

.segmented-sub {
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-tertiary);
}

/* ── Field helpers ── */
.form-label .req {
  color: #F472B6;
  font-weight: 700;
  margin-left: 2px;
}

.form-hint {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-tertiary);
}

.form-note {
  margin-top: var(--space-4);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: rgba(108, 99, 255, 0.10);
  border: 1px solid rgba(108, 99, 255, 0.25);
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.field-error {
  display: none;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #FB7185;
}

.field-error.is-visible {
  display: block;
}

.form-input.is-invalid {
  border-color: rgba(251, 113, 133, 0.7);
  box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.12);
}

/* ── Password field affix + strength ── */
.input-affix {
  position: relative;
}

.input-affix .form-input {
  padding-right: 46px;
}

.input-affix-btn {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  opacity: 0.65;
  font-size: 0.95rem;
  transition: opacity var(--transition-base);
}

.input-affix-btn:hover {
  opacity: 1;
}

.pw-meter {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-top: 8px;
}

.pw-meter span {
  height: 4px;
  border-radius: 999px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  transition: background 0.25s ease, border-color 0.25s ease;
}

.pw-meter[data-score="1"] span:nth-child(-n+1),
.pw-meter[data-score="2"] span:nth-child(-n+2),
.pw-meter[data-score="3"] span:nth-child(-n+3),
.pw-meter[data-score="4"] span:nth-child(-n+4) {
  border-color: transparent;
}

.pw-meter[data-score="1"] span:nth-child(-n+1) { background: #FB7185; }
.pw-meter[data-score="2"] span:nth-child(-n+2) { background: #FBBF24; }
.pw-meter[data-score="3"] span:nth-child(-n+3) { background: #34D399; }
.pw-meter[data-score="4"] span:nth-child(-n+4) { background: #10B981; }

/* ── Review summary on final step ── */
.signup-review {
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
}

.signup-review-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 5px 0;
  font-size: 11px;
}

.signup-review-row dt {
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  flex: 0 0 auto;
}

.signup-review-row dd {
  margin: 0;
  color: var(--text-primary);
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}

/* ── Footer link ── */
.login-alt {
  margin-top: var(--space-4);
  text-align: center;
}

.login-alt p {
  font-size: var(--font-xs);
  color: var(--text-secondary);
}

.login-alt a {
  color: var(--accent-secondary);
  font-weight: 700;
  text-decoration: none;
}

.login-alt a:hover {
  text-decoration: underline;
}

/* ── Small screens ── */
@media (max-width: 420px) {
  .segmented-option {
    align-items: center;
    text-align: center;
    padding: var(--space-3) var(--space-2);
  }

  .segmented-sub {
    display: none;
  }

  .wizard-nav #btnSignupBack {
    min-width: 84px;
  }
}

/* ── Respect reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .wizard-panel.is-active,
  .wizard-panel.is-active.is-back {
    animation: none;
  }
  .wizard-track-fill {
    transition: none;
  }
}

/* ── Collapsible optional block ── */
.optional-block {
  margin-bottom: var(--space-5);
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  overflow: hidden;
}

.optional-block > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 13px var(--space-4);
  cursor: pointer;
  list-style: none;
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-secondary);
  transition: color var(--transition-base);
}

.optional-block > summary::-webkit-details-marker { display: none; }

.optional-block > summary:hover { color: var(--text-primary); }

.optional-block > summary::after {
  content: '⌄';
  margin-left: auto;
  font-size: 1rem;
  line-height: 1;
  color: var(--text-tertiary);
  transition: transform var(--transition-base);
}

.optional-block[open] > summary::after { transform: rotate(180deg); }

.optional-block[open] > summary {
  border-bottom: 1px solid var(--glass-border);
  color: var(--text-primary);
}

.optional-tag {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  background: rgba(148, 163, 184, 0.12);
}

.optional-body { padding: var(--space-4); }

/* ── PAYMENT SUBSCRIPTIONS STYLES ── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
}

.status-pill.status-paid {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-pill.status-pending {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-pill.status-overdue {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-pill.status-inactive {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.payment-sub-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* ==========================================================================
   ELEVATED DESIGN SYSTEM OVERRIDES & COMPONENTS
   ========================================================================== */

/* ── Dashboard Quick Actions ── */
.dash-quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  padding: 0 var(--content-padding);
  margin-bottom: var(--space-6);
}

@media (max-width: 580px) {
  .dash-quick-actions {
    grid-template-columns: 1fr;
  }
}

.dash-action-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-weight: 600;
  font-size: var(--font-sm);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.dash-action-card.primary {
  background: linear-gradient(135deg, rgba(108, 99, 255, 0.25), rgba(168, 85, 247, 0.25));
  border-color: rgba(168, 85, 247, 0.4);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(108, 99, 255, 0.2);
}

.dash-action-card:hover {
  transform: translateY(-3px);
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-hover);
  box-shadow: var(--shadow-md);
}

.dash-action-card.primary:hover {
  background: linear-gradient(135deg, rgba(108, 99, 255, 0.35), rgba(168, 85, 247, 0.35));
  border-color: rgba(168, 85, 247, 0.6);
  box-shadow: 0 6px 20px rgba(108, 99, 255, 0.35);
}

.dash-action-card .action-icon {
  font-size: 1.2rem;
}

/* ── Trial Counter Banner ── */
.trial-counter-banner {
  margin: 0 var(--content-padding) var(--space-6) var(--content-padding);
}

.trial-banner-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(168, 85, 247, 0.12));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: var(--radius-xl);
  padding: var(--space-4) var(--space-5);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.1);
}

.trial-banner-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.trial-banner-icon {
  font-size: 1.5rem;
  background: rgba(168, 85, 247, 0.15);
  padding: 8px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(168, 85, 247, 0.25);
}

.trial-banner-title {
  font-weight: 700;
  font-size: var(--font-md);
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.trial-banner-sub {
  font-size: var(--font-xs);
  color: var(--text-secondary);
}

.trial-banner-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.trial-countdown-pill {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  font-weight: 700;
  font-size: var(--font-xs);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(165, 180, 252, 0.3);
  letter-spacing: 0.02em;
}

.trial-banner-btn {
  height: 36px;
  font-size: var(--font-xs);
  padding: 0 var(--space-4);
  border-radius: var(--radius-md);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(108, 99, 255, 0.3);
}

/* ── KPI Grid & Metric Cards Polish ── */
.kpi-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary);
  opacity: 0.8;
}

.kpi-card.kpi-total::before { background: linear-gradient(90deg, #6C63FF, #8B5CF6); }
.kpi-card.kpi-low::before { background: linear-gradient(90deg, #F59E0B, #EF4444); }
.kpi-card.kpi-value::before { background: linear-gradient(90deg, #10B981, #06B6D4); }
.kpi-card.kpi-categories::before { background: linear-gradient(90deg, #EC4899, #8B5CF6); }

.kpi-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: var(--shadow-lg);
}

.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: var(--space-3);
}

.kpi-value-text {
  font-size: var(--font-2xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.2;
}

.kpi-label {
  font-size: var(--font-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ── Modal Overlay & Dialog Polish ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 8, 16, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: var(--space-4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: #111827;
  background: linear-gradient(165deg, #161f33 0%, #0d1322 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-2xl);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(108, 99, 255, 0.15);
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  padding: var(--space-6);
  transform: translateY(20px) scale(0.97);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
}

.profile-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.profile-user-info {
  flex: 1;
  min-width: 0;
}

.profile-name {
  font-size: var(--font-lg);
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-email {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}

.detail-info-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: var(--font-sm);
}

.detail-info-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.detail-info-value {
  color: var(--text-primary);
  font-weight: 600;
  max-width: 60%;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Centered Desktop Layout & Bottom Nav ── */
@media (min-width: 1024px) {
  .bottom-nav {
    max-width: 760px;
    left: 50%;
    transform: translateX(-50%);
    /* Overrides the full-bleed gutter set at >=1120px. That padding is
       measured against the viewport, so on a dock this narrow it pushed
       all five items into the right-hand third of the bar. */
    padding-inline: var(--space-3);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    border-left: 1px solid var(--glass-border);
    border-right: 1px solid var(--glass-border);
    box-shadow: 0 -10px 34px rgba(0, 0, 0, 0.4);
  }

  .nav-item { border-radius: var(--radius-lg); }
}

/* ── Subscribe / Payment QR Modal Styles ── */
.subscribe-modal-card {
  max-width: 480px;
  text-align: center;
}

.subscribe-plan-badge-wrap {
  margin-bottom: var(--space-4);
  display: flex;
  justify-content: center;
}

.subscribe-plan-pill {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(168, 85, 247, 0.25));
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: #c084fc;
  font-weight: 700;
  font-size: var(--font-xs);
  padding: 6px 16px;
  border-radius: var(--radius-full);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.qr-code-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.qr-img-wrap {
  width: 220px;
  height: 220px;
  border-radius: var(--radius-lg);
  background: rgba(15, 23, 42, 0.8);
  border: 2px solid rgba(168, 85, 247, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), 0 0 20px rgba(108, 99, 255, 0.15);
  margin-bottom: var(--space-3);
}

.qr-code-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qr-placeholder-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
  text-align: center;
}

.qr-placeholder-icon {
  font-size: 2.5rem;
  margin-bottom: 6px;
}

.qr-placeholder-title {
  font-weight: 700;
  font-size: var(--font-sm);
  color: var(--text-primary);
  margin-bottom: 4px;
}

.qr-placeholder-sub {
  font-size: var(--font-xs);
  color: var(--text-secondary);
}

.qr-placeholder-sub code {
  color: var(--accent-primary-light);
  background: rgba(108, 99, 255, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
}

.qr-instruction-text {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  font-weight: 500;
}

.subscribe-notice-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(16, 185, 129, 0.12));
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
  text-align: left;
}

.notice-card-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.notice-card-text {
  font-size: var(--font-sm);
  color: var(--text-primary);
  line-height: 1.5;
  font-weight: 500;
}

/* ── Billing Tabs & Udhar Ledger Styles ── */
.billing-tab-btn {
  flex: 1;
  padding: 10px 14px;
  font-size: var(--font-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color, #e0e0e0);
  background: var(--bg-card, #ffffff);
  color: var(--text-secondary, #666);
  cursor: pointer;
  transition: all 0.2s ease;
}

.billing-tab-btn.is-active {
  background: var(--accent-primary, #6C63FF);
  color: #ffffff;
  border-color: var(--accent-primary, #6C63FF);
  box-shadow: 0 2px 8px rgba(108, 99, 255, 0.25);
}

/* Payment Status Badges */
.payment-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.payment-badge.paid {
  background: rgba(16, 185, 129, 0.15);
  color: #10B981;
}

.payment-badge.credit {
  background: rgba(239, 68, 68, 0.15);
  color: #EF4444;
}

.payment-badge.partial {
  background: rgba(245, 158, 11, 0.15);
  color: #F59E0B;
}

/* Udhar Ledger Card */
.udhar-card {
  background: var(--glass-bg, rgba(255, 255, 255, 0.9));
  border: 1px solid var(--glass-border, #e5e7eb);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.udhar-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}

.udhar-customer-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.udhar-due-tag {
  font-size: 1.1rem;
  font-weight: 800;
  color: #EF4444;
}

.udhar-card-actions {
  display: flex;
  gap: 8px;
  margin-top: var(--space-3);
}

.btn-whatsapp-sm {
  background: #25D366;
  color: #ffffff;
  border: none;
  font-size: var(--font-xs);
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

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

.btn-settle-sm {
  background: var(--accent-primary, #6C63FF);
  color: #ffffff;
  border: none;
  font-size: var(--font-xs);
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

/* ══════ GST & TAX STYLES ══════ */
.gst-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(168, 85, 247, 0.12);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.hsn-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary, #94a3b8);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-family: monospace;
}

.receipt-tax-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 0.75rem;
}

.receipt-tax-table th {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted, #94a3b8);
  font-weight: 600;
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
}

.receipt-tax-table td {
  padding: 6px 8px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
  color: var(--text-primary, #f8fafc);
}

/* ── Offline Banner (PWA / Mobile) ── */
.network-offline-banner {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

/* =========================================================
   ADD PRODUCT VIEW — LUXURY & MODERN REDESIGN
   ========================================================= */

/* Header back button */
.header-left-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.header-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: var(--font-xs);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-back-btn:hover {
  background: rgba(108, 99, 255, 0.15);
  color: #fff;
  border-color: rgba(108, 99, 255, 0.4);
  transform: translateX(-2px);
}

.header-back-btn .back-arrow {
  font-size: 14px;
  transition: transform 0.2s ease;
}

.header-back-btn:hover .back-arrow {
  transform: translateX(-2px);
}

/* ── Modern Hero Banner ── */
.add-product-hero {
  max-width: 760px;
  margin: var(--space-3) auto var(--space-5) auto;
  padding: var(--space-5) var(--space-6);
  background: linear-gradient(135deg, rgba(30, 27, 75, 0.7) 0%, rgba(15, 23, 42, 0.85) 100%);
  border: 1px solid rgba(108, 99, 255, 0.25);
  border-radius: 20px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 16px 36px -12px rgba(108, 99, 255, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.add-product-hero::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(108, 99, 255, 0.25) 0%, transparent 70%);
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(108, 99, 255, 0.18);
  border: 1px solid rgba(108, 99, 255, 0.35);
  border-radius: 999px;
  color: #c7d2fe;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.hero-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
  animation: pulseDot 2s infinite;
}

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

.hero-title {
  font-size: clamp(20px, 3.2vw, 26px);
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 6px 0;
  background: linear-gradient(135deg, #ffffff 40%, #c7d2fe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 13px;
  color: var(--text-secondary, #94a3b8);
  line-height: 1.5;
  margin: 0 0 16px 0;
  max-width: 580px;
}

/* Quick Entry Method Strip */
.quick-entry-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-entry-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.quick-entry-pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.quick-entry-pill .pill-icon {
  font-size: 14px;
}

.quick-entry-pill.master-pill:hover {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fef08a;
}

.quick-entry-pill.barcode-pill:hover {
  background: rgba(6, 182, 212, 0.18);
  border-color: rgba(6, 182, 212, 0.5);
  color: #a5f3fc;
}

.quick-entry-pill.voice-pill:hover {
  background: rgba(139, 92, 246, 0.18);
  border-color: rgba(139, 92, 246, 0.5);
  color: #ddd6fe;
}

.quick-entry-pill.ocr-pill:hover {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.5);
  color: #a7f3d0;
}

/* ── Themed Step Cards ── */
.fcard {
  position: relative;
  background: rgba(15, 23, 42, 0.72) !important;
  border: 1px solid rgba(255, 255, 255, 0.09) !important;
  border-radius: 18px !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.fcard::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--card-accent, #6C63FF);
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.fcard:focus-within {
  border-color: var(--card-accent, #6C63FF) !important;
  box-shadow: 0 16px 36px -8px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--card-accent, #6C63FF), 0 0 24px -6px var(--card-accent-glow, rgba(108, 99, 255, 0.3)) !important;
  transform: translateY(-2px);
}

.fcard:focus-within::before {
  opacity: 1;
  height: 3px;
}

/* Theme individual cards */
.fcard-identity { --card-accent: #6C63FF; --card-accent-glow: rgba(108, 99, 255, 0.4); }
.fcard-stock { --card-accent: #06B6D4; --card-accent-glow: rgba(6, 182, 212, 0.4); }
.fcard-pricing { --card-accent: #10B981; --card-accent-glow: rgba(16, 185, 129, 0.4); }
.fcard-vendor { --card-accent: #F59E0B; --card-accent-glow: rgba(245, 158, 11, 0.4); }
.fcard-freshness { --card-accent: #EC4899; --card-accent-glow: rgba(236, 72, 153, 0.4); }

/* Step Pills */
.fcard-step {
  width: auto !important;
  height: 28px !important;
  padding: 0 10px !important;
  border-radius: 8px !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  letter-spacing: -0.01em !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
}

.step-identity { background: rgba(108, 99, 255, 0.2); color: #c7d2fe; border: 1px solid rgba(108, 99, 255, 0.35); }
.step-stock { background: rgba(6, 182, 212, 0.2); color: #a5f3fc; border: 1px solid rgba(6, 182, 212, 0.35); }
.step-pricing { background: rgba(16, 185, 129, 0.2); color: #a7f3d0; border: 1px solid rgba(16, 185, 129, 0.35); }
.step-vendor { background: rgba(245, 158, 11, 0.2); color: #fef08a; border: 1px solid rgba(245, 158, 11, 0.35); }
.step-freshness { background: rgba(236, 72, 153, 0.2); color: #fbcfe8; border: 1px solid rgba(236, 72, 153, 0.35); }

/* Input Left Icons */
.has-icon-left {
  padding-left: 38px !important;
}

.input-icon-left {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--text-muted, #94a3b8);
  pointer-events: none;
  z-index: 2;
}

.btn-scan-accent {
  background: rgba(6, 182, 212, 0.15) !important;
  color: #38bdf8 !important;
  border: 1px solid rgba(6, 182, 212, 0.3) !important;
  padding: 4px 10px !important;
  border-radius: 8px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-scan-accent:hover {
  background: rgba(6, 182, 212, 0.28) !important;
  border-color: #38bdf8 !important;
  transform: translateY(-1px);
}

/* ── Margin Presets ── */
.margin-preset-container {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px 14px;
  margin-top: 4px;
}

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

.margin-preset-label {
  font-size: 12px;
  font-weight: 700;
  color: #f1f5f9;
}

.margin-preset-sub {
  font-size: 11px;
  color: var(--text-tertiary, #94a3b8);
}

.margin-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.margin-preset-btn {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.28);
  color: #34d399;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.margin-preset-btn:hover {
  background: #10b981;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.margin-preset-btn.active {
  background: #10b981;
  color: #ffffff;
  border-color: #059669;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
}

/* ── Live Profit Summary Card ── */
.profit-summary-card {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(6, 182, 212, 0.06) 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 16px;
  padding: 16px;
  margin-top: 6px;
  position: relative;
  overflow: hidden;
}

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

.profit-summary-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #e2e8f0;
}

.mrp-badge {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

.profit-metrics-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 14px;
}

.profit-metric-item {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.profit-metric-divider {
  color: var(--text-muted, #94a3b8);
  font-size: 14px;
  font-weight: 800;
  padding: 0 4px;
}

.profit-metric-item .metric-label {
  font-size: 11px;
  color: var(--text-muted, #94a3b8);
  margin-bottom: 2px;
}

.profit-metric-item .metric-val {
  font-size: 15px;
  font-weight: 800;
  color: #f1f5f9;
  font-variant-numeric: tabular-nums;
}

.highlight-metric {
  background: rgba(16, 185, 129, 0.15);
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.profit-green {
  color: #34d399 !important;
}

.selling-price-row {
  margin-bottom: 10px;
}

.selling-price-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.selling-price-tag {
  font-size: 13px;
  font-weight: 700;
  color: #e2e8f0;
}

.selling-price-affix .price-result-input {
  background: rgba(15, 23, 42, 0.8) !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
  font-size: 18px !important;
  font-weight: 800 !important;
  color: #34d399 !important;
}

.selling-price-affix .price-result-input:focus {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25) !important;
}

/* ── GST Card Wrap ── */
.gst-card-wrap {
  background: rgba(108, 99, 255, 0.06);
  border: 1px solid rgba(108, 99, 255, 0.25);
  border-radius: 14px;
  padding: 14px;
}

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

.gst-card-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #c7d2fe;
}

.gst-status-badge {
  background: rgba(108, 99, 255, 0.2);
  color: #a5b4fc;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}

/* ── Expiry Preset Chips ── */
.expiry-preset-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.expiry-preset-row .preset-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted, #94a3b8);
}

.expiry-preset-btn {
  background: rgba(236, 72, 153, 0.12);
  border: 1px solid rgba(236, 72, 153, 0.28);
  color: #f472b6;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.expiry-preset-btn:hover {
  background: #ec4899;
  color: #ffffff;
  transform: translateY(-1px);
}

/* ── Floating Sticky Action Bar Redesign ── */
.form-actionbar {
  position: sticky !important;
  bottom: 0 !important;
  z-index: 100 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: var(--space-3) !important;
  padding: var(--space-4) var(--space-6) !important;
  background: rgba(10, 14, 26, 0.88) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5) !important;
}

.btn-cancel {
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: var(--text-secondary) !important;
  font-weight: 600 !important;
}

.btn-cancel:hover {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
  color: #f87171 !important;
}

.btn-save-add {
  background: rgba(108, 99, 255, 0.15) !important;
  border: 1px solid rgba(108, 99, 255, 0.4) !important;
  color: #c7d2fe !important;
  font-weight: 700 !important;
  transition: all 0.2s ease !important;
}

.btn-save-add:hover {
  background: rgba(108, 99, 255, 0.3) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(108, 99, 255, 0.3) !important;
}

.btn-submit-hero {
  background: linear-gradient(135deg, #6C63FF 0%, #4F46E5 100%) !important;
  border: none !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  padding: 12px 24px !important;
  font-size: 14px !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 20px rgba(108, 99, 255, 0.4) !important;
  transition: all 0.2s ease !important;
}

.btn-submit-hero:hover {
  background: linear-gradient(135deg, #7c73ff 0%, #5a52e0 100%) !important;
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 6px 24px rgba(108, 99, 255, 0.55) !important;
}

@media (max-width: 600px) {
  .add-product-hero {
    padding: var(--space-4);
    margin-bottom: var(--space-3);
  }
  .hero-title {
    font-size: 20px;
  }
  .form-actionbar {
    padding: var(--space-3) var(--space-4) !important;
    gap: 8px !important;
  }
  .btn-save-add {
    font-size: 12px !important;
    padding: 8px 12px !important;
  }
  .btn-submit-hero {
    font-size: 13px !important;
    padding: 10px 16px !important;
  }
  .profit-metrics-row {
    flex-direction: column;
    align-items: stretch;
  }
  .profit-metric-divider {
    display: none;
  }
}


/* ══════════════════════════════════════════════════════
   ADD PRODUCT — look & feel refresh (v2.0.5)
   Loaded last on purpose: overrides the earlier layered rules.
   ══════════════════════════════════════════════════════ */

/* Full-screen task: no bottom nav, the save bar owns the bottom edge. */
body:has(#viewAddProduct.active) .bottom-nav { display: none !important; }

#viewAddProduct .form-container { padding-top: 0; padding-bottom: var(--space-2); }

/* ── Compact intro ── */
.ap-intro {
  margin: var(--space-3) var(--content-padding) var(--space-4);
  padding: var(--space-4);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(30, 27, 75, 0.65), rgba(15, 23, 42, 0.8));
  border: 1px solid rgba(108, 99, 255, 0.22);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.ap-intro-kicker {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: #a5b4fc;
}
.ap-intro-title {
  margin: 2px 0 2px;
  font-size: 19px; font-weight: 800; letter-spacing: -0.02em; color: #fff;
}
.ap-intro-sub { margin: 0; font-size: 12.5px; color: var(--text-secondary); line-height: 1.45; }

.ap-quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.ap-quick {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 62px;
  padding: 8px 4px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: #e2e8f0;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.ap-quick:active { transform: scale(0.96); }
.ap-quick-icon { font-size: 20px; line-height: 1; }
.ap-quick-label { font-size: 11.5px; font-weight: 700; letter-spacing: 0.01em; }
.ap-quick.master-pill:hover, .ap-quick.master-pill:focus-visible { background: rgba(245,158,11,.16); border-color: rgba(245,158,11,.45); }
.ap-quick.barcode-pill:hover, .ap-quick.barcode-pill:focus-visible { background: rgba(6,182,212,.16); border-color: rgba(6,182,212,.45); }
.ap-quick.voice-pill:hover, .ap-quick.voice-pill:focus-visible { background: rgba(139,92,246,.16); border-color: rgba(139,92,246,.45); }
.ap-quick.ocr-pill:hover, .ap-quick.ocr-pill:focus-visible { background: rgba(16,185,129,.16); border-color: rgba(16,185,129,.45); }

@media (min-width: 640px) {
  .ap-intro { flex-direction: row; align-items: center; justify-content: space-between; padding: var(--space-4) var(--space-5); }
  .ap-quick-grid { grid-template-columns: repeat(4, 76px); }
}
@media (min-width: 768px) {
  .ap-intro { max-width: 720px; margin-left: auto; margin-right: auto; }
}

/* ── Cards: calmer focus, no jumping while typing ── */
#viewAddProduct .fcard { margin-bottom: var(--space-3); overflow: visible; }
#viewAddProduct .fcard:focus-within { transform: none; }
#viewAddProduct .fcard-head { padding: var(--space-3) var(--space-4); }
#viewAddProduct .fcard-title { font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#viewAddProduct .fcard-sub { font-size: 11.5px; }
#viewAddProduct .fcard-body { padding: var(--space-4); gap: var(--space-3) var(--space-4); }
#viewAddProduct .form-hint { font-size: 11px; margin-top: 4px; }

/* ── Collapsible optional sections ── */
.fcard-collapsible > summary { list-style: none; cursor: pointer; user-select: none; }
.fcard-collapsible > summary::-webkit-details-marker { display: none; }
.fcard-collapsible:not([open]) > summary { border-bottom-color: transparent; }
.fcard-collapsible .fcard-headings { flex: 1; }
.fcard-chevron {
  margin-left: auto;
  width: 28px; height: 28px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-size: 16px; line-height: 1;
  transition: transform 0.2s ease;
}
.fcard-collapsible[open] .fcard-chevron { transform: rotate(180deg); }
.fcard-optional {
  font-size: 10px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 5px;
  background: rgba(255, 255, 255, 0.06); color: var(--text-tertiary);
}
.fcard-sub.is-filled { color: #a7f3d0; font-weight: 600; }

/* ── Pricing ── */
#viewAddProduct .margin-preset-container { padding: 10px 12px; }
#viewAddProduct .margin-presets { gap: 6px; }
#viewAddProduct .margin-preset-btn { padding: 6px 10px; }
#viewAddProduct .profit-summary-card { padding: 14px; }
#viewAddProduct .profit-summary-header { margin-bottom: 10px; }
#viewAddProduct .profit-metrics-row { flex-direction: row; align-items: center; padding: 10px; margin-bottom: 12px; }
#viewAddProduct .profit-metric-divider { display: block; padding: 0 2px; }
#viewAddProduct .selling-price-tag { font-size: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
#viewAddProduct .selling-price-affix .price-result-input { font-size: 22px !important; height: 54px; }
#viewAddProduct .price-result-note { font-size: 11.5px; }

/* ── Save bar: pinned to the bottom, safe-area aware ── */
#viewAddProduct .form-actionbar {
  position: sticky !important;
  bottom: 0 !important;
  margin: var(--space-3) 0 0 !important;
  padding: var(--space-3) var(--content-padding) calc(var(--space-3) + var(--safe-bottom, 0px)) !important;
  border-radius: 0 !important;
  border: none !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  background: rgba(10, 14, 26, 0.92) !important;
  gap: 8px !important;
  justify-content: stretch !important;
}
#viewAddProduct .form-actionbar .btn { height: 48px; border-radius: 12px !important; }
#viewAddProduct #btnCancelFormBottom { flex: 0 0 48px !important; min-width: 48px !important; padding: 0 !important; }
#viewAddProduct #btnCancelFormBottom .ap-btn-text { display: none; }
#viewAddProduct #btnSaveAndAddAnother { flex: 1 1 0 !important; min-width: 0 !important; white-space: nowrap; font-size: 13px !important; }
#viewAddProduct #btnSubmitProduct { flex: 1.4 1 0 !important; min-width: 0 !important; white-space: nowrap; font-size: 15px !important; }

@media (min-width: 768px) {
  #viewAddProduct .form-actionbar {
    max-width: none !important;
    padding-left: calc((100% - 720px) / 2) !important;
    padding-right: calc((100% - 720px) / 2) !important;
    justify-content: flex-end !important;
  }
  #viewAddProduct #btnCancelFormBottom { flex: 0 0 auto !important; padding: 0 18px !important; }
  #viewAddProduct #btnCancelFormBottom .ap-btn-text { display: inline; }
  #viewAddProduct #btnSaveAndAddAnother { flex: 0 0 auto !important; padding: 0 18px !important; }
  #viewAddProduct #btnSubmitProduct { flex: 0 0 200px !important; }
}

/* ── Phone layout ── */
@media (max-width: 560px) {
  #viewAddProduct .fcard-body { padding: var(--space-3) var(--space-4) var(--space-4); }
  /* brand + category side by side */
  #viewAddProduct .fcard-identity .fcard-body-stack > .form-group:nth-child(2),
  #viewAddProduct .fcard-identity .fcard-body-stack > .form-group:nth-child(3) { grid-column: span 1; }
  #viewAddProduct .master-catalog-badge { display: none !important; }
  /* GST slab + HSN stack so the slab name is readable */
  #viewAddProduct .gst-card-wrap .fcard-body { grid-template-columns: 1fr !important; }
  #viewAddProduct .gst-card-wrap .form-group { grid-column: auto !important; }
  /* vendor section: full-width rows */
  #viewAddProduct .fcard-vendor .fcard-body > .form-group { grid-column: 1 / -1; }
  #viewAddProduct .profit-metric-item .metric-label { font-size: 10px; }
  #viewAddProduct .profit-metric-item .metric-val { font-size: 13.5px; }
  #viewAddProduct .highlight-metric { padding: 5px 8px; }
  #viewAddProduct .mrp-badge { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ap-quick, .fcard-chevron { transition: none; }
}
