:root {
  /* Nuggy Brand Colors - Correct Version */
  --primary-green: #006644; /* Deep forest green */
  --deep-forest: #1e5631; /* Darker green variant */
  --highlight-lime: #eeaf00; /* Yellow accent */
  --warm-cream: #fffdf6; /* Background color */
  --graphite-ink: #222222; /* Primary text */
  --graphite-70: rgba(34, 34, 34, 0.7);
  --graphite-20: rgba(34, 34, 34, 0.2);
  --graphite-10: rgba(34, 34, 34, 0.1);
  --primary-green-20: rgba(0, 102, 68, 0.2);
  --primary-green-10: rgba(0, 102, 68, 0.1);

  /* Legacy mappings */
  --color-primary: var(--primary-green);
  --color-deep-forest: var(--deep-forest);
  --color-highlight: var(--highlight-lime);
  --color-bg: var(--warm-cream);
  --color-text: var(--graphite-ink);
  --color-muted: var(--graphite-70);
  --color-light: var(--graphite-70);
  --color-border: var(--graphite-10);
  --color-success: var(--primary-green);
  --color-danger: #d32f2f; /* Material red for errors/warnings */

  /* Animation */
  --ease-out: cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.12);
}

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

body {
  font-family:
    "Urbanist",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  background-color: var(--warm-cream);
  color: var(--graphite-ink);
  line-height: 1.6;
  font-size: 16px;
  font-weight: 400;
}

.container {
  max-width: 1600px; /* Increased from 1200px */
  margin: 0 auto;
  padding: 0 20px;
}

/* Dashboard Layout */
body.dashboard-app {
  background-color: var(--warm-cream);
}

.dashboard-layout {
  display: flex;
  gap: 16px;
  width: 100%;
  margin: 0;
  padding: 0 20px 0 0;
  min-height: 100vh;
  box-sizing: border-box;
}

.dashboard-sidebar {
  width: 248px;
  min-width: 248px;
  flex: 0 0 248px;
  position: sticky;
  top: 0;
  align-self: stretch;
  height: 100vh;
  transition:
    width 0.28s var(--ease-out),
    flex-basis 0.28s var(--ease-out),
    min-width 0.28s var(--ease-out);
  z-index: 100;
}

.dashboard-sidebar-inner {
  height: 100%;
  min-height: 0;
  background: #ffffff;
  border: 1px solid rgba(34, 34, 34, 0.14);
  border-left: none;
  border-radius: 0 28px 28px 0;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.05);
  padding: 16px 10px 20px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  transition:
    border-radius 0.28s var(--ease-out),
    padding 0.28s var(--ease-out);
}

.dashboard-sidebar-toggle {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: #6b6b6b;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: color 0.2s var(--ease-out);
}

.dashboard-sidebar-toggle:hover {
  color: var(--primary-green);
}

.sidebar-toggle-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.sidebar-toggle-line {
  width: 14px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  display: block;
}

.sidebar-toggle-expanded,
.sidebar-toggle-collapsed {
  display: none;
}

.dashboard-sidebar-brand {
  padding: 44px 12px 0;
  transition: padding 0.28s var(--ease-out);
}

.dashboard-sidebar-logo {
  width: 128px;
  max-width: 100%;
  height: auto;
  transition: width 0.28s var(--ease-out);
}

.dashboard-sidebar-email {
  margin-top: 10px;
  color: #5f5f5f;
  font-family: "Urbanist", sans-serif;
  font-size: 16px;
  line-height: 1.2;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition:
    opacity 0.28s var(--ease-out),
    width 0.28s var(--ease-out),
    max-width 0.28s var(--ease-out);
}

.dashboard-sidebar-nav {
  margin-top: 42px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: margin-top 0.28s var(--ease-out);
}

.dashboard-sidebar-nav-item {
  display: flex;
  align-items: center;
  min-height: 50px;
  padding: 10px 14px;
  border-radius: 14px;
  color: #6a6a6a;
  text-decoration: none;
  font-family: "Urbanist", sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  transition:
    background-color 0.2s var(--ease-out),
    color 0.2s var(--ease-out),
    min-height 0.28s var(--ease-out),
    padding 0.28s var(--ease-out),
    width 0.28s var(--ease-out),
    border-radius 0.28s var(--ease-out);
}

.dashboard-sidebar-nav-item:hover {
  background: rgba(30, 86, 49, 0.08);
  color: #1e5631;
}

.dashboard-sidebar-nav-item.active {
  background: #c6cfcb;
  color: #1e5631;
}

.dashboard-sidebar-nav-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex-shrink: 0;
  opacity: 0.72;
}

.dashboard-sidebar-nav-item.active .dashboard-sidebar-nav-icon {
  opacity: 1;
}

.dashboard-sidebar-nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-left: 10px;
  transition:
    opacity 0.28s var(--ease-out),
    width 0.28s var(--ease-out),
    max-width 0.28s var(--ease-out),
    padding 0.28s var(--ease-out),
    margin 0.28s var(--ease-out);
}

.dashboard-sidebar-footer {
  margin-top: auto;
}

.dashboard-sidebar-time {
  text-align: center;
  color: #666666;
  font-family: "Urbanist", sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.1;
  transition:
    opacity 0.28s var(--ease-out),
    width 0.28s var(--ease-out),
    max-width 0.28s var(--ease-out);
}

.dashboard-main {
  flex: 1 1 auto;
  min-width: 0;
  padding: 12px 0;
  width: 100%;
  box-sizing: border-box;
}

/* Full width of main area (viewport minus sidebar) */
.dashboard-main .container {
  max-width: none;
  width: 100%;
}

body.dashboard-sidebar-collapsed .dashboard-sidebar {
  width: 88px;
  min-width: 88px;
  flex-basis: 88px;
}

body.dashboard-sidebar-collapsed .dashboard-sidebar-brand {
  padding: 44px 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

body.dashboard-sidebar-collapsed .dashboard-sidebar-logo {
  width: 56px;
}

body.dashboard-sidebar-collapsed .dashboard-sidebar-email,
body.dashboard-sidebar-collapsed .dashboard-sidebar-time,
body.dashboard-sidebar-collapsed .dashboard-sidebar-nav-label {
  opacity: 0;
  width: 0;
  max-width: 0;
  overflow: hidden;
  pointer-events: none;
  padding: 0;
  margin: 0;
}

body.dashboard-sidebar-collapsed .dashboard-sidebar-nav {
  margin-top: 34px;
  align-items: center;
}

body.dashboard-sidebar-collapsed .dashboard-sidebar-nav-item {
  width: 54px;
  min-height: 54px;
  border-radius: 14px;
  justify-content: center;
  padding: 0;
}

body.dashboard-sidebar-collapsed .dashboard-sidebar-toggle {
  left: 10px;
  right: auto;
}

body.dashboard-sidebar-collapsed .sidebar-toggle-icon {
  display: flex;
}

@media (max-width: 1320px) {
  .dashboard-layout {
    gap: 14px;
    padding: 0 14px 0 0;
  }

  .dashboard-sidebar {
    width: 220px;
    min-width: 220px;
    flex-basis: 220px;
  }

  .dashboard-sidebar-nav-item {
    font-size: 15px;
  }

  .dashboard-sidebar-time {
    font-size: 24px;
  }
}

/* Large viewports: fix sidebar to viewport left so it doesn't break on ultra-wide */
@media (min-width: 1681px) {
  .dashboard-layout {
    max-width: none;
    padding-left: 248px;
    padding-right: 20px;
  }

  .dashboard-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 248px;
    min-width: 248px;
    flex: none;
    height: 100vh;
  }

  body.dashboard-sidebar-collapsed .dashboard-layout {
    padding-left: 88px;
  }

  body.dashboard-sidebar-collapsed .dashboard-sidebar {
    width: 88px;
    min-width: 88px;
  }
}

@media (max-width: 1024px) {
  .dashboard-layout {
    flex-direction: column;
    min-height: auto;
    margin: 0 auto;
    padding: 8px 10px;
  }

  .dashboard-sidebar {
    width: 100%;
    flex-basis: auto;
    position: static;
    height: auto;
  }

  .dashboard-sidebar-inner {
    height: auto;
    border-radius: 18px;
    padding: 14px 10px 14px;
  }

  .dashboard-sidebar-brand {
    padding: 0 8px;
  }

  .dashboard-sidebar-logo {
    width: 120px;
  }

  .dashboard-sidebar-email {
    font-size: 14px;
  }

  .dashboard-sidebar-nav {
    margin-top: 16px;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }

  .dashboard-sidebar-nav-item {
    min-height: 46px;
    font-size: 14px;
    border-radius: 10px;
    flex: 1 1 calc(50% - 8px);
  }

  .dashboard-sidebar-time {
    text-align: left;
    font-size: 18px;
  }

  .dashboard-sidebar-toggle {
    display: none;
  }

  body.dashboard-sidebar-collapsed .dashboard-sidebar {
    width: 100%;
    flex-basis: auto;
  }

  body.dashboard-sidebar-collapsed .dashboard-sidebar-brand {
    align-items: flex-start;
    padding: 0 8px;
  }

  body.dashboard-sidebar-collapsed .dashboard-sidebar-logo {
    width: 120px;
  }

  body.dashboard-sidebar-collapsed .dashboard-sidebar-email,
  body.dashboard-sidebar-collapsed .dashboard-sidebar-time,
  body.dashboard-sidebar-collapsed .dashboard-sidebar-nav-label {
    opacity: 1;
    width: auto;
    max-width: none;
    pointer-events: auto;
  }

  body.dashboard-sidebar-collapsed .dashboard-sidebar-nav {
    margin-top: 16px;
    align-items: stretch;
  }

  body.dashboard-sidebar-collapsed .dashboard-sidebar-nav-item {
    width: auto;
    min-height: 46px;
    justify-content: flex-start;
    padding: 10px 12px;
  }
}

/* Main Content */
.main-content {
  padding: 24px 0; /* Using 8px grid: 3 * 8 = 24px */
}

.dashboard-header {
  margin-bottom: 2rem;
}

h1 {
  font-family: "Zalando Sans SemiExpanded", sans-serif;
  line-height: 1.2;
  font-size: 48px;
  font-weight: 900;
}

h2,
h3,
h4,
h5,
h6 {
  font-family: "Urbanist", sans-serif;
  line-height: 1.2;
}

h2 {
  font-size: 32px;
  font-weight: 800;
}

h3 {
  font-size: 24px;
  font-weight: 700;
}

h4 {
  font-size: 20px;
  font-weight: 700;
}

h5 {
  font-size: 16px;
  font-weight: 700;
}

h6 {
  font-size: 14px;
  font-weight: 700;
}

.dashboard-header h1 {
  color: var(--color-primary);
}

.dashboard-header h2 {
  font-family: "Zalando Sans SemiExpanded", sans-serif;
  font-size: 32px;
  font-weight: 800;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}

.text-muted {
  font-family: "Urbanist", sans-serif;
  font-size: 16px;
  color: var(--color-muted);
  line-height: 1.6;
}

caption,
small,
.caption {
  font-family: "Urbanist", sans-serif;
  font-size: 13px;
  color: var(--color-muted);
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.metric-card {
  background: linear-gradient(145deg, #ffffff 0%, #fafbf9 100%);
  padding: 1.5rem 1.75rem;
  border-radius: 12px;
  border: 1px solid rgba(0, 102, 68, 0.08);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.04),
    0 1px 2px rgba(0, 0, 0, 0.02);
  transition: all 0.25s var(--ease-out);
  animation: fadeInScale 0.4s var(--ease-out) backwards;
}

.metric-card:nth-child(1) {
  animation-delay: 0.05s;
  border-left: 3px solid var(--primary-green);
}
.metric-card:nth-child(2) {
  animation-delay: 0.1s;
  border-left: 3px solid rgba(232, 163, 13, 0.5);
}
.metric-card:nth-child(3) {
  animation-delay: 0.15s;
  border-left: 3px solid rgba(0, 102, 68, 0.5);
}
.metric-card:nth-child(4) {
  animation-delay: 0.2s;
  border-left: 3px solid rgba(13, 31, 232, 0.5);
}

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

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 24px rgba(0, 102, 68, 0.08),
    0 2px 6px rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 102, 68, 0.15);
}

.metric-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.metric-header h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--graphite-70);
}

.metric-period {
  font-size: 0.6875rem;
  color: var(--graphite-70);
  opacity: 0.8;
}

.metric-value {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.metric-number {
  font-family: "Urbanist", sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary-green);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.metric-change {
  font-size: 0.875rem;
  font-weight: 500;
}

.metric-change.positive {
  color: var(--color-success);
}

.metric-change.negative {
  color: var(--color-danger);
}

.metric-subtitle {
  font-size: 0.8125rem;
  color: var(--color-muted);
  margin-left: 0.25rem;
}

/* Inventory Gauge */
.inventory-gauge {
  width: 100%;
  height: 8px;
  background-color: var(--color-border);
  border-radius: 4px;
  overflow: hidden;
  margin: 0.5rem 0;
}

.gauge-fill {
  height: 100%;
  background-color: var(--color-accent);
  transition: width 0.3s ease;
}

/* Competitor Pricing */
.competitor-pricing-section {
  background: white;
  padding: 24px; /* Using 8px grid: 3 * 8 = 24px */
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  margin-bottom: 24px; /* Using 8px grid: 3 * 8 = 24px */
  transition: all 0.3s var(--ease-out);
}

.competitor-pricing-section h3 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--color-deep-forest);
}

.competitor-feed {
  max-height: 300px;
  overflow-y: auto;
}

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

.quote-product {
  font-weight: 500;
}

.quote-price {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-primary);
  font-family: "IBM Plex Mono", monospace;
}

.quote-time {
  font-size: 0.875rem;
  color: var(--color-light);
}

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

.data-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.data-table td:first-child {
  vertical-align: middle;
}

.price-current {
  font-weight: 600;
  color: var(--color-primary);
  font-family: "IBM Plex Mono", monospace;
}

.margin {
  font-weight: 500;
}

.margin.positive {
  color: var(--color-success);
}

.inventory-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.025em;
}

.inventory-badge.ok {
  background-color: var(--primary-green-10);
  color: var(--primary-green);
}

.inventory-badge.low {
  background-color: rgba(211, 47, 47, 0.1);
  color: var(--color-danger);
}

/* Buttons */
.btn {
  font-family: "Urbanist", sans-serif;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--primary-green);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 102, 68, 0.3);
  background: var(--deep-forest);
}

.btn-outline {
  background: transparent;
  color: var(--primary-green); /* Keep text green by default */
  border: 2px solid var(--graphite-10); /* Gray outline by default */
  box-shadow: none; /* No shadow by default */
}

.btn-outline:hover {
  background: var(--primary-green-10);
  border-color: var(--graphite-70); /* Darker gray on hover */
  color: var(--deep-forest);
  transform: translateY(-2px); /* Lift effect */
  box-shadow: var(--shadow-md); /* Add shadow on hover */
}

/* Specific styling for dispensary buttons */
.dispensary-button-item.active {
  border-color: var(--primary-green); /* Green outline for active */
  box-shadow: 0 0 0 2px var(--primary-green-20); /* Subtle glow */
}

.dispensary-button-item.active:hover {
    border-color: var(--deep-forest); /* Darker green on hover for active */
    box-shadow: 0 4px 12px rgba(0, 102, 68, 0.3); /* Stronger shadow for active on hover */
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 14px;
}

/* Sections */
#dashboard,
#rules {
  display: none;
}

#dashboard.active,
#rules.active {
  display: block;
}

.section-header {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 2rem;
  gap: 2rem;
}

.section-header h2 {
  font-size: 32px;
  font-weight: 800;
  color: var(--color-primary);
  margin: 0;
  animation: fadeInUp 0.5s var(--ease-out);
}

.section-header h3 {
  font-size: 26px;
  font-weight: 800;
  color: var(--color-primary);
  margin: 0;
  animation: fadeInUp 0.5s var(--ease-out);
}

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

/* Rules Grid */
.rules-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.rule-card {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--color-border);
}

.rule-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.rule-header h4 {
  margin: 0;
  color: var(--color-primary);
}

.rule-status {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.025em;
}

.rule-status.active {
  background-color: var(--primary-green-10);
  color: var(--primary-green);
}

.rule-status.inactive {
  background-color: var(--graphite-10);
  color: var(--color-muted);
}

.rule-content p {
  margin: 0.5rem 0;
  font-size: 0.875rem;
}

.rule-content p strong {
  color: var(--color-text);
}

/* Filter Controls */
.filter-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.filter-select {
  padding: 0.5rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background-color: white;
  font-size: 0.875rem;
}

.search-input {
  padding: 0.5rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background-color: white;
  font-size: 0.875rem;
  width: 250px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 24px; /* Using 8px grid: 3 * 8 = 24px */
  color: var(--color-muted);
  font-style: italic;
}

/* Recommendations Section */
.recommendations-section {
  background: white;
  padding: 24px; /* Using 8px grid: 3 * 8 = 24px */
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  margin-bottom: 24px; /* Using 8px grid: 3 * 8 = 24px */
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.recommendations-section h3 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--color-deep-forest);
}

.recommendations-section td small {
  color: var(--color-muted);
  font-size: 0.75rem;
}

.recommendations-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
  margin-top: 8px;
  border-top: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.pagination-summary {
  color: var(--color-muted);
  font-size: 0.875rem;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pagination-btn {
  border: 1px solid var(--color-border);
  background: white;
  color: var(--color-primary);
  border-radius: 6px;
  min-width: 36px;
  height: 32px;
  padding: 0 10px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--primary-green-10);
  border-color: var(--primary-green);
}

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

.pagination-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.price-suggestion {
  color: var(--color-accent);
  font-weight: 600;
}

.impact-negative {
  color: #d32f2f;
  font-weight: 600;
}

.impact-positive {
  color: var(--color-success);
}

.impact-neutral {
  color: var(--color-muted);
}

/* Enterprise recommendations table: blocky grid + alternating rows */
.recommendations-table-wrap {
  width: 100%;
  overflow: hidden;
}

#recommendations-table.table,
#pricing-table.table,
.recommendations-section .data-table {
  width: 100%;
  font-size: 0.9375rem;
  border-collapse: collapse;
  border: 1px solid var(--color-border);
  table-layout: fixed;
}

#pricing-table.table thead tr {
  background: rgba(0, 0, 0, 0.04);
}

#pricing-table.table th.table-head {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
  padding: 14px 1rem;
  border: 1px solid var(--color-border);
  border-top: none;
  border-bottom-width: 2px;
  vertical-align: middle;
}

#pricing-table.table th.table-head:first-child {
  border-left: none;
}

#pricing-table.table th.table-head:last-child {
  border-right: none;
}

`@media` (max-width: 1100px) {
  `#pricing-table.table` th.table-head {
    white-space: normal;
    overflow-wrap: break-word;
    line-height: 1.3;
    padding: 10px 0.5rem;
    min-width: 0;
  }
}

#pricing-table.table tbody tr:nth-child(odd) {
  background: #fff;
}

#pricing-table.table tbody tr:nth-child(even) {
  background: #f8f9fa;
}

#pricing-table.table .table-cell {
  padding: 14px 1rem;
  border: 1px solid var(--color-border);
  border-top: none;
  vertical-align: middle;
}

#pricing-table.table .table-cell:first-child {
  border-left: none;
}

#pricing-table.table .table-cell:last-child {
  border-right: none;
}

#pricing-table.table .table-cell--num {
  text-align: left;
}

/* Column widths: headers fit first (wrap), then Product gets most space */
#recommendations-table.table th.table-head:nth-child(1),
#recommendations-table.table .table-cell:nth-child(1) {
  width: 15%;
}
#recommendations-table.table th.table-head:nth-child(2),
#recommendations-table.table th.table-head:nth-child(3),
#recommendations-table.table th.table-head:nth-child(4),
#recommendations-table.table th.table-head:nth-child(5),
#recommendations-table.table th.table-head:nth-child(6),
#recommendations-table.table th.table-head:nth-child(7),
#recommendations-table.table .table-cell:nth-child(2),
#recommendations-table.table .table-cell:nth-child(3),
#recommendations-table.table .table-cell:nth-child(4),
#recommendations-table.table .table-cell:nth-child(5),
#recommendations-table.table .table-cell:nth-child(6),
#recommendations-table.table .table-cell:nth-child(7),
#recommendations-table.table th.table-head:nth-child(8),
#recommendations-table.table td.recommendations-actions {
  width: 10%;
}

#recommendations-table.table thead tr {
  background: rgba(0, 0, 0, 0.04);
}

.table-head,
#recommendations-table th.table-head {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
  padding: 14px 1rem;
  border: 1px solid var(--color-border);
  border-top: none;
  border-bottom-width: 2px;
  vertical-align: middle;
}

/* Front page: headers always wrap so they fit in the column first */
#recommendations-table.table th.table-head {
  white-space: normal;
  word-break: break-word;
  line-height: 1.3;
  min-width: 0;
}

#recommendations-table.table th.table-head:first-child {
  border-left: none;
}

#recommendations-table.table th.table-head:last-child {
  border-right: none;
}

@media (max-width: 1100px) {
  #recommendations-table.table th.table-head {
    padding: 10px 0.5rem;
  }
}

/* Alternating row colors */
#recommendations-table.table tbody tr:nth-child(odd) {
  background: #fff;
}

#recommendations-table.table tbody tr:nth-child(even) {
  background: #f8f9fa;
}

#recommendations-table .table-cell {
  padding: 14px 1rem;
  border: 1px solid var(--color-border);
  border-top: none;
  vertical-align: middle;
}

#recommendations-table.table .table-cell:first-child {
  border-left: none;
}

#recommendations-table.table .table-cell:last-child {
  border-right: none;
}

#recommendations-table .table-cell--product {
  text-align: left;
}

.rec-product-name {
  font-weight: 600;
  color: var(--color-text);
}

.rec-product-meta {
  font-size: 0.8125rem;
  color: var(--color-muted);
  margin-top: 2px;
}

#recommendations-table .table-cell--num,
#recommendations-table .table-cell--profit {
  text-align: left;
}

#recommendations-table td.recommendations-actions {
  text-align: left;
}

.delta-pill {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-right: 8px;
}

.delta-pill--down {
  background: rgba(40, 167, 69, 0.12);
  color: #1e7e34;
}

.delta-pill--up {
  background: rgba(253, 126, 20, 0.15);
  color: #e65100;
}

.delta-pill--neutral {
  background: rgba(0, 0, 0, 0.06);
  color: var(--color-muted);
}

.rec-suggested-price {
  font-weight: 600;
  color: var(--color-text);
}

.table-cell--profit-positive {
  background: #e8f5e9;
  color: #1b5e20;
  font-weight: 600;
}

.table-cell--profit-negative {
  background: #ffebee;
  color: #b71c1c;
  font-weight: 600;
}

.table-cell--profit-neutral {
  background: #fff8e1;
  color: #e65100;
  font-weight: 600;
}

/* Units Sold column tint (same as profit) */
.table-cell--units-positive {
  background: #e8f5e9;
  color: #1b5e20;
  font-weight: 600;
}

.table-cell--units-negative {
  background: #ffebee;
  color: #b71c1c;
  font-weight: 600;
}

.table-cell--units-neutral {
  background: #fff8e1;
  color: #e65100;
  font-weight: 600;
}

#recommendations-table .table-cell--units {
  text-align: left;
  vertical-align: middle;
}

/* Action buttons: tick and cross */
.action-buttons {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-start;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    opacity 0.15s ease;
}

.action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.action-btn--approve {
  background-color: #28a745;
  color: white;
}

.action-btn--approve:hover:not(:disabled) {
  background-color: #218838;
}

.action-btn--deny {
  background-color: #dc3545;
  color: white;
}

.action-btn--deny:hover:not(:disabled) {
  background-color: #c82333;
}

.action-btn svg {
  flex-shrink: 0;
}

.price-direction {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  margin-right: 0.5rem;
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.025em;
}

.price-up {
  background-color: var(--color-highlight);
  color: var(--color-deep-forest);
}

.price-down {
  background-color: var(--primary-green-10);
  color: var(--primary-green);
}

/* Chart Section */
.chart-section {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--color-border);
  margin-bottom: 2rem;
}

.chart-section h3 {
  margin-bottom: 1rem;
  color: var(--color-primary);
}

.chart-container {
  height: 300px;
  position: relative;
}

/* Summary Grid */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.summary-card {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--color-border);
  text-align: center;
}

.summary-card h4 {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-muted);
  margin-bottom: 0.75rem;
}

.summary-product {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}

.summary-metric {
  font-size: 0.875rem;
  color: var(--color-muted);
}

/* Products Table Wrapper */
.products-table-wrapper {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--color-border);
  overflow-x: auto;
}

/* Status Badges */
.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.025em;
}

.status-badge.optimal {
  background-color: var(--primary-green-10);
  color: var(--primary-green);
}

.status-badge.warning {
  background-color: rgba(211, 47, 47, 0.1);
  color: var(--color-danger);
}

/* Help Tooltips */
.help-tooltip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-left: 8px;
  background-color: var(--primary-green-10);
  color: var(--primary-green);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  cursor: help;
  transition: all 0.3s var(--ease-out);
  position: relative;
}

.help-tooltip:hover {
  background-color: var(--highlight-lime);
  color: var(--deep-forest);
  transform: scale(1.1);
}

/* Tooltip content */
.help-tooltip::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  padding: 10px 14px;
  background-color: rgba(0, 0, 0, 0.9);
  color: white;
  font-size: 12px;
  font-weight: normal;
  white-space: normal;
  width: 250px;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 1000;
  line-height: 1.4;
  text-align: left;
}

/* Adjust tooltip position for table headers */
.data-table th .help-tooltip::after {
  bottom: auto;
  top: 100%;
  margin-bottom: 0;
  margin-top: 8px;
}

.data-table th .help-tooltip::before {
  bottom: auto;
  top: 100%;
  margin-bottom: 0;
  margin-top: -5px;
  border-top-color: transparent;
  border-bottom-color: rgba(0, 0, 0, 0.9);
}

.help-tooltip:hover::after {
  opacity: 1;
}

/* Arrow for tooltip */
.help-tooltip::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: -5px;
  border: 5px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.9);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 1001;
}

.help-tooltip:hover::before {
  opacity: 1;
}

h3 {
  display: inline-flex;
  align-items: center;
}

.data-table th {
  text-align: left;
  padding: 0.75rem;
  font-weight: 500;
  color: var(--color-muted);
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
  vertical-align: middle;
  line-height: 1.4;
}

.data-table th .help-tooltip {
  display: inline-flex;
  vertical-align: middle;
  margin-left: 4px;
  margin-top: 0;
}

/* Sortable column styles */
.data-table th.sortable {
  position: relative;
  cursor: default;
}

.data-table th.sortable .sort-indicator {
  display: inline-block;
  margin-left: 6px;
  font-size: 1em;
  font-weight: 600;
  color: var(--color-text);
  opacity: 0.85;
  transition: all 0.2s var(--ease-out);
  vertical-align: middle;
  cursor: pointer;
  user-select: none;
  padding: 3px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.06);
}

.data-table th.sortable .sort-indicator:hover {
  opacity: 1;
  background-color: var(--primary-green-10);
}

.data-table th.sortable .sort-indicator:active {
  background-color: var(--primary-green-20);
}

/* Competitor pricing styling */
.competitor-item {
  display: grid;
  grid-template-columns: 2fr 1.5fr 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem;
  border-bottom: 1px solid var(--color-border);
  transition: background-color 0.2s ease;
}

/* Price trend indicators */
.price-trend {
  font-size: 0.8rem;
  margin-left: 0.5rem;
  font-weight: bold;
}

.price-trend.trend-up {
  color: var(--color-danger);
}

.price-trend.trend-down {
  color: var(--color-success);
}

.price-trend.trend-stable {
  color: var(--color-muted);
}

.competitor-item:hover {
  background-color: rgba(0, 102, 68, 0.02);
}

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

.competitor-product {
  font-weight: 500;
}

.competitor-store {
  font-size: 0.875rem;
  color: var(--color-muted);
}

.competitor-price {
  font-size: 1.125rem;
  font-weight: 600;
  font-family: "IBM Plex Mono", monospace;
  text-align: right;
}

.competitor-price.higher {
  color: var(--color-danger);
}

.competitor-price.lower {
  color: var(--color-success);
}

.competitor-price.same {
  color: var(--color-primary);
}

.price-diff {
  font-size: 0.75rem;
  font-weight: normal;
  margin-left: 0.25rem;
}

.competitor-time {
  font-size: 0.875rem;
  color: var(--color-light);
  text-align: right;
}

/* Product Links */
.product-link {
  color: var(--color-deep-forest);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s var(--ease-out);
  border-bottom: 2px solid transparent;
}

.product-link:hover {
  color: var(--color-primary);
  border-bottom-color: var(--color-highlight);
}

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

::-webkit-scrollbar-track {
  background: var(--color-border);
}

::-webkit-scrollbar-thumb {
  background: var(--color-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-muted);
}

/* Popup Modal Styles */
.popup-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s var(--ease-out);
}

.popup-modal.show {
  display: block;
}

.popup-content {
  position: relative;
  background-color: white;
  margin: 5% auto;
  padding: 0;
  width: 90%;
  max-width: 600px;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.3s var(--ease-out);
}

.popup-close {
  position: absolute;
  right: 20px;
  top: 20px;
  font-size: 28px;
  font-weight: 500;
  color: var(--color-light);
  cursor: pointer;
  transition: color 0.2s;
  z-index: 10;
}

.popup-close:hover {
  color: var(--color-text);
}

#popup-body {
  padding: 40px 30px 30px;
}

/* Popup specific styles */
.popup-header {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--color-border);
}

.popup-header h3 {
  font-family: "Urbanist", sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-green);
  margin-bottom: 5px;
}

.popup-header p {
  color: var(--color-muted);
  font-size: 0.95rem;
}

.popup-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

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

.form-group label {
  font-weight: 600;
  color: var(--color-text);
  font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-green);
}

.popup-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
}

.popup-actions .btn {
  min-width: 100px;
}

/* Notification Toast Styles */
.notification-toast {
  position: fixed;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  padding: 16px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: top 0.3s var(--ease-out);
  z-index: 2000;
}

.notification-toast.show {
  top: 30px;
}

.notification-toast.success {
  border-left: 4px solid var(--primary-green);
}

.notification-toast.error {
  border-left: 4px solid var(--color-danger);
}

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

.notification-toast.success .notification-icon::before {
  content: "✓";
  color: var(--primary-green);
}

.notification-toast.error .notification-icon::before {
  content: "✗";
  color: var(--color-danger);
}

.notification-message {
  font-weight: 500;
  color: var(--color-text);
}

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

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

/* Rule card improvements */
.rule-card {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0;
  transition: all 0.2s var(--ease-out);
  cursor: pointer;
  position: relative;
  margin-bottom: 2px;
}

.rule-card:hover {
  background: var(--warm-cream);
}

.rule-card.disabled {
  opacity: 0.6;
}

.rule-card.disabled .rule-name {
  text-decoration: line-through;
}

/* SortableJS styles */
.rule-card.dragging {
  opacity: 0.5;
  transform: scale(0.98);
}

/* Spotify-style rule row */
.rule-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 16px;
  min-height: 64px;
}

.rank-number {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.875rem;
  color: var(--color-muted);
  font-weight: 500;
  min-width: 24px;
  text-align: center;
}

.rule-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.rule-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: rgba(34, 34, 34, 0.72);
}

.rule-icon .rule-type-icon,
.rule-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.rule-icon--popup {
  width: 32px;
  height: 32px;
}

.rule-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.rule-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rule-description-compact {
  font-size: 0.875rem;
  color: var(--color-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rule-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.drag-handle {
  cursor: grab;
  padding: 8px 6px;
}

.partner-dispensary-buttons {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.dispensary-button {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 300px;
}

.dispensary-button img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.dispensary-button div {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.dispensary-button .dispensary-name {
  font-weight: 600;
}

.dispensary-button .dispensary-address {
  font-size: 0.8rem;
  color: var(--color-muted);
}


.drag-handle span {
  display: block;
  width: 16px;
  height: 2px;
  background-color: var(--color-muted);
  border-radius: 1px;
  transition: all 0.2s var(--ease-out);
}

.rule-card:hover .drag-handle {
  opacity: 0.7;
}

.rule-card:hover .drag-handle span {
  background-color: var(--color-text);
}

.drag-handle:hover {
  opacity: 1;
}

.drag-handle:hover span {
  background-color: var(--primary-green);
  width: 18px;
}

.drag-handle:active {
  cursor: grabbing;
  opacity: 1;
}

.drag-handle:active span {
  background-color: var(--primary-green);
}

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

.rule-toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

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

.rule-toggle .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--color-border);
  transition: 0.3s;
  border-radius: 24px;
}

.rule-toggle .slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.rule-toggle input:checked + .slider {
  background-color: var(--primary-green);
}

.rule-toggle input:checked + .slider:before {
  transform: translateX(24px);
}

/* Styles for competitor Dashboard */

.top-section {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.top-section > * {
  flex: 1;
}

#map {
  height: 400px;
  margin-bottom: 0;
}

.chart-container {
  height: 400px;
}

/* Mapbox overlay styles */
.map-overlay {
  display: none;
  font: 12px/20px sans-serif;
  padding: 10px;
  position: absolute;
  right: 0;
  top: 0;
  width: 230px;
  overflow: hidden;
  white-space: nowrap;
}

.map-overlay-inner {
  background: #ffffff;
  padding: 10px;
  border-radius: 3px;
}

.searchable-select {
  position: relative;
  display: inline-block;
  width: 250px;
}

.searchable-select input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background-color: white;
  font-size: 0.875rem;
  margin-bottom: 4px;
}

.searchable-select select {
  width: 100%;
  box-sizing: border-box;
}

/* Custom style for the dispensary map search */
#dispensary-search {
  background-color: #f8f9fa; /* A slightly off-white background */
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.map-container .section-header h3 {
  margin: 0;
}

#stats-content {
  border: 1px solid var(--color-border);
  border-radius: 12px; /* Consistent with main table wrapper */
  margin-top: -1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); /* Consistent with main table wrapper */
}

.products-table-wrapper-mini {
  max-height: 18.78rem;
  overflow-y: auto;
}

#selected-dispensary-products-table {
  width: 100%;
  border-collapse: collapse;
}

#selected-dispensary-products-table th,
#selected-dispensary-products-table td {
  padding: 0.75rem 1.5rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

#selected-dispensary-products-table thead {
  position: sticky;
  top: 0;
  z-index: 10; /* Ensure the entire header is above scrolling content */
}

#selected-dispensary-products-table th {
  font-weight: 500;
  font-size: 0.875rem; /* Adjusted for consistency */
  color: var(--color-muted);
  border-bottom: 2px solid var(--color-border); /* Consistent with main table */
  background-color: white;
}

#dispensary-icon-large {
  margin-left: 1rem;
  height: 69px;
  width: auto;
  min-width: 34.5px;
  max-width: 138px;
}

#dispensary-icon-small {
  margin-left: 0.1rem;
  height: 50px;
  width: auto;
  min-width: 25px;
  max-width: 100px;
  object-fit: contain;
}

#dispensary-address-small {
  font-family: "Urbanist", sans-serif;
  line-height: 1.2;
  font-size: 10px;
  font-weight: normal;
}

.dispensary-details {
  display: flex;
  align-items: center;
  gap: 1rem; /* Adds some space between the icon and the text */
  margin-top: 1rem;
}
