:root {
  /* Light theme variables (default) */
  --primary: #3b82f6;
  --primary-rgb: 59, 130, 246;
  --primary-dark: #2563eb;
  --primary-light: #93c5fd;
  --secondary: #64748b;
  --accent: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;

  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-hover: #f1f5f9;
  --text: #1e293b;
  --text-light: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --input-bg: #ffffff;
  --input-hover-bg: #f8fafc;
  --input-border: #cbd5e1;
  --chart-bg: #ffffff;
  --chart-grid-line: rgba(148, 163, 184, 0.2);
  --chart-line: #2563eb;
  --chart-line-soft: rgba(37, 99, 235, 0.15);
  --chart-line-contrast: #ffffff;

  /* Modern sizing */
  --radius: 0.75rem;
  --radius-sm: 0.5rem;
  --radius-lg: 1rem;
  --radius-full: 9999px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Sci-fi effects */
  --glow-primary: 0 0 20px rgba(var(--primary-rgb), 0.3);
  --glow-accent: 0 0 15px rgba(var(--primary-rgb), 0.35);
  --scan-line: linear-gradient(90deg, transparent, rgba(var(--primary-rgb), 0.1), transparent);
  --grid-pattern: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(var(--primary-rgb), 0.03) 2px, rgba(var(--primary-rgb), 0.03) 4px);
  
  /* Typography */
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

/* Dark theme variables */
body[data-theme="dark"] {
  /* Dark palette tuned for lower contrast */
  --primary: #38bdf8;
  --primary-rgb: 56, 189, 248;
  --primary-dark: #0ea5e9;
  --primary-light: #7dd3fc;
  --secondary: #f8fafc;
  --accent: #f472b6;
  --warning: #fbbf24;
  --error: #f87171;

  --bg: #0b1120;
  --bg-card: #111827;
  --bg-hover: #1f2937;
  --text: #e2e8f0;
  --text-light: #cbd5f5;
  --text-muted: #94a3b8;
  --border: rgba(148, 163, 184, 0.18);
  --border-light: rgba(148, 163, 184, 0.26);
  --input-bg: #111827;
  --input-hover-bg: #1f2937;
  --input-border: #27364a;
  --chart-bg: #111827;
  --chart-grid-line: rgba(148, 163, 184, 0.16);
  --chart-line: #38bdf8;
  --chart-line-soft: rgba(56, 189, 248, 0.18);
  --chart-line-contrast: #0b1120;

  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.6), inset 0 1px 0 rgba(56, 189, 248, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.45), 0 2px 4px -2px rgba(15, 23, 42, 0.35);
  --shadow-lg: 0 12px 18px -3px rgba(15, 23, 42, 0.5), 0 6px 8px -4px rgba(15, 23, 42, 0.35);
  --shadow-xl: 0 20px 32px -5px rgba(15, 23, 42, 0.55), 0 10px 12px -6px rgba(15, 23, 42, 0.4);
}
/* Reset with modern styling */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', monospace;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-weight: var(--font-weight-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  overflow-x: hidden;
}

/* Sci-fi grid overlay for dark theme */
body[data-theme="dark"]::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--grid-pattern);
  pointer-events: none;
  z-index: -1;
  opacity: 0.3;
}

/* Scanning line animation for dark theme */
body[data-theme="dark"]::after {
  content: '';
  position: fixed;
  top: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--scan-line);
  animation: scanLine 3s linear infinite;
  pointer-events: none;
  z-index: 1000;
}

@keyframes scanLine {
  0% { transform: translateY(0); }
  100% { transform: translateY(100vh); }
}

.text-muted {
  color: var(--text-muted);
}

.text-center {
  text-align: center !important;
}

.small {
  font-size: 0.8rem;
}

/* utility spacing helpers */
.mt-3 { margin-top: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-2 { margin-bottom: 0.75rem !important; }
.mb-1 { margin-bottom: 0.5rem !important; }
.ml-2 { margin-left: 0.75rem !important; }
.gap-3 { gap: 1rem !important; }

.d-flex { display: flex !important; }
.flex-wrap { flex-wrap: wrap !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-end { justify-content: flex-end !important; }
.align-items-start { align-items: flex-start !important; }
.align-items-center { align-items: center !important; }
.position-relative { position: relative !important; }

.page-header {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.page-header h2 {
  font-size: 1.6rem;
  font-weight: var(--font-weight-semibold);
}

.settings-page {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.settings-page.wide {
  max-width: 1080px;
}

.settings-grid {
  display: grid;
  gap: var(--space-lg);
}

.vendor-page {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.vendor-page .card {
  margin: 0;
}

@media (min-width: 900px) {
  .settings-grid.two-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.settings-card {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.stacked-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.stacked-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.radio-tile {
  display: block;
}

.radio-tile input[type='radio'] {
  display: none;
}

.radio-tile .radio-label {
  display: block;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: var(--font-weight-medium);
  color: var(--text);
  transition: all var(--transition);
}

.radio-tile .radio-label:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.radio-tile input[type='radio']:checked + .radio-label {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.radio-tile input[type='radio']:disabled + .radio-label {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-actions {
  margin-top: var(--space-md);
  display: flex;
  justify-content: flex-end;
}

.divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--space-md) 0;
}

.empty-text {
  color: var(--text-muted);
  font-style: italic;
}

.form-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.form-label {
  font-weight: var(--font-weight-medium);
  color: var(--text);
}

.errorlist {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  color: #b91c1c;
  font-size: 0.85rem;
}

.logo-preview {
  max-height: 80px;
  width: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-top: 0.5rem;
  padding: 0.35rem;
  background: var(--bg);
}

body[data-theme='dark'] .logo-preview {
  background: var(--bg-card);
  border-color: rgba(255, 250, 250, 0.25);
}

.alert {
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.alert h3 {
  font-size: 1.1rem;
  font-weight: var(--font-weight-semibold);
}

.alert-warning {
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.12);
  color: #92400e;
}

.alert-success {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.12);
  color: #166534;
}

.alert-error,
.alert-danger {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.12);
  color: #991b1b;
}

.alert-info {
  border-color: rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.1);
  color: #1d4ed8;
}

body[data-theme='dark'] .alert {
  border-color: rgba(255, 250, 250, 0.12);
  background: rgba(22, 33, 62, 0.85);
  color: var(--text);
}

body[data-theme='dark'] .alert-warning {
  border-color: rgba(255, 196, 87, 0.45);
  background: rgba(255, 196, 87, 0.1);
  color: #facc15;
}

body[data-theme='dark'] .alert-success {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.14);
  color: #4ade80;
}

body[data-theme='dark'] .alert-error,
body[data-theme='dark'] .alert-danger {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}

body[data-theme='dark'] .alert-info {
  border-color: rgba(var(--primary-rgb), 0.28);
  background: rgba(var(--primary-rgb), 0.12);
  color: var(--secondary);
}

a {
  text-decoration: none;
  color: var(--primary);
  transition: color var(--transition);
}

a:hover {
  color: var(--primary-dark);
}
.app-container { display:flex; min-height:100vh; }
.sidebar {
  width: 256px;
  background: var(--bg-card);
  color: var(--text);
  transition: transform var(--transition);
  position: relative;
  z-index: 500;
  box-shadow: var(--shadow-sm);
}

body[data-theme="dark"] .sidebar {
  background: linear-gradient(135deg, #0b1120 0%, #111827 35%, #1f2937 100%);
  box-shadow: var(--shadow-lg);
  position: relative;
}

body[data-theme="dark"] .sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(var(--primary-rgb), 0.05) 50%, transparent 70%);
  pointer-events: none;
}
.sidebar .brand {
  font-size: 1.75rem;
  font-weight: var(--font-weight-bold);
  padding: var(--space-lg);
  margin-bottom: var(--space-sm);
  background: transparent;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  position: relative;
}

body[data-theme="dark"] .sidebar .brand {
  background: transparent;
  color: var(--primary);
  text-shadow: 0 0 10px rgba(var(--primary-rgb), 0.45);
}

.brand-logo {
  width: 32px;
  height: 32px;
  filter: brightness(0) invert(1);
  transition: var(--transition);
}

body[data-theme="dark"] .brand-logo {
  filter: brightness(0) invert(1) sepia(1) hue-rotate(180deg) saturate(5) brightness(2);
  animation: logoGlow 2s ease-in-out infinite alternate;
}

@keyframes logoGlow {
  0% { filter: brightness(0) invert(1) sepia(1) hue-rotate(180deg) saturate(5) brightness(2); }
  100% { filter: brightness(0) invert(1) sepia(1) hue-rotate(180deg) saturate(5) brightness(3) drop-shadow(0 0 5px cyan); }
}

.theme-toggle {
  background: transparent;
  border: none;
  border-radius: var(--radius);
  padding: var(--space-sm) var(--space-md);
  margin: 0 var(--space-md) var(--space-md) var(--space-md);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.875rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

body[data-theme="dark"] .theme-toggle {
  background: transparent;
  color: var(--primary);
}

.theme-toggle:hover {
  background: var(--bg-hover);
  transform: translateX(2px);
  border-color: var(--primary);
  color: var(--primary);
}

body[data-theme="dark"] .theme-toggle:hover {
  background: rgba(var(--primary-rgb), 0.18);
  box-shadow: var(--glow-accent);
}
.nav-link {
  display: block;
  padding: 0.875rem var(--space-lg);
  color: var(--text);
  transition: all var(--transition);
  border-radius: var(--radius-sm);
  margin: 0 var(--space-sm) var(--space-xs) var(--space-sm);
  font-weight: var(--font-weight-medium);
  position: relative;
  overflow: hidden;
}

body[data-theme="dark"] .nav-link {
  color: rgba(224, 230, 237, 0.8);
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary);
  background: var(--bg-hover);
  transform: translateX(3px);
}

body[data-theme="dark"] .nav-link:hover,
body[data-theme="dark"] .nav-link.active {
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.18);
  font-weight: var(--font-weight-bold);
  box-shadow: inset 0 0 0 1px rgba(var(--primary-rgb), 0.25);
}

body[data-theme="dark"] .nav-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(var(--primary-rgb), 0.08), transparent);
  transition: left 0.5s;
}

body[data-theme="dark"] .nav-link:hover::before {
  left: 100%;
}
.main { flex:1; display:flex; flex-direction:column; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  padding: var(--space-md) var(--space-lg);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 100;
}

body[data-theme="dark"] .topbar {
  background: rgba(26, 26, 46, 0.8);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(20px);
}

body[data-theme="dark"] .page-title {
  color: var(--primary);
  text-shadow: 0 0 10px rgba(var(--primary-rgb), 0.35);
  font-weight: var(--font-weight-bold);
}
.hamburger { font-size:1.5rem; background:none; border:none; cursor:pointer; }
.topbar-actions { display:flex; gap:0.5rem; align-items:center; }
.content-area {
  padding: var(--space-xl);
  flex: 1;
  overflow: visible;
  background: var(--bg);
  min-height: calc(100vh - 4rem);
  position: relative;
}

.content-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

.content-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.org-selector {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.org-selector label {
  font-weight: 500;
  color: var(--text-secondary);
}

.org-selector select {
  min-width: 200px;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: var(--bg-card);
  color: var(--text-primary);
  font-weight: 500;
}

body[data-theme="dark"] .org-selector select {
  background: rgba(15, 23, 42, 0.8);
  border-color: rgba(148, 163, 184, 0.3);
  color: rgba(226, 232, 240, 0.95);
}

body[data-theme="dark"] .content-area {
  background: radial-gradient(ellipse at center, rgba(var(--primary-rgb), 0.04) 0%, var(--bg) 55%);
}

/* Dashboard Overview Layout */
.dashboard-overview {
  display: flex;
  gap: var(--space-xl);
  margin-bottom: var(--space-xl);
  min-height: 500px;
}

.dashboard-sidebar {
  flex: 0 0 30%;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.dashboard-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.globe-card {
  padding: var(--space-md);
  text-align: center;
  height: 100%;
  min-height: 600px;
  margin: 0;
  width: 100%;
  max-width: 100%;
}

.globe-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.globe-org-selector {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.globe-org-select {
  min-width: 180px;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: var(--bg-card);
  color: var(--text-primary);
  font-weight: 500;
}

body[data-theme="dark"] .globe-org-select {
  background: rgba(15, 23, 42, 0.8);
  border-color: rgba(148, 163, 184, 0.3);
  color: rgba(226, 232, 240, 0.95);
}

@media (max-width: 768px) {
  .dashboard-overview {
    flex-direction: column;
  }
  
  .dashboard-sidebar {
    flex: none;
    flex-direction: row;
  }
  
  .dashboard-sidebar .card {
    flex: 1;
  }
}

.heatmap-container {
  position: relative;
  width: 100%;
  min-height: 500px;
  height: clamp(450px, 60vh, 700px);
  margin: var(--space-sm) 0;
  border-radius: inherit;
  overflow: hidden;
  background: transparent;
  border: none;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

body[data-theme="dark"] .heatmap-container {
  background: transparent;
  border: none;
  box-shadow: none;
}

.heatmap-chart {
  width: 100%;
  height: 100%;
}

.heatmap-info {
  position: absolute;
  top: var(--space-lg);
  right: var(--space-lg);
  background: rgba(255, 255, 255, 0.92);
  border-radius: var(--radius);
  padding: var(--space-md);
  box-shadow: var(--shadow-md);
  max-width: 240px;
}

body[data-theme="dark"] .heatmap-info {
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: var(--shadow-md);
  color: var(--secondary);
}

.heatmap-stats {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.heatmap-empty {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-lg);
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.12), rgba(148, 163, 184, 0.04));
  color: var(--text-muted);
}

.heatmap-empty.is-visible {
  display: flex;
}

.heatmap-empty p {
  max-width: 320px;
}

body[data-theme="dark"] .heatmap-empty {
  background: none;
  color: rgba(248, 250, 252, 0.7);
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  font-size: 0.875rem;
}

.stat-label {
  color: var(--text-muted);
  font-weight: var(--font-weight-medium);
}

body[data-theme="dark"] .stat-label {
  color: var(--primary);
}

.stat-value {
  color: var(--text);
  font-weight: var(--font-weight-bold);
  font-family: monospace;
}

body[data-theme="dark"] .stat-value {
  color: var(--primary);
  text-shadow: 0 0 5px rgba(var(--primary-rgb), 0.4);
}

@keyframes loadingPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: var(--space-lg);
  margin: var(--space-md);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

body[data-theme="dark"] .card {
  background: linear-gradient(135deg, var(--bg-card) 0%, #1f2937 100%);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(var(--primary-rgb), 0.08);
  backdrop-filter: blur(10px);
}

body[data-theme="dark"] .card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(var(--primary-rgb), 0.06), transparent);
  transition: left 0.8s ease;
}

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

body[data-theme="dark"] .card:hover {
  box-shadow: var(--glow-primary), var(--shadow-lg);
  transform: translateY(-3px);
}

body[data-theme="dark"] .card:hover::before {
  left: 100%;
}

/* Live indicator styling */
.live-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: var(--space-sm);
  font-size: 0.75rem;
  color: var(--text-muted);
}

body[data-theme="dark"] .live-indicator {
  color: var(--primary);
  text-shadow: 0 0 5px rgba(var(--primary-rgb), 0.4);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

body[data-theme="dark"] .live-dot {
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.1); }
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius);
  font-weight: var(--font-weight-medium);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--primary);
  border: 1px solid var(--border);
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius);
  font-weight: var(--font-weight-medium);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-outline {
  background: transparent;
  color: var(--secondary);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-weight: var(--font-weight-medium);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-outline:hover {
  background: var(--bg-hover);
  border-color: var(--secondary);
  color: var(--text);
}

/* Button processing state */
.btn-primary.processing,
.btn-secondary.processing,
.btn-outline.processing,
button:disabled,
input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
  transform: none !important;
}

.btn-primary.processing {
  background: #9ca3af;
}

.btn-secondary.processing {
  background: #e5e7eb;
  color: #6b7280;
}

.btn-outline.processing {
  border-color: #d1d5db;
  color: #9ca3af;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: var(--font-weight-semibold);
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  padding: 0;
}

.btn-link:hover {
  text-decoration: underline;
}
.dropdown { position:relative; }
.dropdown-menu {
  position: absolute;
  top: 110%;
  right: 0;
  display: none;
  min-width: 200px;
  padding: 0.5rem 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 100;
}
.dropdown:hover .dropdown-menu { display:block; }
.dropdown-item {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--text);
  transition: background-color var(--transition), color var(--transition);
}
.dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--primary);
}

body[data-theme='dark'] .dropdown-menu {
  background: rgba(22, 33, 62, 0.95);
  border-color: rgba(255, 250, 250, 0.12);
  box-shadow: var(--shadow-lg);
}

body[data-theme='dark'] .dropdown-item {
  color: var(--text);
}

body[data-theme='dark'] .dropdown-item:hover {
  background: rgba(255, 250, 250, 0.08);
  color: var(--secondary);
}
.modal {
  position:fixed; top:0;left:0; width:100%;height:100%;
  background:rgba(0,0,0,0.6); display:none;
  align-items:center; justify-content:center; z-index:1000;
}
.modal.show { display:flex; }
.modal-content {
  background:#fff; padding:1.5rem; border-radius:var(--radius);
  width:90%; max-width:400px;
}
.modal-actions { margin-top:1rem; display:flex; gap:0.5rem; justify-content:flex-end; }
@media (max-width: 768px) {
  /* Sidebar hidden by default */
  #sidebar {
    position: absolute;
    top: 0;                  /* stick to top */
    left: 0;
    min-height: 100vh;       /* allow sidebar to grow if content overflows */
    transform: translateX(-100%);
    transition: transform var(--transition);
    z-index: 500;            /* above content */
    overflow-y: auto;        /* enable scrolling when content exceeds viewport */
  }

  /* When “open” is toggled, slide in */
  #sidebar.open {
    transform: translateX(0);
  }

  /* Elevate the topbar above the sidebar */
  .topbar {
    position: relative;
    z-index: 300;
  }

  /* Keep the hamburger button on top */
  #sidebarToggle {
    position: relative;
    z-index: 400;
  }

  body.sidebar-open {
    overflow: hidden;
  }
}

/* toolbar above tables & forms */
/* ensure toolbars sit above tables and have breathing room */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: center;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
}

/* responsive table wrapper */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin-bottom: 2rem;
}

/* modern table styling */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.table thead {
  background: var(--bg-hover);
}

.table th {
  padding: 1rem 1.25rem;
  text-align: left;
  font-weight: var(--font-weight-semibold);
  color: var(--text);
  border-bottom: 2px solid var(--border);
  font-size: 0.875rem;
  letter-spacing: 0.025em;
}

.table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  vertical-align: middle;
}

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

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

/* search inputs */
.table-search {
  padding: 0.5rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: var(--radius);
  max-width: 300px;
  width: 100%;
}

.table-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: var(--font-weight-semibold);
}

.table-header-control {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.table-header-control.align-center {
  align-items: center;
}

.membership-card {
  border: none;
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.techpack-list-wrapper {
  max-width: 1100px;
  margin: 0 auto;
}

.techpack-list-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: var(--space-xl);
}

.list-header {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: var(--space-lg);
}

.list-header h2 {
  font-size: 1.35rem;
  font-weight: var(--font-weight-semibold);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9rem;
}

.data-table thead th {
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.data-table .numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

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

.data-table .actions {
  text-align: right;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  margin-top: var(--space-md);
}

.card-actions {
  margin-top: var(--space-md);
  display: flex;
  justify-content: flex-end;
}

.empty-state {
  text-align: center;
  padding: var(--space-xl);
  display: grid;
  gap: 0.5rem;
}

.techpack-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.editor-grid {
  display: grid;
  gap: var(--space-lg);
  grid-template-columns: 1.7fr 1.3fr;
  grid-template-areas:
    'header header'
    'canvas history'
    'materials sku'
    'sizing checklist';
  align-items: stretch;
}

.panel {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

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

.panel-header h2 {
  font-size: 1.1rem;
  font-weight: var(--font-weight-semibold);
}

.header-panel {
  grid-area: header;
  flex-direction: row;
  flex-wrap: wrap;
  gap: var(--space-lg);
  align-items: flex-end;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 220px;
}

.field-group label {
  font-weight: var(--font-weight-medium);
  font-size: 0.85rem;
  color: var(--text-light);
}

.field-group input,
.field-group select,
#sizingTable input,
.sku-card input[type="text"],
.search-group input[type="search"] {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
  background: var(--bg);
}

.field-group select {
  background: var(--bg-card);
}

.commit-actions {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.canvas-panel {
  grid-area: canvas;
}

.history-panel {
  grid-area: history;
}

.raw-material-panel {
  grid-area: materials;
}

.sku-panel {
  grid-area: sku;
}

.sizing-panel {
  grid-area: sizing;
}

.checklist-panel {
  grid-area: checklist;
}

.canvas-controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.canvas-panel canvas {
  width: 100%;
  max-width: 100%;
  min-height: 480px;
}

.canvas-panel canvas.lower-canvas {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}

.canvas-panel canvas.upper-canvas {
  border-radius: var(--radius);
  background: transparent;
}

.upload-btn {
  position: relative;
  overflow: hidden;
}

.search-group {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.search-group.inline {
  flex-direction: column;
}

.search-results {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 50;
  display: flex;
  flex-direction: column;
  max-height: 220px;
  overflow-y: auto;
}

.product-results {
  max-height: 320px;
  overflow: hidden;
}

.product-results[hidden] {
  display: none !important;
}

.product-results.is-visible {
  display: flex;
}

.product-results-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  max-height: 240px;
  overflow-y: auto;
}

.product-results-empty {
  padding: 0.5rem 0.75rem;
  text-align: center;
}

.product-results-footer {
  margin-top: auto;
  padding: 0.75rem;
  border-top: 1px solid var(--border-light);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.product-results-bulk {
  display: flex;
  gap: 0.75rem;
}

.product-results-bulk .btn-link {
  padding: 0;
  font-size: 0.85rem;
}

.product-results-footer .btn-secondary {
  flex-shrink: 0;
}

.product-result {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-card);
}

.product-result:last-child {
  border-bottom: none;
}

.product-result-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: var(--font-weight-medium);
}

.product-result-header input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
}

.product-result-title {
  flex: 1;
}

.product-result-subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.product-result-silhouettes {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-left: 1.65rem;
}

.product-result-silhouette {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.result-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.55rem 0.75rem;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}

.result-title {
  font-weight: var(--font-weight-medium);
}

.result-subtitle {
  color: var(--text-muted);
  font-size: 0.8rem;
}

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

.result-empty {
  padding: 0.75rem;
  color: var(--text-muted);
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  background: rgba(var(--primary-rgb), 0.12);
  color: var(--primary);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
}

.chip-remove {
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  font-size: 0.95rem;
}

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

#sizingTable {
  width: 100%;
  border-collapse: collapse;
}

#sizingTable th,
#sizingTable td {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border-light);
}

#sizingTable input {
  width: 100%;
}

.row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.35rem;
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
}

.pattern-header {
  width: 220px;
}

.pattern-cell {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 200px;
}

.pattern-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.pattern-summary a {
  color: var(--primary);
  font-weight: var(--font-weight-medium);
}

.pattern-summary .badge {
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
  border-radius: var(--radius-full);
  padding: 0.15rem 0.5rem;
  font-size: 0.7rem;
}

.pattern-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.pattern-cell .upload-btn {
  cursor: pointer;
}

.pattern-cell input[type='file'] {
  display: none;
}

.pattern-status {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.icon-button {
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
}

.icon-button:hover {
  color: var(--error);
}

.sku-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  background: var(--bg);
}

.sku-patterns {
  display: grid;
  gap: 0.5rem;
}

.pattern-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 0.5rem;
  align-items: center;
}

.pattern-row select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.pattern-row .pattern-link {
  font-size: 0.75rem;
  color: var(--text-muted);
}

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

.sku-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sku-list {
  display: grid;
  gap: var(--space-md);
}

.checklist-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checklist-item input[type='text'] {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
}

.checklist-item .icon-button {
  font-size: 1.1rem;
}

.pattern-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.pattern-row label {
  width: 60px;
  font-weight: var(--font-weight-medium);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.history-item.is-active {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.08);
}

.history-item strong {
  font-size: 0.95rem;
}

.history-item form {
  margin: 0;
}

@media (max-width: 1280px) {
  .editor-grid {
    grid-template-columns: 1fr;
  }

  .canvas-panel,
  .raw-material-panel,
  .sizing-panel,
  .checklist-panel,
  .sku-panel,
  .history-panel {
    grid-column: 1 / -1;
  }
}

.membership-card .table {
  margin: 0;
  border: none;
  box-shadow: none;
}

.column-toggle-group {
  display: inline-flex;
  gap: 0.5rem;
}

.btn-ghost {
  border: 1px solid var(--border);
  background: transparent;
  border-radius: var(--radius-full);
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  color: var(--text);
  cursor: pointer;
  transition: background-color var(--transition), border-color var(--transition), color var(--transition);
}

.btn-ghost:hover,
.btn-ghost:focus {
  background: rgba(var(--primary-rgb), 0.08);
  border-color: rgba(var(--primary-rgb), 0.35);
  color: var(--primary);
}

.role-filter {
  position: relative;
}

.role-filter-toggle {
  width: 100%;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.role-filter-icon {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.role-filter.is-open .role-filter-toggle,
.role-filter-toggle:hover,
.role-filter-toggle:focus {
  border-color: rgba(var(--primary-rgb), 0.45);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}

.role-filter-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0.75rem;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 20;
}

.role-filter-panel[hidden] {
  display: none !important;
}

.role-filter-search input {
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8rem;
}

.role-filter-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.role-filter-options {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 240px;
  overflow-y: auto;
}

.role-filter-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
}

.role-filter-option input {
  accent-color: var(--primary);
  width: 1rem;
  height: 1rem;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: var(--font-weight-medium);
  margin-right: 0.25rem;
  margin-bottom: 0.25rem;
}

.checkbox-wrapper {
  display: flex;
  justify-content: center;
}

.checkbox-wrapper input[type='checkbox'] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
}

.is-hidden {
  display: none !important;
}

/* card-wrapped forms */
.card.form-card,
.card.vendor-form {
  margin-bottom: 2rem;
}
.card.vendor-form form,
.card.form-card form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* customer portal link lookup */
.customer-portal-links .card {
  margin: 0;
}

.customer-portal-links .customer-portal-header {
  align-items: flex-start;
  gap: var(--space-md);
}

.customer-portal-links .page-title-group {
  display: grid;
  gap: 0.35rem;
}

.customer-portal-links .page-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.customer-portal-links .page-meta {
  font-size: 0.85rem;
  max-width: 260px;
}

.customer-portal-links .lookup-card {
  display: grid;
  gap: var(--space-lg);
}

.customer-portal-links .lookup-card__intro {
  display: grid;
  gap: 0.35rem;
}

.customer-portal-links .lookup-card__intro p {
  color: var(--text-muted);
  max-width: 56ch;
}

.customer-portal-links .lookup-form {
  display: grid;
  gap: var(--space-md);
}

.customer-portal-links .lookup-form__grid {
  display: grid;
  gap: var(--space-md);
}

.customer-portal-links .lookup-field label {
  font-weight: var(--font-weight-medium);
  color: var(--text-light);
  display: block;
  margin-bottom: 0.4rem;
}

.customer-portal-links .lookup-field .form-control {
  width: 100%;
}

.customer-portal-links .lookup-field .form-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.customer-portal-links .lookup-field .errorlist {
  margin-top: 0.35rem;
  color: var(--error);
  font-size: 0.85rem;
  list-style: none;
  padding-left: 0;
}

.customer-portal-links .lookup-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.customer-portal-links .lookup-actions .btn-primary {
  min-width: 140px;
}

.customer-portal-links .callout {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(var(--primary-rgb), 0.15);
  background: rgba(var(--primary-rgb), 0.06);
  padding: 1rem 1.25rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.customer-portal-links .callout-warning {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.1);
}

.customer-portal-links .callout-icon {
  font-size: 1.35rem;
}

.customer-portal-links .callout-copy {
  display: grid;
  gap: 0.25rem;
}

.customer-portal-links .callout-copy h4 {
  font-size: 1rem;
  font-weight: var(--font-weight-semibold);
}

.customer-portal-links .callout-copy p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.customer-portal-links .results-note {
  font-size: 0.9rem;
}

.customer-portal-links .results-card {
  display: grid;
  gap: var(--space-md);
}

.customer-portal-links .results-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.customer-portal-links .results-grid {
  display: grid;
  gap: var(--space-md);
}

.customer-portal-links .result-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: var(--space-md);
}

.customer-portal-links .result-card__header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.85rem;
  align-items: center;
}

.customer-portal-links .result-card__avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-full);
  background: rgba(var(--primary-rgb), 0.12);
  color: var(--primary);
  font-weight: var(--font-weight-semibold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.customer-portal-links .result-card__identity h4 {
  font-size: 1.05rem;
  font-weight: var(--font-weight-semibold);
}

.customer-portal-links .result-card__badge {
  background: rgba(var(--primary-rgb), 0.08);
  color: var(--primary);
}

.customer-portal-links .result-card__body {
  display: grid;
  gap: var(--space-sm);
}

.customer-portal-links .invite-adjust {
  border-top: 1px solid var(--border);
  padding-top: var(--space-sm);
}

.customer-portal-links .invite-adjust__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.customer-portal-links .invite-adjust__badge {
  background: rgba(76, 175, 80, 0.12);
  color: #2e7d32;
  border-radius: var(--radius-full);
  padding: 0.35rem 0.75rem;
  font-weight: var(--font-weight-semibold);
  font-size: 0.9rem;
}

.customer-portal-links .invite-adjust__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin: 0.5rem 0 0.75rem;
}

.customer-portal-links .invite-adjust__stats dt {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-light);
}

.customer-portal-links .invite-adjust__stats dd {
  margin: 0;
  font-weight: var(--font-weight-semibold);
}

.customer-portal-links .invite-adjust-form {
  display: grid;
  gap: 0.4rem;
  align-items: end;
}

.customer-portal-links .invite-adjust-form .form-control {
  max-width: 7rem;
}

.customer-portal-links .invite-adjust__actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.customer-portal-links .invite-adjust__actions .btn-primary {
  padding: 0.45rem 0.9rem;
}

.customer-portal-links .result-card__item {
  display: grid;
  gap: 0.35rem;
}

.customer-portal-links .result-card__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.customer-portal-links .result-card__label {
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-light);
  font-weight: var(--font-weight-semibold);
}

.customer-portal-links .result-card__url {
  font-family: 'Inter', monospace;
  font-size: 0.85rem;
  word-break: break-all;
  color: var(--text-muted);
}

.customer-portal-links .empty-state h3 {
  font-size: 1.1rem;
  font-weight: var(--font-weight-semibold);
}

.customer-portal-links .empty-state {
  gap: 0.25rem;
}

.customer-portal-links .results-card.empty-results {
  box-shadow: none;
  border: 1px dashed var(--border);
  background: rgba(var(--primary-rgb), 0.04);
}

@media (min-width: 600px) {
  .customer-portal-links .lookup-form__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
  }
}

@media (min-width: 720px) {
  .customer-portal-links .lookup-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .customer-portal-links .page-meta {
    text-align: right;
  }
}

@media (min-width: 768px) {
  .customer-portal-links .results-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
}

@media (max-width: 640px) {
  .customer-portal-links .result-card__header {
    grid-template-columns: auto 1fr;
  }

  .customer-portal-links .result-card__badge {
    grid-column: 1 / -1;
    justify-self: flex-start;
    margin-top: 0.35rem;
  }

  .customer-portal-links .result-card__meta {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* small responsiveness */
/* Pick Orders - Mobile-First Filter Design */
.filters-container {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.main-search-row {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.search-input-wrapper {
  flex: 1;
  position: relative;
  min-width: 0;
}

.main-search-input {
  width: 100%;
  padding: 0.75rem 1rem;
  padding-right: 3rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  background: var(--bg-card);
  transition: all var(--transition);
}

.main-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.search-submit-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  cursor: pointer;
}

.search-submit-btn:hover {
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.1);
}

.quick-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.compact-select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  font-size: 0.875rem;
  min-width: 100px;
}

.filter-toggle-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.875rem;
}

.filter-toggle-btn:hover {
  background: var(--bg-hover);
}

.filter-toggle-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.filter-count {
  background: var(--error);
  color: white;
  border-radius: var(--radius-full);
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
  min-width: 18px;
  display: none;
}

.advanced-filters {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.advanced-filters.open {
  max-height: 600px;
  overflow-y: auto;
}

.filter-section {
  padding: 1rem;
  border-top: 1px solid var(--border);
}

.filter-group {
  margin-bottom: 1.5rem;
}

.filter-group:last-child {
  margin-bottom: 0;
}

.filter-label {
  display: block;
  font-weight: var(--font-weight-medium);
  color: var(--text);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.date-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.compact-input {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  font-size: 0.875rem;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  transition: all var(--transition);
  border: 1px solid transparent;
}

.checkbox-item:hover {
  background: var(--bg-hover);
  border-color: var(--border);
}

.checkbox-item input[type="checkbox"] {
  margin: 0;
  width: 16px;
  height: 16px;
}

.checkbox-item span {
  font-size: 0.875rem;
  color: var(--text);
}

.select-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.filter-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.apply-filters-btn {
  flex: 1;
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all var(--transition);
}

.apply-filters-btn:hover {
  background: var(--primary-dark);
}

.clear-filters-btn {
  padding: 0.75rem 1.5rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}

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

/* Action Buttons */
.action-buttons-container {
  padding: 1rem;
  margin: 1rem 0;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.actions-toggle-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.875rem;
}

.actions-toggle-btn:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.action-buttons {
  display: none;
  flex-direction: column;
  gap: 0.5rem;
}

.action-buttons.open {
  display: flex;
}

/* Action buttons inline styling for filters */
.action-buttons-inline {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.action-form-inline {
  flex: 1;
  min-width: 0;
}

.action-form-inline button {
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 768px) {
  .action-buttons-inline {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .action-form-inline {
    width: 100%;
  }
}

.action-form {
  padding: 0.5rem 1rem;
}

.action-btn {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.875rem;
}

.action-btn.secondary:hover {
  background: var(--bg-hover);
}

/* Responsive Tabs */
.tabs-container {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
  border: none;
  box-shadow: none;
}

.tabs-scroll {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  padding: 0.5rem;
  gap: 0.25rem;
  white-space: nowrap;
}

.tabs-scroll::-webkit-scrollbar {
  display: none;
}

.tab-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  position: relative;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.tab-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.tab-item.active {
  background: var(--primary);
  color: white;
}

.tab-label {
  font-weight: var(--font-weight-medium);
}

.tab-count {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: bold;
  min-width: 20px;
  text-align: center;
}

.tab-item.active .tab-count {
  background: rgba(255, 255, 255, 0.25);
}

.tab-download {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  color: inherit;
  text-decoration: none;
  transition: all var(--transition);
  margin-left: 0.25rem;
}

.tab-download:hover {
  background: rgba(255, 255, 255, 0.3);
  color: inherit;
  text-decoration: none;
  transform: scale(1.1);
}

@media (min-width: 769px) {
  .actions-toggle-btn {
    display: none;
  }
  
  .action-buttons {
    display: flex !important;
  }
}

@media (max-width: 768px) {
  .table th, .table td { padding: 0.5rem; }
  .table-search { max-width: 100%; }
  
  .main-search-row {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .quick-actions {
    justify-content: space-between;
  }
  
  .compact-select {
    min-width: auto;
    flex: 1;
  }
  
  .date-inputs {
    grid-template-columns: 1fr;
  }
  
  .checkbox-grid {
    grid-template-columns: 1fr 1fr;
  }
  
  .select-row {
    grid-template-columns: 1fr;
  }
  
  .filter-actions {
    flex-direction: column;
  }
  
  .tabs-scroll {
    -webkit-overflow-scrolling: touch;
  }
  
  .tab-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    white-space: nowrap;
  }
  
  .tab-label {
    display: none;
  }
  
  .tab-item.active .tab-label {
    display: block;
  }
}

@media (max-width: 480px) {
  .main-search-row {
    padding: 0.75rem;
  }
  
  .filter-section {
    padding: 0.75rem;
  }
  
  .checkbox-grid {
    grid-template-columns: 1fr;
  }
}


/* consistent form layout inside cards */
.card form,
.form-card form,
.vendor-form form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* style all inputs, selects, textareas */
input,
select,
textarea {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  font-size: 1rem;
  background: var(--input-bg);
  color: var(--text);
  transition: border-color var(--transition), background-color var(--transition), color var(--transition), box-shadow var(--transition);
}

input:hover,
select:hover,
textarea:hover {
  background: var(--input-hover-bg);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.12);
}

/* labels above form fields */
label {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

/* slightly larger buttons in forms */
.btn-primary,
.btn-secondary {
  padding: 0.6rem 1.2rem;
  font-size: 0.95rem;
}

:root {
  /* … your existing vars … */
  --success: #4CAF50;  /* pleasant green */
  --danger:  #F44336;  /* pleasant red */
}

/* collection search dropdown */
.form-group { position: relative; }


.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  list-style: none;
  margin-top: 0.25rem;
  max-height: 240px;
  overflow-y: auto;
  padding: 0.25rem 0;
  text-align: left;
}

.search-results li {
  padding: 0.25rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-start;
}

.search-results li.controls {
  justify-content: flex-end;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 0.25rem;
  padding-bottom: 0.5rem;
}

.search-results li.controls button {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

.search-results li.controls button:hover {
  text-decoration: underline;
}

.search-results li label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.selected-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.selected-list .tag {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  margin: 0.25rem;
  cursor: pointer;
}

/* homepage builder component list */
.draggable-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.draggable-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  margin-bottom: 0.5rem;
}

/* new button variants */
.btn-success {
  background: var(--success);
  color: #fff;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity var(--transition);
}
.btn-success:hover {
  opacity: 0.9;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity var(--transition);
}
.btn-danger:hover {
  opacity: 0.9;
}

/* hide all submenus by default */
.nav-submenu {
  display: none;
  flex-direction: column;
}

/* when its parent has .open, show it */
.nav-section.open .nav-submenu {
  display: flex;
}

/* chevron rotation */
.nav-section.open .chevron {
  transform: rotate(90deg);
}

/* a little spacing/indent for submenu links */
.nav-submenu .nav-link {
  padding-left: 1.5rem; /* indent under parent */
}
/* Suggestions dropdown under title input */
.suggestions-list {
  top: calc(100% + 0.25rem);
  left: 0;
  width: 100%;
  min-width: 200px;
  z-index: 1000;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 300px;
  overflow-y: auto;
}
.suggestion-item {
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
}
.suggestion-item:last-child {
  border-bottom: none;
}
.suggestion-item:hover {
  background: var(--bg-hover);
}

/* Variant list in modal with scrolling */
.variant-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 60vh;
  overflow-y: auto;
}
.variant-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
}
.variant-item:last-child {
  border-bottom: none;
}
.variant-item:hover {
  background: var(--bg-hover);
}

/* Modal overlay */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  align-items: center;
  justify-content: center;
}
.modal.show {
  display: flex;
}
.modal-content {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: 0.5rem;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
}

/* Label preview 4"×2" */
.label-preview {
  width: 4in;
  height: 2in;
  border: 1px solid #000;
  box-sizing: border-box;
  font-size: 12px;
}

@media print {
  body * { visibility: hidden; }
  #label-preview, #label-preview * { visibility: visible; }
  #label-preview { position: absolute; top:0; left:0; }
}


.text-success {
  color: var(--success);
  font-weight: bold;
}

.text-danger {
  color: var(--danger);
  font-weight: bold;
}

.alert-danger {
  color: var(--danger) !important;
}

.error-text {
  color: var(--danger);
  font-weight: bold;
}

.badge {
  display: inline-block;
  padding: 0.25em 0.4em;
  font-size: 75%;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 0.25rem;
}

.order-card .badge {
  border: none !important;
  box-shadow: none;
  background-image: none;
}

/* Primary background helper */
.bg-primary {
  background-color: #0d6efd !important;
  color: #fff !important;
}

/* Primary background helper */
.bg-india {
  background-color: #028a00f8 !important;
  color: #ffffff !important;
}

.bg-international {
  background-color: #b70000 !important;
  color: #ffffff !important;
}


.bg-status {
  background-color: yellow !important;
  color: #000 !important;
}

/* simple loader spinner */
.loader {
  width: 40px;
  height: 40px;
  border: 4px solid #ccc;
  border-top-color: #333;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

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

/* simple vertical timeline */
.timeline {
  position: relative;
  margin-left: 1rem;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ccc;
}
.timeline-entry {
  position: relative;
  margin-left: 1.5rem;
  padding: 0.5rem 0;
}
.timeline-entry::before {
  content: '';
  position: absolute;
  left: -1.5rem;
  top: 0.6rem;
  width: 0.75rem;
  height: 0.75rem;
  background: var(--primary);
  border-radius: 50%;
}
.timeline-time {
  font-size: 0.85rem;
  color: #666;
}

/* simple tabs for pick orders */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.tabs button {
  border: none;
  background: var(--bg-hover);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
}
.tabs button.active {
  background: var(--primary);
  color: #fff;
}
.pickup-tab-content {
  display: none;
}
.pickup-tab-content.active {
  display: block;
}

/* keep search + tabs visible on scroll */
.sticky-controls {
  position: sticky;
  top: 3.5rem;
  background: var(--bg-card);
  padding: 0.5rem 1rem;
  box-shadow: var(--shadow-sm);
  z-index: 250;
}
.sticky-controls form {
  margin-bottom: 0.5rem;
}

.search-sort,
.date-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 0.25rem;
}

.status-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}
.status-filters label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: normal;
  cursor: pointer;          /* easier to tap on mobile */
}

/* enlarge touch target for status checkboxes */
.status-filters .status-filter {
  width: 1.25rem;
  height: 1.25rem;
}

.sort-select {
  margin-top: 0.25rem;
  max-width: 150px;
}

.pick-orders-container {
  padding-top: 0;
}

/* grid layout for analytics charts */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}
.chart-card {
  background: var(--chart-bg);
  border-radius: var(--radius);
  padding: 1rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.chart-card canvas {
  width: 100% !important;
  height: 240px !important;
}
.chart-stats {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

/* live indicator */
.live-indicator {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2ecc71;
  animation: live-blink 1s infinite;
}
@keyframes live-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
