: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);
  --surface-white: rgba(255, 255, 255, 0.88);
  --surface-quiet: rgba(255, 255, 255, 0.72);
  --surface-tint: rgba(255, 253, 246, 0.84);
  --border-soft: rgba(34, 34, 34, 0.08);
  --border-strong: rgba(34, 34, 34, 0.14);
  --focus-ring: 0 0 0 3px rgba(0, 102, 68, 0.08);

  /* 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;
}

[hidden] {
  display: none !important;
}

/*
 * No horizontal page scroll: clip at the root, avoid 100vw (scrollbar gutter),
 * and contain the dashboard shell. Inner regions (tables) may use overflow-x: auto.
 */
html {
  overflow-x: clip;
  max-width: 100%;
  scrollbar-gutter: stable;
}

body {
  overflow-x: clip;
  max-width: 100%;
  font-family:
    Urbanist,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  background:
    radial-gradient(circle at top left, rgba(0, 102, 68, 0.05), transparent 30%),
    radial-gradient(circle at top right, rgba(238, 175, 0, 0.06), transparent 28%),
    linear-gradient(180deg, #fffdf6 0%, #faf7ef 100%);
  color: var(--graphite-ink);
  line-height: 1.6;
  font-size: 16px;
  font-weight: 400;
}

.container {
  max-width: min(1600px, 100%);
  margin: 0 auto;
  padding: 0 20px;
  box-sizing: border-box;
}

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

body.dashboard-app.dashboard-auth-pending,
body.dashboard-app.dashboard-auth-error {
  overflow: hidden;
}

body.dashboard-app.dashboard-auth-pending .dashboard-layout,
body.dashboard-app.dashboard-auth-error .dashboard-layout {
  visibility: hidden;
}

body.dashboard-app.dashboard-auth-pending::before,
body.dashboard-app.dashboard-auth-error::before {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--warm-cream);
  color: var(--graphite-ink);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.01em;
  z-index: 4000;
}

body.dashboard-app.dashboard-auth-pending::before {
  content: "Checking session...";
}

body.dashboard-app.dashboard-auth-error::before {
  content: "Authentication is unavailable. Reload and try again.";
}

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

.dashboard-sidebar {
  width: 248px;
  min-width: 248px;
  flex: 0 0 248px;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  transition:
    width 0.28s var(--ease-out),
    flex-basis 0.28s var(--ease-out),
    min-width 0.28s var(--ease-out);
  /* Above .dashboard-main stacking (in-page dropdowns, sticky regions); below .popup-modal */
  z-index: 500;
}

.dashboard-sidebar-inner {
  height: 100%;
  min-height: 0;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.98) 0%,
    rgba(255, 253, 246, 0.98) 100%
  );
  border: 1px solid rgba(34, 34, 34, 0.14);
  border-left: none;
  border-radius: 0;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.04);
  padding: 14px 8px 16px;
  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 8px 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: 32px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: margin-top 0.28s var(--ease-out);
}

.dashboard-sidebar-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 8px 10px;
  border-radius: 14px;
  color: rgba(30, 86, 49, 0.78);
  text-decoration: none;
  font-family: Urbanist, sans-serif;
  font-size: 16px;
  font-weight: 600;
  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(0, 102, 68, 0.05);
  color: var(--deep-forest);
}

.dashboard-sidebar-nav-item.active {
  background: rgba(0, 102, 68, 0.08);
  color: var(--primary-green);
}

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

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

.dashboard-sidebar-nav-icon--mask {
  display: block;
  background-color: currentcolor;
  -webkit-mask: var(--dashboard-sidebar-nav-icon-url) center / contain no-repeat;
  mask: var(--dashboard-sidebar-nav-icon-url) center / contain no-repeat;
}

.dashboard-sidebar-nav-label {
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-left: 6px;
  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-nav-group {
  --nav-accent: var(--primary-green);
  --nav-accent-soft: rgba(0, 102, 68, 0.16);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dashboard-sidebar-nav-group[data-nav-group="competitor-analytics"] {
  --nav-accent: #cf9700;
  --nav-accent-soft: rgba(238, 175, 0, 0.2);
}

.dashboard-sidebar-nav-group--no-heading-icon
  .dashboard-sidebar-nav-group-toggle
  .dashboard-sidebar-nav-label {
  padding-left: 0;
}

.dashboard-sidebar-nav-group--no-heading-icon .dashboard-sidebar-nav-group-toggle {
  gap: 8px;
}

/* Section markers: small solid squares (Your Store = forest green, The Market = gold) */
.dashboard-sidebar-nav-square-dot {
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  border-radius: 1px;
}

.dashboard-sidebar-nav-square-dot--store {
  background: var(--deep-forest);
}

.dashboard-sidebar-nav-square-dot--market {
  background: #cf9700;
}

.dashboard-sidebar-nav-group-toggle {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 8px 10px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: rgba(30, 86, 49, 0.86);
  font-family: Urbanist, sans-serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
  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-group-toggle:hover {
  background: rgba(0, 102, 68, 0.04);
  color: var(--deep-forest);
}

.dashboard-sidebar-nav-group-toggle:focus-visible {
  outline: 2px solid rgba(30, 86, 49, 0.45);
  outline-offset: 2px;
}

.dashboard-sidebar-nav-group-toggle--active,
.dashboard-sidebar-nav-group--has-active
  .dashboard-sidebar-nav-group-toggle:not(:hover) {
  color: var(--deep-forest);
}

.dashboard-sidebar-nav-group-toggle .dashboard-sidebar-nav-label {
  flex: 1 1 auto;
  min-width: 0;
}

.dashboard-sidebar-nav-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 6px;
  color: #8a8a8a;
  transition: transform 0.2s var(--ease-out);
}

.dashboard-sidebar-nav-chevron-svg {
  width: 16px;
  height: 16px;
}

.dashboard-sidebar-nav-group--open .dashboard-sidebar-nav-chevron {
  transform: rotate(180deg);
}

.dashboard-sidebar-nav-icon--svg {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.72;
}

.dashboard-sidebar-nav-icon--svg svg {
  width: 18px;
  height: 18px;
}

.dashboard-sidebar-nav-item.active .dashboard-sidebar-nav-icon--svg,
.dashboard-sidebar-nav-group-toggle--active .dashboard-sidebar-nav-icon--svg,
.dashboard-sidebar-nav-group-toggle:hover .dashboard-sidebar-nav-icon--svg {
  opacity: 1;
}

.dashboard-sidebar-nav-group-children {
  position: relative;
  display: none;
  flex-direction: column;
  gap: 4px;
  margin-left: 6px;
  padding: 2px 0 2px 6px;
}

.dashboard-sidebar-nav-group--open > .dashboard-sidebar-nav-group-children {
  display: flex;
}

.dashboard-sidebar-nav-item--nested {
  position: relative;
  min-height: 44px;
  padding-left: 8px;
  color: var(--graphite-70);
}

/* Keep active nested color aligned with top-level .active (nested rule sits later in the sheet) */
.dashboard-sidebar-nav-item--nested.active {
  color: var(--primary-green);
}

.dashboard-sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.dashboard-sidebar-notification {
  position: relative;
  padding: 14px 16px 16px;
  border: 1px solid rgba(30, 86, 49, 0.65);
  border-radius: 20px;
  background: #edf5ef;
  box-shadow: 0 8px 20px rgba(30, 86, 49, 0.08);
  color: var(--color-text);
}

.dashboard-sidebar-notification-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.dashboard-sidebar-notification-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-green);
  color: white;
  font-family: Urbanist, sans-serif;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
}

.dashboard-sidebar-notification-dismiss {
  border: 0;
  background: transparent;
  color: var(--color-muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.dashboard-sidebar-notification-dismiss:hover {
  color: var(--color-text);
}

.dashboard-sidebar-notification-dismiss:disabled {
  opacity: 0.5;
  cursor: default;
}

.dashboard-sidebar-notification-title {
  margin: 0 0 10px;
  color: var(--color-primary);
  font-family: Urbanist, sans-serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
}

.dashboard-sidebar-notification-list {
  margin: 0 0 14px 18px;
  padding: 0;
  color: var(--color-muted);
  font-family: Urbanist, sans-serif;
  font-size: 12px;
  line-height: 1.45;
}

.dashboard-sidebar-notification-list li + li {
  margin-top: 4px;
}

.dashboard-sidebar-notification-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

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

/* 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-nav-label {
  opacity: 0;
  width: 0;
  max-width: 0;
  overflow: hidden;
  pointer-events: none;
  padding: 0;
  margin: 0;
  flex: 0 0 0;
  min-width: 0;
}

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

/* Rail tooltips use ::after extending past the strip. Any scroll container with overflow-y: auto
   forces overflow-x away from visible, which clips those popovers. Collapsed nav fits the
   viewport height; allow overflow so labels can paint over the main column. */
body.dashboard-sidebar-collapsed .dashboard-sidebar-inner {
  overflow: visible;
}

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

body.dashboard-sidebar-collapsed .dashboard-sidebar-nav-item::after {
  content: attr(data-sidebar-nav-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  z-index: 1200;
  width: max-content;
  max-width: 220px;
  padding: 8px 10px;
  border: 1px solid rgba(34, 34, 34, 0.12);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.14);
  color: var(--graphite-ink);
  font-family: Urbanist, sans-serif;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  transition:
    opacity 0.14s var(--ease-out),
    transform 0.14s var(--ease-out);
}

body.dashboard-sidebar-collapsed .dashboard-sidebar-nav-item:hover::after,
body.dashboard-sidebar-collapsed .dashboard-sidebar-nav-item:focus-visible::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

body.dashboard-sidebar-collapsed .dashboard-sidebar-nav-item .dashboard-sidebar-nav-icon,
body.dashboard-sidebar-collapsed .dashboard-sidebar-nav-item .dashboard-sidebar-nav-icon--svg {
  opacity: 1;
  flex-shrink: 0;
}

body.dashboard-sidebar-collapsed .dashboard-sidebar-nav-item .dashboard-sidebar-nav-icon--svg svg {
  display: block;
}

body.dashboard-sidebar-collapsed .dashboard-sidebar-nav-chevron {
  display: none;
}

body.dashboard-sidebar-collapsed .dashboard-sidebar-nav-group {
  align-items: center;
}

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

body.dashboard-sidebar-collapsed .dashboard-sidebar-nav-square-dot {
  display: none;
}

/* Section title row is only the dot + hidden label in rail mode — hide it so subpage icons stack cleanly */
body.dashboard-sidebar-collapsed
  .dashboard-sidebar-nav-group--no-heading-icon
  > .dashboard-sidebar-nav-group-toggle {
  display: none;
}

body.dashboard-sidebar-collapsed .dashboard-sidebar-nav-group > .dashboard-sidebar-nav-group-children {
  display: flex;
  margin-left: 0;
  padding: 2px 0 0;
  align-items: center;
  gap: 4px;
}

body.dashboard-sidebar-collapsed .dashboard-sidebar-nav-item--nested {
  padding-left: 0;
}

body.dashboard-sidebar-collapsed .dashboard-sidebar-nav-group-toggle
  .dashboard-sidebar-nav-label {
  padding-left: 0;
}

body.dashboard-sidebar-collapsed .dashboard-sidebar-notification {
  display: none;
}

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-nav-group-toggle {
    font-size: 15px;
  }
}

/* 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;
    align-items: center;
    min-height: auto;
    margin: 0 auto;
    /* Space for fixed mobile menu button (top-left) */
    padding: calc(56px + env(safe-area-inset-top, 0px)) 12px 8px;
    max-width: 100%;
    box-sizing: border-box;
  }

  .dashboard-main {
    width: 100%;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
  }

  .dashboard-sidebar {
    width: 100%;
    max-width: 560px;
    flex-basis: auto;
    position: relative;
    z-index: 400;
    height: 0;
    min-height: 0;
    margin: 0 auto;
    overflow: visible;
    pointer-events: none;
  }

  .dashboard-sidebar-inner {
    height: 0;
    min-height: 0;
    border-radius: 0;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: visible;
    pointer-events: none;
  }

  /* Top-left menu icon only — fixed so it stays visible while scrolling */
  .dashboard-sidebar-mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    min-height: 44px;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    position: fixed;
    top: max(8px, env(safe-area-inset-top, 0px));
    left: max(12px, env(safe-area-inset-left, 0px));
    z-index: 412;
    margin: 0;
    width: auto;
    max-width: none;
    box-sizing: border-box;
    pointer-events: auto;
  }

  .dashboard-mobile-menu-btn {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    border-radius: 12px;
    background: rgba(0, 102, 68, 0.08);
    color: var(--primary-green);
    cursor: pointer;
    transition:
      background-color 0.2s var(--ease-out),
      transform 0.15s ease;
  }

  .dashboard-mobile-menu-btn:hover {
    background: rgba(0, 102, 68, 0.14);
  }

  .dashboard-mobile-menu-btn:active {
    transform: scale(0.96);
  }

  .dashboard-mobile-menu-btn__line {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
  }

  body.dashboard-mobile-menu-open .dashboard-mobile-menu-btn {
    background: rgba(0, 102, 68, 0.18);
  }

  /* Slide-out panel: navigation + brand — fixed; no dimmed overlay behind it */
  .dashboard-sidebar-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 88vw);
    max-width: 100%;
    z-index: 410;
    display: flex;
    flex-direction: column;
    padding: 16px 14px 20px;
    /* Below fixed hamburger (44px) at top: max(8px, safe-area) */
    padding-top: calc(max(8px, env(safe-area-inset-top, 0px)) + 44px + 12px);
    background: #ffffff;
    border-right: 1px solid rgba(34, 34, 34, 0.12);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.12);
    transform: translateX(-105%);
    transition: transform 0.28s var(--ease-out);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    pointer-events: none;
  }

  body.dashboard-mobile-menu-open .dashboard-sidebar-panel {
    transform: translateX(0);
    pointer-events: auto;
  }

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

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

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

  .dashboard-sidebar-nav {
    margin-top: 12px;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 6px;
  }

  .dashboard-sidebar-nav-item {
    min-height: 48px;
    font-size: 15px;
    border-radius: 12px;
    flex: none;
    width: 100%;
  }

  .dashboard-sidebar-nav-group-toggle {
    min-height: 48px;
    font-size: 15px;
    border-radius: 12px;
    width: 100%;
  }

  body.dashboard-sidebar-collapsed .dashboard-sidebar-notification {
    display: block;
  }

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

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

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

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

  body.dashboard-sidebar-collapsed .dashboard-sidebar-email,
  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: 12px;
    align-items: stretch;
  }

  body.dashboard-sidebar-collapsed .dashboard-sidebar-nav-item {
    width: 100%;
    min-height: 48px;
    justify-content: flex-start;
    padding: 10px 14px;
  }

  body.dashboard-sidebar-collapsed .dashboard-sidebar-nav-group-toggle {
    width: 100%;
    min-height: 48px;
    justify-content: flex-start;
    padding: 10px 14px;
  }

  body.dashboard-sidebar-collapsed .dashboard-sidebar-nav-chevron {
    display: flex;
  }
}

/* Desktop: hide mobile chrome */
@media (min-width: 1025px) {
  .dashboard-sidebar-mobile-topbar {
    display: none;
  }

  .dashboard-sidebar-panel {
    position: static;
    transform: none !important;
    width: auto;
    max-width: none;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: visible;
    z-index: auto;
  }
}

/* Main Content */
.main-content {
  padding: 20px 0 28px;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.dashboard-header {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1.5rem;
}

h1 {
  font-family: Inter, sans-serif;
  line-height: 1.2;
  font-size: clamp(2.15rem, 4vw, 3.35rem);
  font-weight: 800;
  letter-spacing: -0.05em;
}

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(--deep-forest);
}

.dashboard-header-copy {
  width: min(100%, 132ch);
  max-width: none;
  margin: 0;
  color: var(--color-muted);
  font-size: 0.98rem;
  line-height: 1.55;
}

.dashboard-header h2 {
  font-family: Inter, sans-serif;
  font-size: 32px;
  font-weight: 800;
  color: var(--deep-forest);
  margin-bottom: 0.5rem;
}

.dashboard-header-copy {
  width: min(100%, 132ch);
  max-width: none;
  margin: 0;
  color: var(--graphite-70);
  font-size: 0.98rem;
  line-height: 1.55;
}

.dashboard-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.1rem;
}

.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: 1rem;
  margin-bottom: 2rem;
}

.metric-card {
  display: block;
  background: var(--surface-white);
  padding: 1.5rem 1.75rem;
  border-radius: 2px;
  border: 1px solid var(--border-soft);
  box-shadow: none;
  transition:
    border-color 0.2s var(--ease-out),
    background-color 0.2s var(--ease-out),
    transform 0.2s var(--ease-out);
  animation: none;
}

.metric-card-link {
  color: inherit;
  text-decoration: none;
}

button.metric-card {
  font: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
}

button.metric-card:focus-visible {
  outline: 2px solid rgba(0, 102, 68, 0.35);
  outline-offset: 2px;
}

.metric-card--clickable:hover .metric-popout-arrow {
  color: var(--primary-green);
  opacity: 1;
}

.metric-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.metric-popout-arrow {
  width: 13px;
  height: 13px;
  color: var(--graphite-70);
  opacity: 0.45;
  flex-shrink: 0;
  transition:
    opacity 0.2s var(--ease-out),
    color 0.2s var(--ease-out);
}

.metric-card:nth-child(1) {
  animation-delay: 0.05s;
}
.metric-card:nth-child(2) {
  animation-delay: 0.1s;
}
.metric-card:nth-child(3) {
  animation-delay: 0.15s;
}
.metric-card:nth-child(4) {
  animation-delay: 0.2s;
}

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

.metric-card:hover {
  transform: translateY(-1px);
  background: #ffffff;
  border-color: rgba(0, 102, 68, 0.14);
}

.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.75rem;
  font-weight: 600;
  color: var(--graphite-70);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.metric-period {
  font-family: IBM Plex Mono, monospace;
  font-size: 0.625rem;
  color: var(--graphite-70);
  opacity: 0.8;
}

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

.metric-number {
  font-family: IBM Plex Mono, monospace;
  font-size: clamp(1.75rem, 2.3vw, 2.35rem);
  font-weight: 800;
  color: var(--graphite-ink);
  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-family: IBM Plex Mono, monospace;
  font-size: 0.72rem;
  color: var(--color-muted);
  margin-left: 0.25rem;
}

/* Inventory Gauge */
.inventory-gauge {
  width: 100%;
  height: 8px;
  background-color: var(--color-border);
  border-radius: 2px;
  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: 2px;
  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);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.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: 5px;
  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;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.72rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  position: relative;
  overflow: hidden;
  text-decoration: none;
}

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

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: none;
  background: var(--deep-forest);
}

.btn-outline {
  background: var(--surface-quiet);
  color: var(--deep-forest);
  border-color: rgba(0, 102, 68, 0.12);
  box-shadow: none;
}

.btn-outline:hover {
  background: rgba(0, 102, 68, 0.06);
  border-color: rgba(0, 102, 68, 0.18);
  color: var(--primary-green);
  transform: none;
  box-shadow: none;
}

/* 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;
}

.tutorial-activate-btn {
  min-width: 180px;
}

/* Error safety net */
.dashboard-error-page .dashboard-main {
  min-height: 100vh;
}

.dashboard-error-main {
  display: flex;
  align-items: center;
}

.dashboard-error-container {
  min-height: calc(100vh - 48px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dashboard-error-panel {
  width: min(100%, 560px);
  padding: 24px 0;
}

.dashboard-error-icon {
  width: 48px;
  height: 48px;
  border-radius: 5px;
  border: 1px solid rgba(211, 47, 47, 0.22);
  background: rgba(211, 47, 47, 0.06);
  color: var(--color-danger);
  display: grid;
  place-items: center;
  margin-bottom: 18px;
}

.dashboard-error-icon svg,
.dashboard-error-action svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.8;
  flex: 0 0 auto;
}

.dashboard-error-panel h1 {
  color: var(--primary-green);
  margin-bottom: 12px;
  letter-spacing: 0;
}

.dashboard-error-copy {
  max-width: 460px;
  color: var(--graphite-70);
  font-size: 17px;
  line-height: 1.55;
  margin-bottom: 18px;
}

.dashboard-error-code {
  display: inline-flex;
  padding: 5px 10px;
  border-radius: 5px;
  border: 1px solid var(--graphite-10);
  color: rgba(34, 34, 34, 0.58);
  font-family: IBM Plex Mono, monospace;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  margin-bottom: 20px;
}

.dashboard-error-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.dashboard-error-action {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
}

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

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

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

.section-header h2 {
  font-size: clamp(1.65rem, 2.8vw, 2.2rem);
  font-weight: 800;
  color: var(--deep-forest);
  margin: 0;
  animation: none;
  letter-spacing: -0.03em;
}

.section-header h3 {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  font-weight: 800;
  color: var(--deep-forest);
  margin: 0;
  animation: none;
  letter-spacing: -0.02em;
}

.section-header--filters {
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
}

.section-header--filters .filter-controls {
  width: 100%;
}

.product-search-results-header {
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1rem;
}

.product-search-results-header .competitor-table-toolbar {
  width: auto;
}

.product-search-results-summary {
  margin: 6px 0 0;
  color: var(--color-muted);
  font-size: 0.875rem;
}

.product-search-controls {
  margin-bottom: 1.25rem;
}

.product-search-controls .filter-controls {
  align-items: stretch;
  gap: 0.75rem;
}

.product-search-input-wrap {
  position: relative;
  flex: 2 1 360px;
  min-width: 320px;
}

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

.product-search-controls .filter-dropdown {
  flex: 1 1 185px;
  min-width: 185px;
}

.product-search-controls .filter-select,
.product-search-controls .search-input {
  min-height: 42px;
}

@media (min-width: 1180px) {
  .section-header--filters .filter-controls {
    flex-wrap: nowrap;
  }
}

.recommendations-header {
  margin-bottom: 1rem;
}

.recommendations-header-row {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .recommendations-header-row .btn {
    width: 100%;
    justify-content: center;
  }
}

@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: var(--surface-white);
  padding: 1.5rem;
  border-radius: 18px;
  box-shadow: none;
  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: 5px;
  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;
  flex-wrap: wrap;
}

.filter-dropdown {
  position: relative;
  flex: 0 1 220px;
  min-width: 220px;
}

.filter-select {
  width: 100%;
  min-height: 46px;
  padding: 0.65rem 1rem;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background-color: var(--surface-quiet);
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--deep-forest);
}

.filter-select--trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.filter-dropdown.is-open .filter-select--trigger {
  border-color: rgba(0, 102, 68, 0.35);
  box-shadow: var(--focus-ring);
}

.filter-dropdown.has-selection .filter-select-label {
  color: var(--color-primary);
  font-weight: 600;
}

.filter-select-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-caret {
  flex: 0 0 auto;
  color: var(--color-muted);
  transition: transform 0.2s;
}

.filter-dropdown.is-open .filter-caret {
  transform: rotate(180deg);
}

.filter-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  min-width: 240px;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(34, 34, 34, 0.08);
  display: none;
  z-index: 40;
}

.filter-dropdown.is-open .filter-menu {
  display: block;
}

.filter-menu-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding-bottom: 0;
  border-bottom: 0;
}

.filter-menu-actions[hidden] {
  display: none;
}

.filter-action {
  border: none;
  background: transparent;
  color: var(--color-primary);
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
}

.filter-menu-search {
  margin-bottom: 10px;
}

.filter-menu-search-input {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: #fff;
  font-size: 0.875rem;
  font-family: inherit;
}

.filter-menu-search-input:focus {
  outline: 2px solid rgba(5, 150, 105, 0.16);
  outline-offset: 1px;
  border-color: var(--color-primary);
}

.filter-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0;
  font-size: 0.875rem;
  cursor: pointer;
}

.filter-option input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--color-primary);
}

.filter-option-label {
  flex: 1 1 auto;
  min-width: 0;
}

.filter-option-count {
  margin-left: auto;
  color: var(--color-muted);
  font-size: 0.75rem;
  font-family: IBM Plex Mono, monospace;
}

.filter-option-empty {
  padding: 0.25rem 0;
  color: var(--color-muted);
  font-size: 0.875rem;
}

.product-search-shell {
  margin-bottom: 24px;
  padding: 24px;
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  background: var(--surface-white);
  box-shadow: none;
}

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

.search-input {
  min-height: 46px;
  padding: 0.65rem 1rem;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background-color: var(--surface-quiet);
  font-size: 0.875rem;
  width: 250px;
  font-family: inherit;
}

.product-search-input-wrap {
  position: relative;
  flex: 1 1 420px;
  min-width: 320px;
  max-width: none;
}

.filter-controls .search-input {
  min-width: 0;
  max-width: none;
  width: 100%;
}

.product-search-filter-toggle {
  flex: 0 0 auto;
  min-height: 46px;
  padding: 0.72rem 1rem;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--surface-quiet);
  color: var(--color-text);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease;
}

.product-search-filter-toggle:hover,
.product-search-filter-toggle.is-open {
  border-color: rgba(0, 102, 68, 0.18);
  background: rgba(0, 102, 68, 0.06);
  box-shadow: var(--focus-ring);
}

#search-suggestions {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  box-shadow: 0 18px 40px rgba(34, 34, 34, 0.08);
  z-index: 200;
  overflow-y: auto;
  max-height: 420px;
}

.suggestion-group + .suggestion-group {
  border-top: 1px solid var(--color-border);
}

.suggestion-group-title {
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
  background: #f8faf9;
}

.suggestion-item {
  display: flex;
  width: 100%;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid #f3f4f6;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease;
  font-family: inherit;
}

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

.suggestion-item:hover {
  background: #f8f9fa;
}

.suggestion-item-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggestion-item-meta {
  flex: 0 0 auto;
  max-width: 45%;
  color: #888;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggestions-empty {
  padding: 12px 16px;
  color: #999;
  font-size: 13px;
  text-align: center;
}

.product-search-selection {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  margin-top: 14px;
}

.product-search-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  margin-top: 14px;
}

.product-search-active-filters[hidden] {
  display: none;
}

.search-chip-placeholder {
  color: var(--color-muted);
  font-size: 0.875rem;
}

.product-search-active-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--color-text);
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.product-search-active-filter::after {
  content: "x";
  display: inline-block;
  color: var(--color-muted);
  font-size: 11px;
}

.product-search-active-filter--sort {
  cursor: default;
  background: rgba(15, 23, 42, 0.04);
}

.product-search-active-filter--sort::after {
  content: "";
  display: none;
}

.search-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: #fff;
  font-family: inherit;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease;
}

.search-chip:hover {
  border-color: var(--color-primary);
  background: var(--primary-green-10);
  box-shadow: 0 0 0 3px rgba(0, 102, 68, 0.08);
}

.search-chip:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.search-chip-kind {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.search-chip-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
}

.search-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  color: var(--color-text);
  font-size: 12px;
  font-weight: 700;
}

.product-search-filter-panel {
  margin-top: 20px;
  padding: 24px;
  border: 1px solid var(--color-border);
  border-radius: 5px;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.product-search-filter-panel[hidden] {
  display: none;
}

.product-search-filter-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.product-search-filter-panel-eyebrow {
  margin: 0 0 6px;
  color: var(--color-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.product-search-filter-panel-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.product-search-filter-close {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #fff;
  color: var(--color-text);
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: inherit;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
}

.product-search-filter-section {
  margin-bottom: 20px;
}

.product-search-filter-section h3 {
  margin: 0 0 12px;
  font-size: 0.9375rem;
}

.product-search-sort-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.product-search-sort-pill {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #fff;
  color: var(--color-text);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  padding: 0.65rem 1rem;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease;
}

.product-search-sort-pill.is-active,
.product-search-sort-pill:hover {
  border-color: var(--color-primary);
  background: var(--primary-green-10);
}

.product-search-filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.product-search-filter-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: 5px;
  background: #ffffff;
}

.product-search-filter-group-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.product-search-filter-group-header h3 {
  margin: 0;
  font-size: 0.9375rem;
}

.product-search-filter-group .filter-menu-actions {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.product-search-filter-group .filter-menu-search {
  margin-bottom: 0;
}

.product-search-filter-group .filter-options {
  padding-top: 8px;
  border-top: 0;
}

.product-search-filter-panel-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

.product-info-card {
  margin-bottom: 24px;
  padding: 20px 24px;
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  background: var(--surface-white);
}

.product-info-card h3 {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 700;
}

.product-info-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 18px;
  padding-top: 8px;
  border-top: 0;
}

.product-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.product-stat-label {
  color: #999;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.product-stat-value {
  font-size: 16px;
  font-weight: 700;
}

.product-search-results-header {
  align-items: flex-end;
}

.product-search-results-summary {
  margin: 6px 0 0;
  color: var(--color-muted);
  font-size: 0.875rem;
}

@media (max-width: 900px) {
  .filter-dropdown {
    flex: 1 1 calc(50% - 0.5rem);
    min-width: 180px;
  }

  .product-search-input-wrap {
    min-width: 0;
    max-width: none;
    width: 100%;
  }

  .product-search-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .product-search-filter-toggle {
    width: 100%;
  }

  .product-search-filter-grid {
    grid-template-columns: 1fr;
  }

  .filter-controls .search-input {
    flex: 1 1 100%;
    min-width: 0;
    max-width: none;
  }
}

@media (max-width: 640px) {
  .filter-dropdown {
    flex-basis: 100%;
    min-width: 0;
  }

  .filter-menu {
    min-width: 0;
  }

  .product-info-card {
    padding: 18px;
  }

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

  .search-chip {
    width: 100%;
    justify-content: space-between;
  }

  .product-search-active-filter {
    width: 100%;
    justify-content: space-between;
  }

  .product-search-filter-panel {
    padding: 18px;
  }

  .product-search-filter-panel-header,
  .product-search-filter-panel-footer {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Tax Toggle */
.competitor-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  padding: 0;
}
 
.tax-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
 
.tax-toggle-label {
  font-size: 0.8rem;
  color: var(--color-muted);
  white-space: nowrap;
}
 
.tax-toggle {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
  cursor: pointer;
  font-family: inherit;
}
 
.tax-toggle-option {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-muted);
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  user-select: none;
}
 
.tax-toggle-option--active {
  background: rgba(0, 102, 68, 0.08);
  color: var(--primary-green);
  box-shadow: none;
}
 
@media (max-width: 640px) {
  .tax-toggle-wrap {
    width: 100%;
    justify-content: space-between;
  }
 
  .tax-toggle {
    flex: 1;
    justify-content: center;
  }
}

/* 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: 2px;
  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%;
  min-width: 0;
  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: 0;
  flex-wrap: wrap;
}

.competitor-loading-banner {
  text-align: center;
  padding: 10px 16px;
  font-size: 0.875rem;
  color: var(--color-muted);
  background: var(--surface-tint);
  border: 1px solid var(--border-soft);
  border-radius: 2px;
  margin-top: 8px;
}

.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(--border-soft);
  background: var(--surface-quiet);
  color: var(--graphite-ink);
  border-radius: 999px;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}

.pagination-btn:hover:not(:disabled) {
  background: rgba(0, 102, 68, 0.06);
  border-color: rgba(0, 102, 68, 0.18);
}

.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%;
  max-width: 100%;
  min-width: 0;
  max-height: min(70vh, 600px);
  overflow-y: auto;
  overflow-x: hidden;
}

#recommendations-table.table,
#pricing-table.table,
#results-table.table,
.recommendations-section .data-table {
  width: 100%;
  font-size: 0.9375rem;
  border-collapse: separate;
  border-spacing: 0;
  border: none;
  table-layout: fixed;
}

#pricing-table.table thead tr,
#recommendations-table.table thead tr,
#results-table.table thead tr {
  background: transparent;
}

/* Sticky header: keep column names visible when scrolling (same as recommendations table) */
#pricing-table.table thead th,
#recommendations-table.table thead th,
#results-table.table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: inset 0 -1px 0 0 var(--border-soft);
}

#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-top: none;
  border-right: none;
  border-bottom: 1px solid var(--border-soft);
  border-left: none;
  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;
}

/* Header wrap (same as recommendations table) */
#pricing-table.table th.table-head {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.3;
  min-width: 0;
}

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

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

#pricing-table.table tbody tr:nth-child(even),
#results-table.table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.66);
}

#pricing-table.table .table-cell {
  padding: 14px 1rem;
  border-top: none;
  border-right: none;
  border-bottom: 1px solid var(--border-soft);
  border-left: 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;
}

#pricing-table.table .table-cell--stacked {
  line-height: 1.4;
}

#pricing-table.table .pricing-table-detail-primary {
  font-weight: 600;
  color: var(--color-text);
}

#pricing-table.table .pricing-table-detail-secondary {
  margin-top: 2px;
  font-size: 0.8125rem;
  color: var(--color-muted);
}

#pricing-table.table .pricing-table-detail-secondary--muted {
  color: var(--color-muted);
}

#pricing-table.table .table-cell--muted {
  color: var(--color-muted);
}

.pricing-table-product-link {
  color: var(--color-primary);
  font-weight: 700;
  text-decoration: none;
  text-underline-offset: 0.14em;
}

.pricing-table-product-link:hover,
.pricing-table-product-link:focus-visible {
  color: var(--deep-forest);
  text-decoration: underline;
}

.pricing-comparison-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.pricing-comparison-line + .pricing-comparison-line {
  margin-top: 2px;
}

.pricing-comparison-label {
  color: var(--color-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pricing-comparison-value,
.pricing-diff-value {
  font-family: IBM Plex Mono, monospace;
  font-weight: 600;
  color: var(--graphite-ink);
}

.pricing-comparison-value {
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

.pricing-table-tax-note {
  color: var(--color-muted);
  font-family: Urbanist, sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.overlap-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 2px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.overlap-status--exact {
  background: rgba(0, 102, 68, 0.08);
  color: var(--primary-green);
}

.overlap-status--partial {
  background: rgba(238, 175, 0, 0.14);
  color: #745300;
}

.overlap-status--none {
  background: rgba(34, 34, 34, 0.06);
  color: var(--color-muted);
}

.pricing-diff-value--higher {
  color: var(--primary-green);
}

.pricing-diff-value--lower {
  color: var(--color-danger);
}

.pricing-diff-value--same,
.pricing-diff-value--muted {
  color: var(--color-muted);
}

.competitor-empty-state {
  padding: 40px;
  font-size: 1rem;
  font-style: normal;
}

/* 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:not(.recommendations-table--show-confidence)
  .recommendations-col-certainty {
  display: none;
}

.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-top: none;
  border-right: none;
  border-bottom: 1px solid var(--border-soft);
  border-left: none;
  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: rgba(255, 255, 255, 0.66);
}

#recommendations-table .table-cell {
  padding: 14px 1rem;
  border-top: none;
  border-right: none;
  border-bottom: 1px solid var(--border-soft);
  border-left: 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-trigger {
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.rec-product-trigger:focus-visible {
  outline: 2px solid rgba(44, 95, 74, 0.35);
  outline-offset: 4px;
  border-radius: 8px;
}

#recommendations-table tbody tr:hover .rec-product-name,
.rec-product-trigger:hover .rec-product-name,
.rec-product-trigger:focus-visible .rec-product-name {
  color: var(--deep-forest);
  text-decoration: underline;
  text-underline-offset: 0.14em;
}

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

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

.batch-id-meta {
  color: #4b5563;
  font-size: 0.75rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

#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: 2px;
  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: 8px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 92px;
  min-height: 36px;
  padding: 0 10px;
  border: none;
  border-radius: 2px;
  font-weight: 700;
  font-size: 0.8125rem;
  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: 5px;
  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: var(--surface-white);
  padding: 1.5rem;
  border-radius: 5px;
  box-shadow: none;
  border: 1px solid var(--border-soft);
  margin-bottom: 2rem;
}

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

.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: var(--surface-white);
  padding: 1.5rem;
  border-radius: 5px;
  box-shadow: none;
  border: 1px solid var(--border-soft);
  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. Scrolling is on inner .recommendations-table-wrap. */
.products-table-wrapper {
  background: var(--surface-white);
  padding: 24px;
  border-radius: 5px;
  box-shadow: none;
  border: 1px solid var(--border-soft);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Status Badges */
.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 5px;
  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;
}

button.help-tooltip {
  border: 0;
  padding: 0;
  appearance: none;
}

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

.help-tooltip:focus-visible {
  outline: 2px solid var(--primary-green);
  outline-offset: 2px;
  background-color: var(--highlight-lime);
  color: var(--deep-forest);
}

/* 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: 2px;
  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;
}

.help-tooltip[aria-controls]::after,
.help-tooltip[aria-controls]::before {
  display: none;
}

.help-tooltip-popover[hidden] {
  display: none;
}

.help-tooltip-popover {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 1000;
  width: min(320px, calc(100dvw - 48px));
  max-width: calc(100dvw - 24px);
  padding: 10px 14px;
  background-color: rgba(0, 0, 0, 0.92);
  color: white;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  text-align: left;
  border-radius: 2px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.help-tooltip-popover::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 14px;
  border: 5px solid transparent;
  border-bottom-color: rgba(0, 0, 0, 0.92);
}

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: pointer;
}

.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 button.sort-indicator {
  border: 0;
  font: inherit;
  line-height: 1;
}

#pricing-table.data-table th.sortable {
  cursor: default;
}

#pricing-table.data-table th.sortable .sort-indicator {
  cursor: pointer;
  pointer-events: auto;
  user-select: none;
}

.data-table th.sortable .sort-indicator--active {
  opacity: 1;
}

.data-table th.sortable .sort-indicator--inactive {
  opacity: 0.3;
}

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

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

.data-table th.sortable.sort-asc .sort-indicator::before {
  content: "↑";
}

.data-table th.sortable.sort-desc .sort-indicator::before {
  content: "↓";
}

.data-table th.sortable.sort-asc .sort-indicator,
.data-table th.sortable.sort-desc .sort-indicator {
  color: var(--primary-green);
}

.data-table th.sortable.sort-asc .sort-indicator,
.data-table th.sortable.sort-desc .sort-indicator {
  font-size: 0;
}

.data-table th.sortable.sort-asc .sort-indicator::before,
.data-table th.sortable.sort-desc .sort-indicator::before {
  font-size: 1rem;
}

.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);
}

/* Driver.js onboarding theme */
.driver-popover {
  border-radius: 10px;
  border: 1px solid var(--graphite-10);
  box-shadow: var(--shadow-lg);
}

.driver-popover-title {
  color: var(--color-primary);
  font-family: Urbanist, sans-serif;
  font-weight: 700;
}

.driver-popover-description {
  color: var(--color-text);
  font-family: Urbanist, sans-serif;
}

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

.driver-popover-footer button {
  border-radius: 8px;
  border: 1px solid var(--graphite-20);
  font-family: Urbanist, sans-serif;
  font-weight: 600;
}

.driver-popover-footer .driver-popover-next-btn {
  background: var(--primary-green);
  border-color: var(--primary-green);
  color: #fff;
  text-shadow: none;
}

.driver-popover-footer .driver-popover-prev-btn {
  color: var(--color-primary);
}
.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: 2px;
}

::-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%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  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: min(90%, calc(100% - 24px));
  max-width: 600px;
  box-sizing: border-box;
  border-radius: 2px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.3s var(--ease-out);
  overflow-x: hidden;
}

.popup-content--changelog {
  max-width: 720px;
}

.popup-content--recommendation {
  width: min(46vw, calc(100% - 32px));
  max-width: 700px;
  max-height: min(88vh, 920px);
  border-radius: 5px;
  overflow-y: auto;
}

.popup-content--menu-health-goals {
  max-width: 680px;
  max-height: 82vh;
  overflow-y: auto;
}

.popup-content--menu-health-goals #popup-body {
  padding: 32px 30px 30px;
}

.popup-content--recommendation .popup-close {
  top: 18px;
  right: 18px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  color: var(--primary-green);
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
}

.popup-content--recommendation .popup-close:hover {
  color: var(--deep-forest);
  background: rgba(0, 102, 68, 0.08);
}

.popup-content--recommendation .popup-close:focus-visible {
  outline: 2px solid var(--primary-green);
  outline-offset: 2px;
}

.popup-content--recommendation #popup-body {
  padding: 26px 32px 32px;
}

.popup-content--session-timeout {
  max-width: 440px;
}

/* Low Stock Popup */
.popup-content--low-stock {
  max-width: 540px;
  max-height: 80vh;
  overflow-y: auto;
}

.low-stock-popup {
  padding: 26px 28px 28px;
}

.low-stock-popup-title {
  font-family: Inter, sans-serif;
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--deep-forest);
  letter-spacing: -0.04em;
  margin: 0 0 4px;
}

.low-stock-popup-subtitle {
  color: var(--graphite-70);
  font-size: 0.875rem;
  margin: 0 0 18px;
}

.low-stock-table-wrap {
  overflow-x: auto;
}

.low-stock-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.low-stock-table .table-head {
  padding: 10px 12px;
}

.low-stock-cell {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

.low-stock-cell--name {
  font-weight: 600;
  color: var(--graphite-ink);
}

.low-stock-cell--cat {
  color: var(--graphite-70);
  font-size: 0.8125rem;
}

.low-stock-cell--inv {
  font-family: IBM Plex Mono, monospace;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

.low-stock-inv--zero {
  color: var(--color-danger);
}

.low-stock-inv--critical {
  color: #b34a00;
}

.low-stock-inv--low {
  color: var(--graphite-ink);
}

.popup-modal--viewport-notice {
  z-index: 2147483000;
  padding-top: max(12px, env(safe-area-inset-top));
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  box-sizing: border-box;
}

.popup-content--viewport-notice {
  width: min(420px, calc(100% - 24px));
  max-width: min(420px, calc(100% - 24px));
  margin: clamp(16px, 8vh, 72px) auto;
  overflow: hidden;
}

.popup-body--viewport-notice {
  padding: 24px 20px 20px;
  box-sizing: border-box;
  overflow-x: hidden;
  max-width: 100%;
}

.popup-modal--viewport-notice .viewport-notice {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: break-word;
}

.viewport-notice h3 {
  margin: 0;
  padding-right: 56px;
  color: var(--deep-forest);
  font-size: clamp(1.3rem, 4vw, 1.75rem);
  line-height: 1.05;
}

.viewport-notice__copy {
  margin: 0;
  line-height: 1.55;
  color: var(--color-text);
  font-size: 0.95rem;
  overflow-wrap: break-word;
}

.viewport-notice__actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}

.viewport-notice__actions .btn {
  width: 100%;
  min-height: 56px;
  justify-content: center;
  border-radius: 14px;
  font-size: 1.05rem;
}

.popup-modal--viewport-notice .popup-close {
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--graphite-20);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  -webkit-appearance: none;
  appearance: none;
  box-shadow: 0 8px 20px rgba(26, 39, 33, 0.12);
  color: var(--graphite-70);
  font-size: 32px;
  line-height: 1;
}

.popup-modal--viewport-notice .popup-close:hover {
  color: var(--deep-forest);
  background: #ffffff;
}

.popup-modal--viewport-notice .popup-close:focus-visible {
  outline: 2px solid var(--primary-green);
  outline-offset: 2px;
}

.popup-modal--session-timeout .popup-close {
  display: none;
}

.popup-close {
  position: absolute;
  right: 20px;
  top: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: transparent;
  line-height: 1;
  appearance: none;
  -webkit-appearance: none;
  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,
#session-timeout-body {
  padding: 40px 30px 30px;
}

.recommendation-popup {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.recommendation-popup--loading {
  min-height: 240px;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.recommendation-popup__loading-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--deep-forest);
}

.recommendation-popup__loading-copy {
  max-width: 340px;
  margin-top: 8px;
  color: var(--color-muted);
}

.recommendation-popup__topbar {
  display: flex;
  justify-content: center;
  text-align: center;
}

.recommendation-popup__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 24px;
  align-items: start;
}

.recommendation-popup__eyebrow {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text);
}

.recommendation-popup__hero-main {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.recommendation-popup__title {
  margin: 0;
  max-width: 12ch;
  font-size: clamp(2rem, 2.9vw, 3rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
  color: var(--primary-green);
  font-weight: 800;
}

.recommendation-popup__hero-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
}

.recommendation-popup__hero-metric {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}

.recommendation-popup__hero-value {
  font-size: clamp(1.5rem, 2vw, 2.1rem);
  line-height: 0.98;
  font-weight: 800;
  color: var(--primary-green);
}

.recommendation-popup__hero-label {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--color-text);
}

.recommendation-popup__primary-action {
  width: min(100%, 320px);
  min-height: 44px;
  border: none;
  border-radius: 999px;
  padding: 0 18px;
  background: var(--primary-green);
  box-shadow: 0 12px 24px rgba(0, 102, 68, 0.14);
  color: #ffffff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition:
    transform 0.2s var(--ease-out),
    box-shadow 0.2s var(--ease-out),
    background 0.2s var(--ease-out);
}

.recommendation-popup__primary-action:hover:not(:disabled) {
  background: var(--deep-forest);
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(0, 102, 68, 0.18);
}

.recommendation-popup__primary-action:focus-visible {
  outline: 2px solid var(--primary-green);
  outline-offset: 3px;
}

.recommendation-popup__primary-action:disabled {
  cursor: not-allowed;
  background: rgba(0, 102, 68, 0.28);
  box-shadow: none;
}

.recommendation-popup__summary-card {
  padding: 18px 20px;
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(247, 244, 236, 0.98), #f8f5ee);
  border: 1px solid rgba(34, 34, 34, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.recommendation-popup__summary-label {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-transform: none;
  color: var(--color-muted);
}

.recommendation-popup__summary-value-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 12px;
  margin-top: 12px;
}

.recommendation-popup__summary-price {
  font-size: clamp(2.1rem, 3vw, 3rem);
  line-height: 0.96;
  letter-spacing: -0.04em;
  font-weight: 800;
  color: var(--primary-green);
}

.recommendation-popup__summary-subtext {
  padding-bottom: 2px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary-green);
}

.recommendation-popup__summary-notes {
  display: grid;
  gap: 4px;
  margin-top: 12px;
}

.recommendation-popup__summary-note {
  font-size: 0.95rem;
  line-height: 1.35;
  color: var(--color-muted);
}

.recommendation-popup__sections {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.recommendation-popup-section {
  border-top: 1px solid rgba(34, 34, 34, 0.18);
}

.recommendation-popup-section:first-child {
  border-top: none;
}

.recommendation-popup-section__summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  cursor: pointer;
  padding: 18px 0 20px;
}

.recommendation-popup-section__summary::-webkit-details-marker {
  display: none;
}

.recommendation-popup-section[open] .recommendation-popup-section__summary {
  padding-bottom: 16px;
}

.recommendation-popup-section__title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--primary-green);
}

.recommendation-popup-section__chevron {
  position: relative;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.recommendation-popup-section__chevron::before,
.recommendation-popup-section__chevron::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 11px;
  height: 2px;
  border-radius: 2px;
  background: var(--color-text);
  transition: transform 0.2s var(--ease-out);
}

.recommendation-popup-section__chevron::before {
  left: -1px;
  transform: translateY(-50%) rotate(45deg);
}

.recommendation-popup-section__chevron::after {
  right: -1px;
  transform: translateY(-50%) rotate(-45deg);
}

.recommendation-popup-section[open] .recommendation-popup-section__chevron::before {
  transform: translateY(-50%) rotate(-45deg);
}

.recommendation-popup-section[open] .recommendation-popup-section__chevron::after {
  transform: translateY(-50%) rotate(45deg);
}

.recommendation-popup-section__body {
  padding: 0 0 20px;
}

.recommendation-popup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 22px;
}

.recommendation-popup-section--price-history .recommendation-popup-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.recommendation-popup-stat {
  min-width: 0;
}

.recommendation-popup-stat__label {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-transform: none;
  color: var(--color-muted);
}

.recommendation-popup-stat__value {
  margin-top: 6px;
  font-size: 1.5rem;
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--color-text);
  overflow-wrap: break-word;
}

.recommendation-popup-stat__subtext {
  margin-top: 4px;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--color-muted);
}

.recommendation-popup-signals {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 14px;
}

.recommendation-popup-signals__item {
  font-size: 0.92rem;
  color: var(--color-text);
  line-height: 1.55;
}

@media (max-width: 1180px) {
  .popup-content--recommendation {
    width: min(58vw, calc(100% - 24px));
    max-width: 680px;
  }

  .recommendation-popup__header {
    grid-template-columns: minmax(0, 1fr) minmax(210px, 250px);
    gap: 20px;
  }
}

@media (max-width: 900px) {
  .popup-content--recommendation {
    width: min(100%, calc(100% - 16px));
    margin: 8px auto;
    overflow-x: hidden;
    box-sizing: border-box;
    border-radius: 5px;
  }

  #popup-body {
    padding: 32px 20px 22px;
    overflow-x: hidden;
    box-sizing: border-box;
    max-width: 100%;
  }

  .popup-content--recommendation #popup-body {
    padding: 52px 20px 24px;
  }

  .recommendation-popup__header {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .recommendation-popup__title {
    max-width: none;
    font-size: clamp(1.8rem, 8vw, 2.6rem);
  }

  .recommendation-popup__hero-main {
    gap: 16px;
  }

  .recommendation-popup__primary-action {
    width: 100%;
    min-height: 42px;
    font-size: 0.95rem;
  }

  .recommendation-popup__summary-card {
    padding: 16px 18px;
    border-radius: 2px;
  }

  .recommendation-popup__summary-notes {
    margin-top: 10px;
  }

  .recommendation-popup-grid {
    grid-template-columns: 1fr 1fr;
    gap: 16px 14px;
  }

  .recommendation-popup-section__summary {
    padding: 16px 0 18px;
  }

  .recommendation-popup-section[open] .recommendation-popup-section__summary {
    padding-bottom: 14px;
  }

  .popup-content--recommendation .popup-close {
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    font-size: 24px;
  }
}

@media (max-width: 560px) {
  .recommendation-popup {
    gap: 22px;
  }

  .recommendation-popup__eyebrow {
    font-size: 0.85rem;
    letter-spacing: 0.04em;
  }

  .recommendation-popup__hero-metrics {
    gap: 14px 24px;
  }

  .recommendation-popup__hero-metric {
    gap: 10px;
  }

  .recommendation-popup__summary-value-row {
    gap: 8px 14px;
  }

  .recommendation-popup__summary-subtext {
    padding-bottom: 0;
  }

  .recommendation-popup-section__title {
    font-size: 1rem;
  }

  .recommendation-popup-grid,
  .recommendation-popup-section--price-history .recommendation-popup-grid {
    grid-template-columns: 1fr;
  }

  .recommendation-popup-stat__value {
    font-size: 1.85rem;
  }
}

.session-timeout-warning {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.session-timeout-warning-countdown {
  margin: 0;
  font-size: 1rem;
  color: var(--color-text);
}

.popup-actions--session-timeout {
  margin-top: 0;
}

.popup-actions--session-timeout .btn {
  width: 100%;
}

.changelog-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 6px;
}

.changelog-entry {
  border: 1px solid var(--color-border);
  border-radius: 2px;
  padding: 18px;
  background: #f7faf8;
}

.changelog-entry-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.changelog-entry-title {
  margin: 0;
  color: var(--color-primary);
  font-family: Urbanist, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.changelog-entry-version {
  color: var(--color-muted);
  font-family: IBM Plex Mono, monospace;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.changelog-entry-list {
  margin: 0 0 0 18px;
  padding: 0;
  color: var(--color-text);
  font-size: 14px;
  line-height: 1.6;
}

.changelog-entry-list li + li {
  margin-top: 6px;
}

.changelog-entry-actions {
  margin-top: 16px;
}

.changelog-entry-action {
  text-decoration: none;
}

.changelog-empty {
  margin: 0;
  color: var(--color-muted);
  font-size: 14px;
}

@media (max-width: 640px) {
  .dashboard-sidebar-notification {
    padding: 14px;
  }

  .changelog-entry {
    padding: 16px;
  }

  .changelog-entry-header {
    flex-direction: column;
  }
}

/* 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);
}

.settings-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.settings-checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  padding: 0;
  accent-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: var(--surface-white);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 0;
  transition: all 0.2s var(--ease-out);
  cursor: pointer;
  position: relative;
  margin-bottom: 2px;
}

.rule-card:hover {
  background: #ffffff;
  border-color: rgba(0, 102, 68, 0.16);
}

.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(30, 86, 49, 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(--deep-forest);
  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 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  padding: 8px 6px;
  color: var(--color-muted);
  opacity: 0.68;
  transition:
    color 0.2s var(--ease-out),
    opacity 0.2s var(--ease-out),
    transform 0.2s var(--ease-out);
}

.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 {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
  object-position: center;
  flex-shrink: 0;
}

.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-dots {
  display: grid;
  grid-template-columns: repeat(2, 4px);
  gap: 3px 4px;
}

.drag-handle-dot {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background-color: currentColor;
  transition:
    background-color 0.2s var(--ease-out),
    transform 0.2s var(--ease-out);
}

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

.drag-handle:hover {
  opacity: 1;
  color: var(--primary-green);
}

.drag-handle:active {
  cursor: grabbing;
  opacity: 1;
  color: var(--primary-green);
  transform: scale(0.96);
}

.drag-handle:hover .drag-handle-dot,
.drag-handle:active .drag-handle-dot {
  transform: scale(1.08);
}

.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 */

body.competitor-page {
  background: var(--warm-cream);
}

.competitor-page .dashboard-header h1,
.competitor-page .section-header h2,
.competitor-page .section-header h3 {
  letter-spacing: 0;
}

.competitor-page .dashboard-header-copy {
  max-width: 720px;
}

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

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

.chart-section,
.map-container {
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

#map {
  height: 400px;
  margin-bottom: 0;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: 2px;
  background: var(--surface-tint);
}

.chart-container {
  height: 400px;
}

/* Mapbox overlay styles */
.map-overlay {
  display: none;
  font: 12px/20px Urbanist, 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: 2px;
}

.competitor-map-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 420px;
  justify-content: flex-end;
  min-width: 0;
  flex-wrap: wrap;
}

.competitor-map-search-wrap {
  flex: 1 1 220px;
  min-width: min(220px, 100%);
}

.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: var(--surface-quiet);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  width: min(250px, 100%);
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  flex: 1 1 200px;
}

.map-container .section-header {
  flex-wrap: wrap;
  align-items: flex-start;
  min-width: 0;
}

.map-container .section-header h3 {
  margin: 0;
  flex: 1 1 12rem;
  min-width: 0;
}

#stats-content {
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  margin-top: 0;
  background: var(--surface-quiet);
  box-shadow: none;
}

.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-wrap {
  position: relative;
  flex-shrink: 0;
}

#dispensary-icon-large {
  display: block;
  margin: 0;
  width: 84px;
  height: 56px;
  object-fit: contain;
  object-position: center;
}

#bookmark-btn {
  position: absolute;
  top: -10px;
  right: -12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 0;
  cursor: pointer;
  line-height: 0;
  color: var(--color-muted);
  transition:
    border-color 0.2s,
    color 0.2s,
    background 0.2s;
}

#bookmark-btn span {
  display: none;
  width: 22px;
  height: 22px;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-position: center;
  mask-position: center;
}

.bm-x     { -webkit-mask-image: url('assets/bookmark-x.svg');     mask-image: url('assets/bookmark-x.svg'); }
.bm-add   { -webkit-mask-image: url('assets/bookmark-add.svg');   mask-image: url('assets/bookmark-add.svg'); }
.bm-check { -webkit-mask-image: url('assets/bookmark-check.svg'); mask-image: url('assets/bookmark-check.svg'); }
.bm-minus { -webkit-mask-image: url('assets/bookmark-minus.svg'); mask-image: url('assets/bookmark-minus.svg'); }

#bookmark-btn:hover {
  background: #ffffff;
  border-color: rgba(0, 102, 68, 0.18);
}

#bookmark-btn:not(.is-bookmarked)             { color: var(--color-muted); }
#bookmark-btn:not(.is-bookmarked) .bm-add     { display: block; }

#bookmark-btn:not(.is-bookmarked):hover       { color: var(--primary-green); }
#bookmark-btn:not(.is-bookmarked):hover .bm-add { display: block; }

#bookmark-btn.is-bookmarked                   { color: var(--primary-green); }
#bookmark-btn.is-bookmarked .bm-check         { display: block; }

#bookmark-btn.is-bookmarked:hover             { color: var(--color-danger); }
#bookmark-btn.is-bookmarked:hover .bm-check   { display: none; }
#bookmark-btn.is-bookmarked:hover .bm-minus   { display: block; }

#bookmark-btn:disabled {
  cursor: wait;
  opacity: 0.55;
}

#dispensary-icon-small {
  display: block;
  margin-left: 0.1rem;
  width: 100px;
  height: 50px;
  object-fit: contain;
  object-position: center;
}

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

.competitor-map-popup {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: Urbanist, sans-serif;
  color: var(--graphite-ink);
}

.competitor-map-popup h5 {
  margin: 0 0 2px;
  font-size: 0.8125rem;
  line-height: 1.2;
}

.mapboxgl-popup-content {
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  box-shadow: 0 10px 24px rgba(34, 34, 34, 0.08);
}

.dispensary-details {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 0;
  padding: 18px;
}

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

#dispensary-name-header {
  font-size: 24px;
  margin-bottom: 15px;
}

#dispensary-website {
  font-size: 16px;
  color: inherit;
  text-decoration: none;
  pointer-events: none;
}

#dispensary-website.is-active {
  color: var(--color-primary);
  cursor: pointer;
  pointer-events: auto;
  text-decoration: none;
}

#dispensary-website.is-active:hover,
#dispensary-website.is-active:focus-visible {
  color: var(--deep-forest);
  text-decoration: underline;
  text-underline-offset: 0.14em;
}

#dispensary-address {
  font-size: 14px;
  color: var(--color-muted);
}

#dispensary-overlap-stats {
  display: grid;
  gap: 0;
  padding: 0 18px 18px;
  font-size: 0.875rem;
  line-height: 1.35;
  text-align: left;
  background: transparent;
  border-top: 0;
}

#dispensary-overlap-stats p {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
  padding: 10px 0;
  border-top: 1px solid var(--border-soft);
}

#dispensary-overlap-stats strong {
  color: var(--color-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

#dispensary-overlap-stats .dispensary-stat-value {
  color: var(--graphite-ink);
  font-family: IBM Plex Mono, monospace;
  font-weight: 700;
  text-align: right;
}

#dispensary-placeholder-message {
  padding: 0 18px 18px;
  text-align: left;
  background: transparent;
  border-top: 0;
}

#dispensary-placeholder-text {
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
  font-size: 0.95rem;
  color: var(--graphite-70);
  margin: 0;
}

#bookmark-tray {
  border-top: 1px solid var(--border-soft);
  padding: 14px 18px;
  background: rgba(255, 253, 246, 0.62);
  border-radius: 0 0 5px 5px;
}

.bookmark-tray-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.bookmark-tray-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bookmark-tray-empty {
  color: var(--color-muted);
  font-size: 0.8125rem;
}

.bookmark-tray-icon {
  position: relative;
  cursor: pointer;
  border-radius: 5px;
  border: 1px solid transparent;
  transition: border-color 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}

.bookmark-tray-icon:hover {
  border-color: rgba(0, 102, 68, 0.26);
  box-shadow: 0 2px 8px rgba(0, 102, 68, 0.08);
}

.bookmark-tray-icon img {
  display: block;
  width: auto;
  height: 40px;
  max-width: 80px;
  object-fit: contain;
  background: #fff;
  border-radius: 4px 4px 0 0;
}

.bookmark-tray-town {
  font-size: 10px;
  color: var(--color-muted);
  text-align: center;
  padding: 2px 4px 3px;
  background: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
  border-radius: 0 0 4px 4px;
}

.bookmark-tray-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
}

.bookmark-tray-icon:hover .bookmark-tray-tooltip {
  display: block;
}

.dispensary-suggestions-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  box-shadow: 0 18px 40px rgba(34, 34, 34, 0.08);
  z-index: 300;
  overflow-y: auto;
  max-height: 320px;
}

.dispensary-suggestion-empty {
  padding: 12px 16px;
  color: var(--color-muted);
  font-size: 0.8125rem;
  text-align: center;
}

.dispensary-suggestion-item {
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: 2px;
  padding: 10px 16px;
  border: none;
  border-bottom: 1px solid var(--border-soft);
  background: transparent;
  color: var(--graphite-ink);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 120ms ease;
}

.dispensary-suggestion-item:hover,
.dispensary-suggestion-item:focus-visible {
  background: var(--surface-tint);
}

.dispensary-suggestion-name {
  font-size: 0.8125rem;
  font-weight: 700;
}

.dispensary-suggestion-meta {
  color: var(--color-muted);
  font-size: 0.75rem;
}

/* Menu Health */
body.menu-health-app {
  background:
    radial-gradient(
      circle at top right,
      rgba(238, 175, 0, 0.08),
      transparent 26%
    ),
    linear-gradient(180deg, #f8f5eb 0%, #fffdf6 38%, #f6f3e8 100%);
}

/* No extra vertical padding — same top rhythm as index / pricing-rules (.main-content only). */
.menu-health-page {
  padding-top: 0;
  padding-bottom: 0;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

.menu-health-store-toolbar {
  margin-bottom: 18px;
}

.menu-health-store-toolbar .filter-controls {
  width: 100%;
}

.menu-health-store-toolbar .filter-dropdown {
  flex: 0 1 280px;
  min-width: 240px;
}

.competitor-store-toolbar {
  margin-bottom: 18px;
}

.competitor-store-toolbar .filter-controls {
  width: 100%;
}

.competitor-store-toolbar .filter-dropdown {
  flex: 0 1 280px;
  min-width: 240px;
}

.dashboard-store-toolbar {
  margin-bottom: 18px;
}

.dashboard-store-toolbar .filter-controls {
  width: 100%;
}

.dashboard-store-toolbar .filter-dropdown {
  flex: 0 1 280px;
  min-width: 240px;
}

/* Row layout: .dashboard-header defaults to flex-direction: column; without this,
   title stack and action buttons stack vertically and space-between creates a large gap. */
.pricing-rules-page-header.dashboard-header {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.pricing-rules-title-group {
  display: flex;
  flex-direction: column;
  flex: 1 1 760px;
  gap: 8px;
  min-width: 0;
}

.pricing-rules-title-group h1 {
  margin: 0;
}

.pricing-rules-back-link {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 32px;
  color: rgba(30, 86, 49, 0.72);
  font-family: Urbanist, sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s var(--ease-out);
}

.pricing-rules-back-link::before {
  content: "←";
  margin-right: 7px;
}

.pricing-rules-back-link:hover {
  color: var(--primary-green);
}

.pricing-rules-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
  gap: 10px;
  flex-wrap: wrap;
}

.pricing-rules-header-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.65rem 1rem;
}

.rules-application-note {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: -6px 0 18px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: rgba(0, 102, 68, 0.06);
  color: rgba(30, 86, 49, 0.82);
  font-size: 0.92rem;
}

.rules-application-note strong {
  color: var(--deep-forest);
}

.menu-health-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
}

/* .dashboard-header normally has margin-bottom for spacing before the next block on
   index.html; inside this flex row that margin only adds empty space below the title. */
.menu-health-header .dashboard-header {
  margin-bottom: 0;
}

.menu-health-last-updated {
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
}

.menu-health-hero {
  display: grid;
  grid-template-columns: minmax(280px, 0.62fr) minmax(0, 1.38fr);
  gap: 20px;
  align-items: stretch;
}

.menu-health-card {
  background: var(--surface-white);
  backdrop-filter: none;
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  box-shadow: none;
  padding: 28px;
}

.menu-health-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.menu-health-card-header h2,
.menu-health-chart-header h3 {
  font-family: Urbanist, sans-serif;
  color: var(--deep-forest);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
}

.menu-health-title-with-tooltip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.menu-health-title-with-tooltip .help-tooltip {
  margin-left: 0;
}

.menu-health-card-copy,
.menu-health-chart-header p,
.menu-health-score-copy {
  margin-top: 8px;
  color: var(--color-muted);
  font-size: 0.875rem;
  line-height: 1.45;
}

.menu-health-score-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
  height: 100%;
}

.menu-health-score-value {
  font-family: IBM Plex Mono, monospace;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--primary-green);
}

.menu-health-gauge-shell {
  position: relative;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-health-gauge {
  width: 100%;
  max-width: 390px;
  height: auto;
}

.menu-health-gauge-arc {
  fill: none;
  stroke-width: 28;
  stroke-linecap: butt;
}

.menu-health-gauge-arc--low {
  stroke: #bce6c7;
}

.menu-health-gauge-arc--mid {
  stroke: #6cc287;
}

.menu-health-gauge-arc--high {
  stroke: #1e6933;
}

.menu-health-gauge-needle {
  fill: #1f1f1f;
  transform-origin: 130px 130px;
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.menu-health-score-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.menu-health-mini-stat {
  border-radius: 2px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.78);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-health-mini-stat strong {
  color: var(--deep-forest);
  font-size: 1.2rem;
  line-height: 1;
}

.menu-health-mini-stat small {
  color: #647067;
  font-size: 0.86rem;
}

.menu-health-card-header--actions {
  margin-bottom: 14px;
}

.menu-health-refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.menu-health-signal-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.menu-health-signal-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(0, 102, 68, 0.08);
  color: var(--deep-forest);
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: inherit;
  line-height: 1;
  appearance: none;
  cursor: pointer;
  transition:
    background-color 0.2s,
    border-color 0.2s,
    box-shadow 0.2s,
    transform 0.2s;
}

.menu-health-signal-pill:hover {
  background: rgba(0, 102, 68, 0.12);
}

.menu-health-signal-pill.tone-danger {
  background: rgba(220, 38, 38, 0.12);
  color: #b91c1c;
}

.menu-health-signal-pill.tone-warning {
  background: rgba(217, 119, 6, 0.14);
  color: #92400e;
}

.menu-health-signal-pill.tone-caution {
  background: rgba(234, 179, 8, 0.2);
  color: #854d0e;
}

.menu-health-signal-pill.tone-success {
  background: rgba(16, 185, 129, 0.14);
  color: #047857;
}

.menu-health-signal-pill.tone-info {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

.menu-health-signal-pill.tone-neutral {
  background: rgba(107, 114, 128, 0.13);
  color: #4b5563;
}

.menu-health-signal-pill.tone-danger:hover,
.menu-health-signal-pill.tone-danger.is-selected {
  background: rgba(220, 38, 38, 0.2);
  border-color: rgba(220, 38, 38, 0.34);
}

.menu-health-signal-pill.tone-warning:hover,
.menu-health-signal-pill.tone-warning.is-selected {
  background: rgba(217, 119, 6, 0.24);
  border-color: rgba(217, 119, 6, 0.34);
}

.menu-health-signal-pill.tone-caution:hover,
.menu-health-signal-pill.tone-caution.is-selected {
  background: rgba(234, 179, 8, 0.3);
  border-color: rgba(234, 179, 8, 0.4);
}

.menu-health-signal-pill.tone-success:hover,
.menu-health-signal-pill.tone-success.is-selected {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(16, 185, 129, 0.36);
}

.menu-health-signal-pill.tone-info:hover,
.menu-health-signal-pill.tone-info.is-selected {
  background: rgba(37, 99, 235, 0.2);
  border-color: rgba(37, 99, 235, 0.34);
}

.menu-health-signal-pill.tone-neutral:hover,
.menu-health-signal-pill.tone-neutral.is-selected {
  background: rgba(107, 114, 128, 0.22);
  border-color: rgba(107, 114, 128, 0.34);
}

.menu-health-signal-pill.is-selected {
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.menu-health-signal-pill strong {
  display: inline-flex;
  min-width: 24px;
  justify-content: center;
  color: inherit;
}

.menu-health-signal-pill.is-clear {
  background: rgba(34, 34, 34, 0.06);
  color: #5f5f58;
  cursor: default;
}

.menu-health-filter-controls,
.menu-health-actions-controls {
  width: min(100%, 1120px);
}

.menu-health-filter-controls {
  justify-content: flex-end;
}

.menu-health-filter-controls .filter-dropdown,
.menu-health-actions-controls .filter-dropdown {
  flex: 1 1 185px;
  min-width: 185px;
}

.menu-health-filter-controls .filter-menu,
.menu-health-actions-controls .filter-menu {
  z-index: 40;
}

.menu-health-actions-controls {
  margin-bottom: 14px;
  position: relative;
  z-index: 6;
}

.menu-health-action-switch {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 44px;
  color: var(--color-text);
  font-size: 0.9375rem;
  font-weight: 500;
}

.menu-health-action-switch-copy {
  line-height: 1.25;
  cursor: pointer;
}

.menu-health-action-switch .rule-toggle {
  flex-shrink: 0;
}

.menu-health-action-switch.is-disabled {
  opacity: 0.6;
}

.menu-health-action-switch.is-disabled .menu-health-action-switch-copy {
  cursor: not-allowed;
}

.menu-health-actions-controls .search-input {
  flex: 3 1 360px;
  min-width: 320px;
  max-width: none;
  width: auto;
}

.menu-health-actions-controls .menu-health-action-switch {
  flex: 0 0 auto;
  min-width: max-content;
}

.menu-health-actions-controls .filter-dropdown,
.menu-health-widget-controls .filter-dropdown {
  flex: 0 1 185px;
  min-width: 185px;
}

.menu-health-table {
  width: 100%;
  font-size: 0.9375rem;
  border-collapse: separate;
  border-spacing: 0;
  border: none;
}

.menu-health-table-wrap {
  width: 100%;
  position: relative;
  overflow: auto;
  overflow-x: hidden;
  overflow-y: auto;
  border-radius: 2px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.82);
}

.menu-health-table-wrap--actions {
  height: 460px;
}

.menu-health-table-wrap--widget {
  height: 520px;
}

.menu-health-table thead {
  position: sticky;
  top: 0;
  z-index: 3;
}

.menu-health-table thead tr {
  background: transparent;
}

.menu-health-table thead th {
  background: rgba(255, 255, 255, 0.94);
  color: var(--color-muted);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 14px 1rem;
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: inset 0 -1px 0 0 var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  white-space: normal;
  word-break: break-word;
  line-height: 1.3;
}

.menu-health-table tbody td {
  padding: 14px 1rem;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
}

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

.menu-health-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.66);
}

.menu-health-product-cell,
.menu-health-reason-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-health-product-cell strong {
  font-size: 0.95rem;
  line-height: 1.2;
  color: #1f2937;
}

.menu-health-product-cell span,
.menu-health-product-cell small,
.menu-health-reason-cell small {
  color: #6b7280;
  line-height: 1.3;
}

.menu-health-product-cell span,
.menu-health-reason-cell span {
  font-size: 0.9rem;
}

.menu-health-product-cell small,
.menu-health-reason-cell small {
  font-size: 0.75rem;
}

.menu-health-action-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
}

.menu-health-action-pill.tone-danger {
  background: rgba(220, 38, 38, 0.12);
  color: #b91c1c;
}

.menu-health-action-pill.tone-warning {
  background: rgba(217, 119, 6, 0.14);
  color: #b45309;
}

.menu-health-action-pill.tone-caution {
  background: rgba(234, 179, 8, 0.22);
  color: #854d0e;
}

.menu-health-action-pill.tone-success {
  background: rgba(16, 185, 129, 0.14);
  color: #047857;
}

.menu-health-action-pill.tone-info {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

.menu-health-action-pill.tone-neutral {
  background: rgba(107, 114, 128, 0.13);
  color: #4b5563;
}

.menu-health-widget-panel {
  margin-top: 18px;
}

.menu-health-widget-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  color: var(--deep-forest);
}

.menu-health-filter--compact {
  width: min(100%, 320px);
  flex-shrink: 0;
}

.menu-health-widget-overview {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  align-items: flex-start;
  padding: 18px 20px;
  border-radius: 5px;
  background: linear-gradient(
    135deg,
    rgba(0, 102, 68, 0.08),
    rgba(255, 255, 255, 0.75)
  );
  border: 1px solid rgba(0, 102, 68, 0.12);
  margin-bottom: 18px;
}

.menu-health-widget-badge {
  min-width: 88px;
  height: 88px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #1e6933;
  color: #fffdf6;
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.menu-health-widget-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.menu-health-widget-copy h3 {
  display: block;
  margin: 0;
  font-family: Urbanist, sans-serif;
  color: var(--deep-forest);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.menu-health-widget-copy p {
  margin: 0;
  color: #566358;
  font-size: 0.9rem;
  line-height: 1.5;
}

.menu-health-widget-copy small {
  color: #6f7b71;
  font-size: 0.8rem;
  line-height: 1.45;
}

.menu-health-metric-note {
  margin: 0 0 14px;
  color: #5f6d61;
  font-size: 0.82rem;
  line-height: 1.5;
}

.menu-health-widget-controls {
  margin-bottom: 14px;
  width: min(100%, 1120px);
  position: relative;
  z-index: 6;
}

.menu-health-widget-controls .search-input {
  flex: 3 1 360px;
  min-width: 320px;
  max-width: none;
  width: auto;
}

.menu-health-widget-controls .filter-menu {
  z-index: 40;
}

.menu-health-analytics-card {
  margin-bottom: 18px;
}

.menu-health-filter {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menu-health-filter span {
  color: #6f746b;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.menu-health-filter select {
  appearance: none;
  border: 1px solid rgba(0, 102, 68, 0.12);
  border-radius: 16px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.94),
    rgba(246, 249, 246, 0.94)
  );
  padding: 14px 42px 14px 14px;
  font-family: Urbanist, sans-serif;
  font-size: 1rem;
  color: #2d3b31;
  background-image:
    linear-gradient(45deg, transparent 50%, #94a3b8 50%),
    linear-gradient(135deg, #94a3b8 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-size:
    6px 6px,
    6px 6px;
  background-repeat: no-repeat;
}

.menu-health-filter select:focus {
  outline: none;
  border-color: rgba(0, 102, 68, 0.34);
  box-shadow: 0 0 0 4px rgba(0, 102, 68, 0.08);
}

.menu-health-analytics-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.88fr) minmax(0, 1.12fr);
  gap: 18px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.menu-health-analytics-grid > * {
  min-width: 0;
  max-width: 100%;
}

.menu-health-chart-card {
  border-radius: 5px;
  background: rgba(255, 251, 239, 0.68);
  border: 1px solid rgba(0, 102, 68, 0.08);
  padding: 22px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.menu-health-chart-shell canvas {
  max-width: 100% !important;
}

.menu-health-chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.menu-health-chart-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.menu-health-chart-icon-button {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(0, 102, 68, 0.14);
  background: rgba(255, 255, 255, 0.72);
  color: var(--deep-forest);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    transform 0.2s var(--ease-out),
    background-color 0.2s var(--ease-out),
    border-color 0.2s var(--ease-out);
}

.menu-health-chart-icon-button svg {
  width: 20px;
  height: 20px;
}

.menu-health-chart-icon-button:hover {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(37, 99, 235, 0.22);
  transform: translateY(-1px);
}

.menu-health-chart-icon-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.menu-health-chart-reset {
  border: 1px solid rgba(0, 102, 68, 0.14);
  background: rgba(255, 255, 255, 0.72);
  color: var(--deep-forest);
  border-radius: 999px;
  padding: 8px 12px;
  font:
    600 0.82rem/1 Urbanist,
    sans-serif;
  cursor: pointer;
  white-space: nowrap;
}

.menu-health-chart-reset:hover {
  background: rgba(255, 255, 255, 0.9);
}

.menu-health-chart-shell {
  position: relative;
  min-height: 380px;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.menu-health-goal-settings {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.menu-health-goal-settings .popup-header {
  padding-right: 42px;
}

.menu-health-goal-summary {
  margin: 0;
  color: #667085;
  font-size: 0.92rem;
  line-height: 1.55;
}

.menu-health-goal-mode-field {
  display: grid;
  gap: 8px;
}

.menu-health-goal-mode-field label {
  color: #475467;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.menu-health-goal-mode-field small {
  color: #667085;
  font-size: 0.88rem;
  line-height: 1.45;
}

.menu-health-goal-mode-select {
  appearance: none;
  width: 100%;
  border: 1px solid rgba(0, 102, 68, 0.12);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 249, 246, 0.96));
  padding: 13px 42px 13px 14px;
  font:
    600 0.96rem/1.3 Urbanist,
    sans-serif;
  color: #24362b;
  background-image:
    linear-gradient(45deg, transparent 50%, #94a3b8 50%),
    linear-gradient(135deg, #94a3b8 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-size:
    6px 6px,
    6px 6px;
  background-repeat: no-repeat;
}

.menu-health-goal-mode-select:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.28);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}

.menu-health-goal-grid {
  display: grid;
  gap: 10px;
}

.menu-health-goal-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(0, 102, 68, 0.08);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.78);
  padding: 12px 14px;
}

.menu-health-goal-row label {
  display: block;
  color: #24362b;
  font:
    700 0.98rem/1.35 Urbanist,
    sans-serif;
}

.menu-health-goal-row small {
  display: block;
  margin-top: 4px;
  color: #667085;
  font-size: 0.86rem;
}

.menu-health-goal-input {
  width: 100%;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 12px;
  padding: 12px 14px;
  font:
    600 0.98rem/1.2 Urbanist,
    sans-serif;
  color: #24362b;
  background: #ffffff;
  text-align: right;
}

.menu-health-goal-input:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.36);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}

.menu-health-goal-input.is-invalid {
  border-color: rgba(180, 35, 24, 0.4);
  box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.08);
}

.menu-health-goal-helper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: #667085;
  font-size: 0.9rem;
}

.menu-health-goal-helper strong {
  color: var(--deep-forest);
}

.menu-health-goal-feedback {
  min-height: 22px;
  color: #667085;
  font-size: 0.92rem;
}

.menu-health-goal-feedback.is-error {
  color: #b42318;
}

.menu-health-goal-feedback.is-success {
  color: #0f766e;
}

.menu-health-goal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.menu-health-goal-actions .btn {
  min-width: 120px;
}

.menu-health-table .empty-state {
  text-align: center;
  color: #6b7280;
  padding: 32px 16px;
}

@media (max-width: 1400px) {
  .menu-health-filter-controls,
  .menu-health-actions-controls {
    width: 100%;
  }

  .menu-health-chart-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .menu-health-widget-panel-header {
    flex-direction: column;
  }
}

@media (max-width: 1180px) {
  .menu-health-hero,
  .menu-health-analytics-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .menu-health-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .menu-health-score-stats {
    grid-template-columns: 1fr 1fr;
  }

  .menu-health-card,
  .menu-health-chart-card {
    padding: 22px;
  }

  .menu-health-actions-controls .filter-dropdown,
  .menu-health-actions-controls .menu-health-action-switch,
  .menu-health-widget-controls .filter-dropdown {
    flex: 1 1 calc(50% - 0.5rem);
    min-width: 180px;
  }

  .menu-health-actions-controls .search-input,
  .menu-health-widget-controls .search-input {
    flex: 1 1 100%;
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .dashboard-layout {
    padding-right: 0;
  }

  .menu-health-page {
    padding-top: 0;
    padding-bottom: 0;
  }

  .menu-health-goal-row {
    grid-template-columns: 1fr;
  }

  .menu-health-goal-input {
    text-align: left;
  }

  .menu-health-score-stats {
    grid-template-columns: 1fr;
  }

  .menu-health-widget-overview {
    grid-template-columns: 1fr;
  }

  .menu-health-widget-badge {
    width: 88px;
  }

  .menu-health-table tbody td,
  .menu-health-table thead th {
    padding: 12px;
  }

  .menu-health-actions-controls .filter-dropdown,
  .menu-health-actions-controls .menu-health-action-switch,
  .menu-health-widget-controls .filter-dropdown {
    flex-basis: 100%;
    min-width: 0;
  }

  .menu-health-card-header,
  .menu-health-card-header--actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .menu-health-gauge-shell {
    min-height: 190px;
  }
}

/* Driver.js onboarding theme */
.driver-popover {
  border-radius: 10px;
  border: 1px solid var(--graphite-10);
  box-shadow: var(--shadow-lg);
}

.driver-popover-title {
  color: var(--color-primary);
  font-family: Urbanist, sans-serif;
  font-weight: 700;
}

.driver-popover-description {
  color: var(--color-text);
  font-family: Urbanist, sans-serif;
}

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

.driver-popover-footer button {
  border-radius: 8px;
  border: 1px solid var(--graphite-20);
  font-family: Urbanist, sans-serif;
  font-weight: 600;
}

.driver-popover-footer .driver-popover-next-btn {
  background: var(--primary-green);
  border-color: var(--primary-green);
  color: #fff;
  text-shadow: none;
}

.driver-popover-footer .driver-popover-prev-btn {
  color: var(--color-primary);
}

.dashboard-onboarding-popup-focus .driver-overlay,
.dashboard-onboarding-popup-focus .driver-overlay-animated,
.dashboard-onboarding-popup-focus .driver-stage,
.dashboard-onboarding-popup-focus .driver-stage-no-animation {
  display: none !important;
  opacity: 0 !important;
}

.dashboard-onboarding-popup-focus .driver-active-element {
  box-shadow: none !important;
}

.dashboard-onboarding-popup-focus .popup-modal,
.dashboard-onboarding-popup-focus .popup-content {
  animation: none !important;
}

/* Viewport notice (mobile): must sit above Driver.js (overlay click closes tour) and support FAB */
body.dashboard-viewport-notice-open .popup-modal--viewport-notice {
  z-index: 2147483647 !important;
}

body.dashboard-viewport-notice-open .feedback-fab-group {
  z-index: 2147483600 !important;
}

body.dashboard-viewport-notice-open .popup-modal--viewport-notice,
body.dashboard-viewport-notice-open .popup-modal--viewport-notice * {
  pointer-events: auto;
}

body.dashboard-viewport-notice-open .driver-overlay,
body.dashboard-viewport-notice-open .driver-overlay-animated,
body.dashboard-viewport-notice-open .driver-stage,
body.dashboard-viewport-notice-open .driver-stage-no-animation {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

body.dashboard-viewport-notice-open .driver-popover {
  visibility: hidden !important;
  pointer-events: none !important;
}

body.dashboard-viewport-notice-open .driver-active-element {
  box-shadow: none !important;
}

.driver-popover {
  z-index: 1000001 !important;
}

/* Feedback Widget */

.feedback-fab-group {
  --fab-action-width: 148px;
  --fab-action-height: 56px;
  --fab-toggle-size: 68px;
  --tawk-offset-right: 20px;
  --tawk-offset-bottom: 20px;
  --fab-toggle-bg: var(--primary-green);
  --fab-toggle-bg-hover: var(--deep-forest);
  position: fixed;
  bottom: max(var(--tawk-offset-bottom), env(safe-area-inset-bottom, 0px));
  right: max(var(--tawk-offset-right), env(safe-area-inset-right, 0px));
  z-index: 2147483647;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  max-width: calc(100% - var(--tawk-offset-right));
  box-sizing: border-box;
  transition:
    opacity 0.25s var(--ease-out),
    transform 0.25s var(--ease-out);
}

/* Tawk embed: keep injected root from widening the document */
#tawkchat-container {
  max-width: 100%;
  box-sizing: border-box;
}

.feedback-fab-group.hidden {
  transform: translateY(12px) scale(0.92);
  opacity: 0;
  pointer-events: none;
}

.feedback-fab-actions {
  position: absolute;
  right: 0;
  bottom: calc(var(--fab-toggle-size) + 12px);
  width: var(--fab-action-width);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  transform-origin: bottom right;
  pointer-events: none;
  visibility: hidden;
  transition:
    opacity 0.2s var(--ease-out),
    transform 0.2s var(--ease-out),
    visibility 0.2s step-end;
}

.feedback-fab-group.expanded .feedback-fab-actions {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
  transition:
    opacity 0.22s var(--ease-out),
    transform 0.22s var(--ease-out),
    visibility 0s step-start;
}

.feedback-fab-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--fab-toggle-size);
  height: var(--fab-toggle-size);
  padding: 0;
  background: var(--fab-toggle-bg);
  color: #fff;
  border: 3px solid var(--warm-cream);
  border-radius: 999px;
  box-shadow: 0 16px 32px rgba(0, 102, 68, 0.2);
  cursor: pointer;
  transition:
    transform 0.2s var(--ease-out),
    box-shadow 0.2s var(--ease-out),
    background 0.2s var(--ease-out);
}

.feedback-fab-toggle:hover {
  background: var(--fab-toggle-bg-hover);
  box-shadow: 0 18px 34px rgba(30, 86, 49, 0.28);
}

/* Avoid oversized browser focus ring (often reads as a second “bubble”) */
.feedback-fab-toggle:focus {
  outline: none;
}

.feedback-fab-toggle:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.95);
  outline-offset: 3px;
}

.feedback-fab-toggle-icon {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  pointer-events: none;
  transition:
    opacity 0.18s var(--ease-out),
    transform 0.18s var(--ease-out);
}

.feedback-fab-toggle-icon-chat {
  opacity: 1;
  transform: scale(1);
}

.feedback-fab-toggle-icon-close {
  opacity: 0;
  transform: scale(0.72) rotate(-12deg);
}

.feedback-fab-group.expanded .feedback-fab-toggle,
.feedback-fab-group.chat-open .feedback-fab-toggle {
  background: var(--fab-toggle-bg-hover);
  box-shadow: 0 18px 36px rgba(30, 86, 49, 0.28);
}

.feedback-fab-group.expanded .feedback-fab-toggle-icon-chat,
.feedback-fab-group.chat-open .feedback-fab-toggle-icon-chat {
  opacity: 0;
  transform: scale(0.7) rotate(12deg);
}

.feedback-fab-group.expanded .feedback-fab-toggle-icon-close,
.feedback-fab-group.chat-open .feedback-fab-toggle-icon-close {
  opacity: 1;
  transform: scale(1) rotate(0);
}

/* Shared style for both primary launcher pills */
.feedback-fab,
.chat-fab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: var(--fab-action-width);
  height: var(--fab-action-height);
  padding: 0 18px;
  background: var(--primary-green);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-family: Urbanist, sans-serif;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all 0.25s var(--ease-out);
  flex-shrink: 0;
}

.feedback-fab:hover,
.chat-fab:hover {
  background: var(--deep-forest);
  box-shadow: 0 8px 24px rgba(0, 102, 68, 0.35);
}

/* Panel */

.feedback-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1001;
  width: 380px;
  max-width: min(380px, calc(100% - 48px));
  max-height: calc(100vh - 48px);
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s var(--ease-out);
}

.feedback-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.feedback-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--graphite-10);
}

.feedback-panel-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--graphite-ink);
}

.feedback-panel-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--graphite-70);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s;
}

.feedback-panel-close:hover {
  color: var(--graphite-ink);
}

.feedback-panel-body {
  padding: 16px 20px 20px;
  overflow-y: auto;
  flex: 1;
}

/* Fields */

.feedback-field {
  margin-bottom: 14px;
}

.feedback-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--graphite-70);
  margin-bottom: 6px;
}

.feedback-field input[type="text"],
.feedback-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--graphite-10);
  border-radius: 8px;
  font-family: Urbanist, sans-serif;
  font-size: 14px;
  transition: border-color 0.2s;
  resize: vertical;
}

.feedback-field input[type="text"]:focus,
.feedback-field textarea:focus {
  outline: none;
  border-color: var(--primary-green);
}

/* Type selector buttons */

.feedback-type-group {
  display: flex;
  gap: 6px;
}

.feedback-type-btn {
  flex: 1;
  padding: 8px 4px;
  border: 1px solid var(--graphite-10);
  border-radius: 8px;
  background: transparent;
  color: var(--graphite-70);
  font-family: Urbanist, sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.feedback-type-btn:hover {
  border-color: var(--graphite-20);
  color: var(--graphite-ink);
}

.feedback-type-btn.active {
  background: var(--primary-green-10);
  border-color: var(--primary-green);
  color: var(--primary-green);
  font-weight: 600;
}

/* Screenshot actions */

.feedback-screenshot-actions {
  display: flex;
  gap: 6px;
}

.feedback-screenshot-actions > .feedback-action-btn {
  flex: 1 1 0;
}

.feedback-action-btn {
  display: flex !important;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 42px;
  padding: 8px 6px !important;
  font-size: 12px !important;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.feedback-upload-label {
  margin-bottom: 0 !important;
  color: var(--primary-green) !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  line-height: 1.2;
  cursor: pointer;
}

/* Screenshot preview */

.feedback-preview {
  position: relative;
  margin-top: 10px;
  border: 1px solid var(--graphite-10);
  border-radius: 5px;
  overflow: hidden;
}

.feedback-preview img {
  display: block;
  width: 100%;
  max-height: 160px;
  object-fit: contain;
  background: var(--warm-cream);
}

.feedback-remove-img {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 16px;
  line-height: 24px;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s;
}

.feedback-remove-img:hover {
  background: var(--color-danger);
}

/* Submit button */

.feedback-submit-btn {
  width: 100%;
  margin-top: 4px;
}

/* Snip overlay */

.feedback-snip-overlay {
  position: fixed;
  inset: 0;
  width: auto;
  height: auto;
  max-width: 100%;
  z-index: 10000;
  cursor: crosshair;
  background-size: 100% 100%;
  background-color: rgba(0, 0, 0, 0.3);
}

.feedback-snip-selection {
  position: fixed;
  border: 2px solid var(--primary-green);
  background: rgba(0, 102, 68, 0.1);
  pointer-events: none;
}

/* Responsive */

@media (max-width: 480px) {
  .feedback-panel {
    width: calc(100% - 24px);
    max-width: calc(100% - 24px);
    right: 12px;
    bottom: 12px;
  }

  .feedback-fab-group {
    --fab-action-width: 132px;
    --fab-action-height: 52px;
    --fab-toggle-size: 60px;
    --tawk-offset-right: 12px;
    --tawk-offset-bottom: 12px;
  }

  .feedback-type-group {
    flex-direction: column;
  }
}

/* ===== MOBILE-FIRST TABLE CARD LAYOUTS ===== */

@media (max-width: 768px) {
  h1 {
    font-size: 32px;
  }

  h2,
  .section-header h2,
  .dashboard-header h2 {
    font-size: 24px;
  }

  h3,
  .recommendations-section h3 {
    font-size: 20px;
  }

  .recommendations-section,
  .competitor-pricing-section,
  .products-table-wrapper {
    padding: 16px;
  }

  .dashboard-main {
    padding: 8px 0;
  }

  .dashboard-error-main {
    align-items: flex-start;
  }

  .dashboard-error-container {
    min-height: calc(100vh - 96px);
    justify-content: flex-start;
  }

  .dashboard-error-panel h1 {
    font-size: 32px;
  }

  .dashboard-error-copy {
    font-size: 16px;
  }

  .dashboard-error-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-error-action {
    width: 100%;
  }

  .main-content {
    padding: 16px 0;
  }

  .container {
    padding: 0 12px;
  }

  .metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
  }

  .metric-card {
    padding: 1rem 1.25rem;
  }

  .pricing-rules-page-header.dashboard-header {
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 18px;
  }

  .pricing-rules-title-group {
    width: 100%;
  }

  .pricing-rules-back-link {
    min-height: 44px;
    font-size: 0.95rem;
  }

  .pricing-rules-header-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    gap: 10px;
  }

  .pricing-rules-header-actions:not(.has-import-action) {
    grid-template-columns: 1fr;
  }

  .pricing-rules-header-actions .btn {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    padding: 0.75rem 0.875rem;
  }

  .rules-application-note {
    align-items: flex-start;
    gap: 6px;
    margin-top: 0;
  }

  .metric-number {
    font-size: 1.5rem;
  }

  .metric-header h3 {
    font-size: 0.8rem;
  }

  .metric-period {
    font-size: 0.625rem;
  }

  .section-header {
    margin-bottom: 1rem;
    gap: 0.75rem;
  }

  .recommendations-header-row {
    gap: 0.5rem;
  }

  .recommendations-header-row h3 {
    font-size: 18px;
  }

  .popup-content {
    width: min(96%, calc(100% - 24px));
    margin: 2% auto;
    max-height: 96vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  .popup-modal--viewport-notice .popup-content--viewport-notice {
    width: min(420px, calc(100% - 24px));
    max-width: min(420px, calc(100% - 24px));
    margin: 16px auto;
  }

  .top-section {
    flex-direction: column;
    gap: 1rem;
  }

  .map-container .section-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .map-container .section-header h3 {
    flex: none;
  }

  .competitor-map-controls {
    width: 100%;
    justify-content: flex-start;
  }

  .competitor-map-controls .filter-dropdown {
    flex: 1 1 100%;
    min-width: 0;
  }

  #dispensary-search {
    width: 100%;
    max-width: 100%;
    flex: none;
  }

  #map {
    height: 280px;
  }

  .chart-container {
    height: 260px;
  }

  .partner-dispensary-buttons {
    gap: 0.5rem;
    margin-bottom: 1rem;
  }

  .dispensary-button {
    min-width: 100%;
  }

  .notification-toast {
    left: 12px;
    right: 12px;
    transform: none;
    width: auto;
  }

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

  /* --- RECOMMENDATIONS TABLE -> CARD LAYOUT --- */

  .recommendations-table-wrap {
    max-height: none;
    overflow-x: hidden;
    overflow-y: visible;
  }

  #recommendations-table.table {
    table-layout: auto;
  }

  #recommendations-table.table thead {
    display: none;
  }

  #recommendations-table.table tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    padding: 14px 16px;
    border: 1px solid var(--color-border);
    border-radius: 2px;
    margin-bottom: 10px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  }

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

  #recommendations-table.table .table-cell,
  #recommendations-table.table td.recommendations-actions {
    display: flex;
    flex-direction: column;
    padding: 6px 4px;
    border-bottom: none;
    width: auto !important;
    text-align: left;
  }

  #recommendations-table.table .table-cell::before,
  #recommendations-table.table td.recommendations-actions::before {
    content: attr(data-label);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-muted);
    margin-bottom: 2px;
  }

  #recommendations-table.table .table-cell--product {
    grid-column: 1 / -1;
    padding-bottom: 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--color-border);
  }

  #recommendations-table.table .table-cell--product::before {
    display: none;
  }

  .table .table-cell--retailer {
    /* Retailer cell uses default stacked behavior, not product-specific full-width */
  }

  #recommendations-table.table td.recommendations-actions {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding-top: 8px;
    margin-top: 4px;
    border-top: 1px solid var(--color-border);
  }

  #recommendations-table.table td.recommendations-actions::before {
    display: none;
  }

  #recommendations-table.table td.recommendations-actions .action-buttons {
    justify-content: flex-start;
    width: 100%;
  }

  #recommendations-table.table td.recommendations-actions .action-btn {
    min-width: 104px;
    min-height: 40px;
  }

  #recommendations-table.table .table-cell--profit,
  #recommendations-table.table .table-cell--units {
    border-radius: 2px;
    margin: 2px;
    padding: 6px 8px;
  }

  #recommendations-table.table tbody tr:only-child:has(.empty-state) {
    display: table-row;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
  }

  #recommendations-table.table tbody tr:only-child .empty-state {
    display: table-cell;
    border-bottom: none;
  }

  #recommendations-table.table tbody tr:only-child .empty-state::before {
    display: none;
  }

  #pricing-table.table tbody tr:only-child:has(.empty-state) {
    display: table-row;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
  }

  #pricing-table.table tbody tr:only-child .empty-state {
    display: table-cell;
    border-bottom: none;
  }

  #pricing-table.table tbody tr:only-child .empty-state::before {
    display: none;
  }

  .menu-health-table tbody tr:only-child:has(.empty-state) {
    display: table-row;
    border: none;
    padding: 0;
    margin: 0;
  }

  .menu-health-table tbody tr:only-child .empty-state {
    display: table-cell;
    border-bottom: none;
  }

  .menu-health-table tbody tr:only-child .empty-state::before {
    display: none;
  }

  .rec-product-name {
    font-size: 1rem;
  }

  .rec-product-meta {
    font-size: 0.75rem;
  }

  .recommendations-pagination {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding-top: 16px;
  }

  .pagination-summary {
    text-align: center;
  }

  .pagination-controls {
    justify-content: center;
    flex-wrap: wrap;
  }

  /* --- COMPETITOR TABLE -> CARD LAYOUT --- */

  #pricing-table.table thead {
    display: none;
  }

  #pricing-table.table tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    padding: 14px 16px;
    border: 1px solid var(--color-border);
    border-radius: 2px;
    margin-bottom: 10px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  }

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

  #pricing-table.table .table-cell {
    display: flex;
    flex-direction: column;
    padding: 6px 4px;
    border-bottom: none;
    width: auto !important;
    text-align: left;
  }

  #pricing-table.table .table-cell::before {
    content: attr(data-label);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-muted);
    margin-bottom: 2px;
  }

  #pricing-table.table .table-cell--product {
    grid-column: 1 / -1;
    padding-bottom: 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--color-border);
    font-weight: 600;
  }

  #pricing-table.table .table-cell--product::before {
    display: none;
  }

  /* --- MENU HEALTH TABLES -> MOBILE STACK --- */

  .menu-health-table-wrap--actions,
  .menu-health-table-wrap--widget {
    height: auto;
    max-height: 520px;
    overflow-x: auto;
  }

  .menu-health-table thead {
    display: none;
  }

  .menu-health-table tbody tr {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    padding: 14px 16px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 2px;
    margin-bottom: 8px;
    background: #fff;
  }

  .menu-health-table tbody tr:nth-child(even) {
    background: #fff;
  }

  .menu-health-table tbody td {
    display: flex;
    flex-direction: column;
    padding: 4px 0;
    border-bottom: none;
  }

  .menu-health-table tbody td::before {
    content: attr(data-label);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-muted);
    margin-bottom: 2px;
  }

  .menu-health-table tbody td:empty::before {
    display: none;
  }

  .menu-health-hero {
    grid-template-columns: 1fr;
  }

  .menu-health-chart-shell {
    min-height: 280px;
  }

  .menu-health-analytics-grid {
    grid-template-columns: 1fr;
  }

  .menu-health-widget-panel-header {
    flex-direction: column;
    gap: 12px;
  }

  .menu-health-filter--compact {
    width: 100%;
  }
}

@media (max-width: 1024px) {
  .recommendations-pagination {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: stretch;
    gap: 0.75rem;
    padding-top: 10px;
    margin-top: 12px;
  }

  .pagination-summary {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

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

  .pagination-controls .pagination-btn:not([data-nav]) {
    display: none;
  }

  .pagination-controls .pagination-btn[data-nav] {
    width: 100%;
    min-height: 44px;
  }

  .recommendations-table-wrap,
  .menu-health-table-wrap {
    max-height: none;
    overflow-x: hidden;
    overflow-y: visible;
  }

  #recommendations-table.table thead,
  #pricing-table.table thead,
  #results-table.table thead,
  .menu-health-table thead {
    display: none;
  }

  #recommendations-table.table tbody tr,
  #pricing-table.table tbody tr,
  #results-table.table tbody tr,
  .menu-health-table tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.15rem 0.75rem;
    padding: 16px;
    border: 1px solid var(--border-soft);
    border-radius: 2px;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: none;
  }

  #recommendations-table.table .table-cell,
  #recommendations-table.table td.recommendations-actions,
  #pricing-table.table .table-cell,
  #results-table.table .table-cell,
  .menu-health-table tbody td {
    display: flex;
    flex-direction: column;
    padding: 4px 0;
    border-bottom: none;
    width: auto !important;
    text-align: left;
  }

  #recommendations-table.table .table-cell::before,
  #recommendations-table.table td.recommendations-actions::before,
  #pricing-table.table .table-cell::before,
  #results-table.table .table-cell::before,
  .menu-health-table tbody td::before {
    content: attr(data-label);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-muted);
    margin-bottom: 2px;
  }

  #recommendations-table.table .table-cell--product,
  #pricing-table.table .table-cell--product,
  #results-table.table .table-cell--product {
    grid-column: 1 / -1;
    padding-bottom: 8px;
    margin-bottom: 4px;
  }

  #recommendations-table.table .table-cell--product::before,
  #pricing-table.table .table-cell--product::before,
  #results-table.table .table-cell--product::before {
    display: none;
  }

  #recommendations-table.table td.recommendations-actions {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    padding-top: 8px;
    margin-top: 4px;
  }

  #recommendations-table.table td.recommendations-actions::before {
    display: none;
  }

  #recommendations-table.table tbody tr:has(.empty-state),
  #pricing-table.table tbody tr:has(.empty-state),
  #results-table.table tbody tr:has(.empty-state),
  .menu-health-table tbody tr:has(.empty-state) {
    display: table-row;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
    background: transparent;
  }

  #recommendations-table.table tbody tr .empty-state,
  #pricing-table.table tbody tr .empty-state,
  #results-table.table tbody tr .empty-state,
  .menu-health-table tbody tr .empty-state {
    display: table-cell;
    border-bottom: none;
  }

  #recommendations-table.table tbody tr .empty-state::before,
  #pricing-table.table tbody tr .empty-state::before,
  #results-table.table tbody tr .empty-state::before,
  .menu-health-table tbody tr .empty-state::before,
  .menu-health-table tbody td:empty::before {
    display: none;
  }
}

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

  .recommendation-popup-grid {
    grid-template-columns: 1fr;
  }

  #recommendations-table.table tbody tr {
    grid-template-columns: 1fr;
  }

  #pricing-table.table tbody tr {
    grid-template-columns: 1fr;
  }

  #results-table.table tbody tr,
  .menu-health-table tbody tr {
    grid-template-columns: 1fr;
  }

  .dispensary-details {
    flex-direction: column;
    text-align: center;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Product Intelligence Page
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Header */
.pd-page-header {
  margin-bottom: 0;
}

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

.pd-header-title {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.pd-header-copy {
  max-width: 52ch;
}

/* Store row: same flex footprint as .menu-health-store-toolbar */
.pd-store-filter-toolbar {
  margin-bottom: 18px;
}

.pd-store-filter-toolbar .filter-controls {
  width: 100%;
}

.pd-store-filter-toolbar .filter-dropdown {
  flex: 0 1 280px;
  min-width: 240px;
}

.pd-freshness-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pd-freshness-badge {
  font-size: 0.6875rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--primary-green-10);
  color: var(--graphite-70);
  border: 1px solid var(--primary-green-20);
  white-space: nowrap;
}

.pd-freshness-badge--stale {
  background: rgba(232, 163, 13, 0.12);
  border-color: rgba(232, 163, 13, 0.4);
  color: #7a5100;
}

.pd-freshness-badge--timestamp {
  background: transparent;
  border-color: transparent;
  color: var(--graphite-70);
}

.pd-store-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--graphite-10);
  border-radius: 5px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.pd-store-toolbar .pd-control-group {
  gap: 0.625rem;
}

/* Top products: editorial index (rows), not cards — spacing + type hierarchy */
.pd-top5-section {
  margin-bottom: 1rem;
}

.pd-top5-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--graphite-70);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
  line-height: 1.35;
}

.pd-top5-strip {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  max-width: min(720px, 100%);
}

.pd-top5-loading,
.pd-top5-empty {
  font-size: 0.875rem;
  color: var(--graphite-70);
  padding: 0.5rem 0;
}

.pd-top5-row {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr) auto minmax(3.25rem, auto);
  align-items: center;
  column-gap: 0.75rem;
  width: 100%;
  min-height: 44px;
  padding: 0.45rem 0.35rem;
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.pd-top5-row:hover {
  background: rgba(0, 102, 68, 0.05);
}

.pd-top5-row:focus-visible {
  outline: 2px solid var(--primary-green-20);
  outline-offset: 1px;
}

.pd-top5-row--active {
  background: rgba(0, 102, 68, 0.09);
}

.pd-top5-row--active .pd-top5-name {
  color: var(--primary-green);
}

.pd-top5-rank {
  font-family: IBM Plex Mono, monospace;
  font-size: 0.75rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--graphite-70);
  letter-spacing: -0.02em;
}

.pd-top5-row--active .pd-top5-rank {
  color: var(--primary-green);
  font-weight: 600;
}

.pd-top5-product {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  min-width: 0;
}

.pd-top5-name {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--graphite-ink);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.pd-top5-meta {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--graphite-70);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.pd-top5-vel {
  display: inline-flex;
  align-items: baseline;
  gap: 0.2rem;
  white-space: nowrap;
}

.pd-top5-vel-num {
  font-family: IBM Plex Mono, monospace;
  font-size: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--primary-green);
  letter-spacing: -0.02em;
}

.pd-top5-vel-unit {
  font-family: Urbanist, sans-serif;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--graphite-70);
}

.pd-top5-gm {
  font-family: IBM Plex Mono, monospace;
  font-size: 0.75rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--graphite-70);
  text-align: right;
  white-space: nowrap;
}

.pd-top5-gm-num {
  margin-right: 0.15rem;
}

.pd-top5-gm-suffix {
  font-family: Urbanist, sans-serif;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--graphite-70);
  text-transform: uppercase;
}

/* Desktop: denser vertical rhythm (touch-friendly 44px rows stay on ≤1024) */
@media (min-width: 1025px) {
  .pd-top5-section {
    margin-bottom: 0.65rem;
  }

  .pd-top5-label {
    margin-bottom: 0.2rem;
    line-height: 1.25;
  }

  .pd-top5-strip {
    gap: 0;
  }

  .pd-top5-row {
    min-height: 0;
    padding: 0.2rem 0.25rem;
    column-gap: 0.65rem;
    align-items: baseline;
    grid-template-columns: 2rem minmax(0, 1fr) auto minmax(2.75rem, auto);
  }

  .pd-top5-product {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: baseline;
    gap: 0;
  }

  .pd-top5-meta:not(:empty)::before {
    content: "·";
    margin: 0 0.35rem;
    color: var(--graphite-70);
    font-weight: 500;
  }

  .pd-top5-name {
    font-size: 0.875rem;
    line-height: 1.15;
  }

  .pd-top5-meta {
    font-size: 0.6875rem;
    line-height: 1.15;
  }

  .pd-top5-rank {
    font-size: 0.6875rem;
  }

  .pd-top5-vel-num {
    font-size: 0.875rem;
  }

  .pd-top5-vel-unit {
    font-size: 0.625rem;
  }

  .pd-top5-gm {
    font-size: 0.6875rem;
  }
}

/* Product typeahead */
.pd-product-selector-wrap {
  margin-bottom: 1rem;
}

.pd-typeahead-wrap {
  position: relative;
  max-width: 560px;
}

.pd-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--graphite-70);
  pointer-events: none;
  flex-shrink: 0;
}

.pd-product-input {
  width: 100%;
  padding: 0.625rem 1rem;
  border: 1.5px solid var(--graphite-20);
  border-radius: 8px;
  font-size: 0.9375rem;
  font-family: inherit;
  background: #fff;
  color: var(--graphite-ink);
  outline: none;
  transition: border-color 0.2s;
}

.pd-product-input--with-icon {
  padding-left: 2.375rem;
}

.pd-product-input:focus {
  border-color: var(--primary-green);
  box-shadow: 0 0 0 3px var(--primary-green-10);
}

.pd-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--graphite-20);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  max-height: 280px;
  overflow-y: auto;
  z-index: 500;
}

.pd-suggestion-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 1rem;
  border: 0;
  border-bottom: 1px solid rgba(34, 34, 34, 0.06);
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.875rem;
  text-align: left;
  outline: none;
}

.pd-suggestion-item:last-child {
  border-bottom: 0;
}

.pd-suggestion-item:hover,
.pd-suggestion-item:focus,
.pd-suggestion-item--active {
  background: var(--primary-green-10);
}

.pd-suggestion-item--active .pd-sug-name {
  color: var(--primary-green);
}

.pd-suggestion-empty {
  padding: 0.75rem 1rem;
  color: var(--graphite-70);
  font-size: 0.875rem;
}

.pd-sug-name {
  display: block;
  font-weight: 600;
  color: var(--graphite-ink);
  line-height: 1.25;
}

.pd-sug-main {
  min-width: 0;
}

.pd-sug-line {
  display: block;
  margin-top: 0.125rem;
  color: var(--graphite-70);
  font-size: 0.75rem;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pd-sug-vel {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary-green);
  margin-left: auto;
  white-space: nowrap;
}

/* Controls bar */
.pd-controls {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid var(--graphite-10);
  border-radius: 10px;
}

.pd-control-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pd-control-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--graphite-70);
  white-space: nowrap;
}

.pd-date-input {
  padding: 0.375rem 0.625rem;
  border: 1px solid var(--graphite-20);
  border-radius: 6px;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--graphite-ink);
  background: #fff;
  outline: none;
  cursor: pointer;
}

.pd-date-input:focus {
  border-color: var(--primary-green);
}

/* Stacking above typeahead; trigger uses global .filter-select (menu-health shape) */
#pd-store-filter .filter-menu {
  z-index: 700;
}

/* Empty state */
.pd-empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--graphite-70);
}

.pd-empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.pd-empty-state-text {
  font-size: 1.0625rem;
  color: var(--graphite-70);
}

/* Identity bar */
.pd-identity-bar {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  background: rgba(0, 102, 68, 0.08);
  border: 1px solid rgba(0, 102, 68, 0.14);
  border-radius: 2px;
  color: var(--graphite-ink);
}

.pd-identity-name {
  font-size: 1.125rem;
  font-weight: 700;
}

.pd-identity-meta {
  font-size: 0.875rem;
  color: var(--graphite-70);
}

/* KPI grids */
.pd-kpi-section {
  margin-bottom: 0.5rem;
}

.pd-kpi-section--snapshot {
  margin-bottom: 1.25rem;
  /* Match text inset of .pd-identity-bar / .pd-controls (1rem inside container) */
  padding-left: 1rem;
  padding-right: 1rem;
}

.pd-section-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--graphite-70);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.625rem;
}

.pd-snapshot-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.pd-snapshot-header .pd-section-label {
  margin-bottom: 0;
}

.pd-snapshot-caption {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--graphite-70);
  letter-spacing: 0.01em;
  max-width: 24rem;
  text-align: right;
  line-height: 1.35;
}

.pd-snapshot-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  column-gap: 1rem;
  row-gap: 1.5rem;
  padding: 0.75rem 0 0.25rem;
  align-items: start;
}

.pd-snapshot-cell {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
}

.pd-snapshot-metrics .pd-kpi-label {
  margin-bottom: 0;
  min-height: 2.5em;
  line-height: 1.25;
}

.pd-snapshot-metrics .pd-kpi-value,
.pd-snapshot-metrics .pd-kpi-value--snapshot-lg,
.pd-snapshot-metrics .pd-kpi-value--snapshot-neutral,
.pd-snapshot-metrics .pd-kpi-value--sm {
  font-family: IBM Plex Mono, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.pd-kpi-value--snapshot-lg {
  font-size: clamp(1.35rem, 1.65vw, 1.85rem);
  font-weight: 700;
  color: var(--primary-green);
  line-height: 1.12;
}

.pd-kpi-value--snapshot-neutral {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--graphite-ink);
  line-height: 1.2;
}

.pd-kpi-grid {
  display: grid;
  gap: 0.875rem;
  margin-bottom: 0.875rem;
  align-items: stretch;
}

.pd-kpi-grid--row1 {
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
}

.pd-kpi-grid--row2 {
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  margin-bottom: 1.75rem;
  gap: 1rem 1.25rem;
}

.pd-kpi-card {
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0.2rem;
  padding: 0;
  background: transparent;
  border-right: none;
  transition: background 0.2s ease;
}

.pd-kpi-card:last-child {
  border-right: none;
}

.pd-kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--graphite-70);
  margin-bottom: 0.375rem;
  line-height: 1.3;
  min-height: 1.95em;
}

.pd-kpi-source {
  font-size: 0.6875rem;
  font-weight: 400;
  color: var(--graphite-70);
  opacity: 0.7;
}

.pd-kpi-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-green);
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-family: Urbanist, sans-serif;
}

.pd-kpi-value--sm {
  font-size: 1rem;
  color: var(--graphite-ink);
}

.pd-kpi-sub {
  font-size: 0.6875rem;
  color: var(--graphite-70);
  margin-top: 0.25rem;
  min-height: 1.1em;
}

/* Product detail tabs */
.pd-detail-tabs {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 0 0 -1px;
  padding: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.pd-detail-tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 42px;
  margin: 0 0 0 -1px;
  padding: 0.65rem 1rem;
  border: 1px solid var(--graphite-10);
  border-bottom-color: var(--graphite-10);
  border-radius: 8px 8px 0 0;
  background: #f6f7f5;
  color: var(--graphite-70);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.25;
  white-space: nowrap;
  cursor: pointer;
}

.pd-detail-tab:first-child {
  margin-left: 0;
}

.pd-detail-tab:hover,
.pd-detail-tab:focus-visible {
  background: #fff;
  color: var(--graphite-ink);
  outline: 2px solid var(--primary-green-20);
  outline-offset: -2px;
}

.pd-detail-tab--active {
  position: relative;
  z-index: 1;
  border-color: var(--graphite-10);
  border-bottom-color: #fff;
  background: #fff;
  color: var(--graphite-ink);
}

.pd-detail-tab-subtitle {
  color: var(--graphite-60);
  font-size: 0.75rem;
  font-weight: 600;
}

.pd-tab-panel[hidden] {
  display: none !important;
}

.pd-tab-panel--stack {
  display: flex;
  flex-direction: column;
}

.pd-tab-panel.pd-section,
.pd-tab-panel--stack > .pd-section:first-child {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.pd-detail-tab-select-wrap {
  display: none;
}

.pd-detail-tab-select-label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--graphite-70);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pd-detail-tab-select {
  width: 100%;
  min-height: 44px;
  padding: 0.6rem 2.5rem 0.6rem 0.85rem;
  border: 1px solid var(--graphite-10);
  border-radius: 8px;
  background: #fff;
  color: var(--graphite-ink);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
}

/* Sections */
.pd-section {
  margin-bottom: 2rem;
  background: #fff;
  border: 1px solid var(--graphite-10);
  border-radius: 2px;
  overflow: hidden;
}

.pd-section-header {
  padding: 1rem 1.25rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pd-section-header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--graphite-ink);
  margin: 0;
}

.pd-section-subtitle {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--graphite-70);
}

.pd-section-body {
  padding: 1.25rem;
}

.pd-subsection {
  margin-top: 1.5rem;
}

.pd-subsection-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--graphite-70);
  margin-bottom: 0.75rem;
}

.pd-table-block,
.pd-subsection {
  min-width: 0;
}

.pd-table-block {
  padding: 1.5rem;
}

.pd-table-wrap {
  width: 100%;
  max-width: 100%;
  max-height: min(58vh, 520px);
  overflow: auto;
  border: 1px solid rgba(34, 34, 34, 0.08);
  border-radius: 2px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  overflow-x: auto;
}

.pd-table-wrap .table {
  width: 100%;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

/* Desktop table sizing: percentage-based to avoid horizontal scroll */
#pd-inv-table,
#pd-sales-table,
#pd-discount-table,
#pd-store30-table,
#pd-batch30-table,
#pd-variants-table,
#pd-peers-table {
  min-width: 100%;
}

#pd-section-variants .pd-table-wrap {
  margin: 1.25rem 1.25rem 1.25rem;
  width: calc(100% - 2.5rem);
}

#pd-variants-table th[data-sort="size"],
#pd-variants-table td:first-child {
  width: 110px;
  max-width: 110px;
}

/* Keep Size Variants table spacing consistent with other tables */
#pd-section-variants .pd-table-wrap {
  padding: 0;
}

#pd-variants-table th,
#pd-variants-table td {
  padding: 11px 16px;
}

#pd-variants-table th {
  letter-spacing: 0.045em;
}

.pd-table-wrap .table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 12px 14px;
  background: #f8f9fa;
  border-bottom: 1px solid rgba(34, 34, 34, 0.1);
  color: rgba(34, 34, 34, 0.6);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.3;
  text-transform: uppercase;
  /* Match index #recommendations-table headers: label + sort arrow fit the cell */
  white-space: normal;
  word-break: break-word;
  min-width: 0;
  vertical-align: middle;
  box-shadow: 0 1px 0 rgba(34, 34, 34, 0.06);
  text-align: left;
}

/* Keep sort pill on one line when the label wraps (same pattern as .data-table) */
.pd-table-wrap .data-table th.sortable .sort-indicator {
  white-space: nowrap;
}

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

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

.pd-table-wrap .table tbody tr:hover {
  background: var(--primary-green-10);
}

.pd-table-wrap .table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(34, 34, 34, 0.06);
  color: var(--graphite-ink);
  font-size: 0.8125rem;
  line-height: 1.35;
  vertical-align: middle;
  white-space: normal;
}

.pd-table-wrap .table td:first-child,
.pd-table-wrap .table td:nth-child(2) {
  white-space: normal;
  overflow-wrap: anywhere;
}

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

.pd-table-wrap .empty-state {
  padding: 1.5rem;
  text-align: center;
}

.pd-mini-charts-row,
.pd-peer-body {
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
}

.pd-mini-charts-row {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
}

.pd-sales-timing-block {
  padding: 0 1.25rem 1.25rem;
  min-width: 0;
}

.pd-sales-timing-table-wrap {
  display: flex;
  flex-direction: column;
  /* gap: 1rem; */
  overflow: hidden;
}

.pd-sales-table-block {
  min-width: 0;
  overflow-x: auto;
}

.pd-sales-timing-block {
  min-width: 0;
  overflow: hidden;
}

.pd-sales-timing-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
  padding: 1rem 1.125rem 1.25rem;
  border: 1px solid var(--graphite-10);
  border-radius: 2px;
  background: #fff;
  overflow: hidden;
}

.pd-sales-timing-card .pd-subsection-title {
  margin-bottom: 0.35rem;
}

.pd-sales-timing-card > .pd-chart-title {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

@media (min-width: 1025px) {
  .pd-sales-timing-table-wrap {
    flex-direction: row;
    align-items: flex-start;
  }

  .pd-sales-timing-block {
    width: 25vw;
    flex-shrink: 0;
    padding-right: 1.25rem;
  }

  .pd-sales-table-block {
    flex: 1;
    min-width: 0;
  }
}

.pd-peer-body {
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  align-items: start;
  gap: 0.75rem;
  padding-top: 0.75rem;
}

.pd-mini-chart-card,
.pd-comp-chart-card {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--graphite-10);
  border-radius: 2px;
  background: #fff;
}

.pd-mini-chart-card,
.pd-comp-chart-card,
.pd-chart-card {
  overflow: hidden;
}

.pd-mini-chart-card canvas,
.pd-comp-chart-card canvas,
.pd-chart-card canvas {
  display: block;
  width: 100% !important;
  max-width: 100%;
}

.pd-mini-chart-card canvas {
  height: clamp(180px, 22vh, 260px) !important;
}

.pd-comp-chart-card canvas {
  height: clamp(190px, 24vh, 280px) !important;
}

.pd-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0 1.25rem 1rem;
}

.pd-table-block .pd-chips-row,
.pd-peer-body .pd-chips-row {
  padding-right: 0;
  padding-left: 0;
}

#pd-section-peers > .pd-chips-row {
  padding: 1rem 1.25rem 0.25rem;
}

.pd-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.375rem;
  padding: 0.35rem 0.625rem;
  border: 1px solid rgba(34, 34, 34, 0.08);
  border-radius: 999px;
  background: #fff;
  color: var(--graphite-70);
  font-size: 0.75rem;
  line-height: 1.2;
}

.pd-chip-value {
  color: var(--graphite-ink);
  font-family: IBM Plex Mono, monospace;
  font-weight: 500;
}

.pd-chip--green {
  border-color: var(--primary-green-20);
  background: var(--primary-green-10);
}

.pd-chip--warn {
  border-color: rgba(232, 163, 13, 0.3);
  background: rgba(232, 163, 13, 0.1);
}

.pd-chip--danger {
  border-color: rgba(211, 47, 47, 0.18);
  background: rgba(211, 47, 47, 0.08);
}

/* Inventory rollup */
.pd-inventory-rollup {
  padding: 0 0 0.5rem;
}

.pd-rollup-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding: 1rem 1.25rem;
}

.pd-rollup-stat {
  display: flex;
  flex-direction: column;
  min-width: 100px;
}

.pd-rollup-stat--comp {
  min-width: 70px;
}

.pd-rollup-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--graphite-70);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pd-rollup-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--graphite-ink);
  margin-top: 0.125rem;
}

.pd-rollup-empty {
  font-size: 0.875rem;
  color: var(--graphite-70);
}

/* Table utilities */
.pd-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: IBM Plex Mono, monospace;
  font-size: 0.8125rem;
  white-space: nowrap;
}

.pd-num-head {
  text-align: right !important;
}

.pd-mono {
  font-family: IBM Plex Mono, monospace;
  font-size: 0.8125rem;
}

.pd-compact-table th,
.pd-compact-table td {
  padding: 0.4rem 0.6rem;
  font-size: 0.8125rem;
}

.pd-cell--danger { color: var(--color-danger); font-weight: 600; }
.pd-cell--warn   { color: #b45309; font-weight: 500; }
.pd-cell--good   { color: var(--primary-green); font-weight: 600; }

.pd-row--highlight {
  background: var(--primary-green-10);
}

.pd-row--target {
  background: rgba(232, 163, 13, 0.08);
  font-weight: 600;
}

/* Table sort pills */
.pd-table-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.pd-table-sort-label {
  font-size: 0.8125rem;
  color: var(--graphite-70);
}

.pd-sort-pills {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
}

/* Two-column layouts */
.pd-two-col {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1.25rem;
  padding: 1.25rem;
  align-items: start;
}

.pd-two-col-main { min-width: 0; }
.pd-two-col-side { min-width: 0; }

.pd-two-col-half {
  min-width: 0;
}

.pd-two-col > .pd-two-col-half:first-child,
.pd-two-col > .pd-two-col-half:last-child {
  /* equal halves inside a 1fr 2fr parent: override needed */
}

/* For 50/50 layout, add a modifier */
.pd-section > .pd-two-col--equal {
  grid-template-columns: 1fr 1fr;
}

#pd-section-drilldown .pd-two-col {
  grid-template-columns: 1fr 1fr;
}

/* Peer summary card */
.pd-peer-summary-card {
  background: var(--primary-green-10);
  border: 1px solid var(--primary-green-20);
  border-radius: 5px;
  padding: 1rem;
}

.pd-peer-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.375rem 0;
  border-bottom: 1px solid var(--primary-green-20);
  font-size: 0.8125rem;
}

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

.pd-peer-summary-row span {
  color: var(--graphite-70);
}

.pd-peer-summary-row strong {
  color: var(--graphite-ink);
  font-variant-numeric: tabular-nums;
}

/* Comp section */
.pd-comp-section {
  margin-top: 1.5rem;
}

.pd-comp-rollup {
  padding: 0.75rem 1.25rem;
}

.pd-comp-rollup-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.pd-comp-table-wrap {
  padding: 0 1.25rem 1.25rem;
}

/* Section padding for non-table sections */
#pd-section-inventory .pd-section-body,
#pd-section-sales,
#pd-section-drilldown,
#pd-section-peers {
  /* tables handle their own padding via .recommendations-table-wrap */
}

#pd-section-sales .pd-two-col {
  padding: 1.25rem;
}

#pd-section-peers .pd-peer-summary-card {
  margin-top: 0;
}

#pd-peers-table th,
#pd-peers-table td {
  padding: 8px 10px;
}

#pd-peers-table td:first-child {
  width: 42%;
  line-height: 1.2;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  display: table-cell;
  overflow: hidden;
  text-overflow: ellipsis;
}

#pd-peers-table th:nth-child(2),
#pd-peers-table td:nth-child(2) {
  width: 12%;
}

#pd-peers-table td:nth-child(2) {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

#pd-peers-table th:nth-child(3),
#pd-peers-table td:nth-child(3) {
  width: 6%;
}

#pd-peers-table td:nth-child(3) {
  white-space: nowrap;
}

#pd-peers-table th:nth-child(4),
#pd-peers-table td:nth-child(4),
#pd-peers-table th:nth-child(5),
#pd-peers-table td:nth-child(5),
#pd-peers-table th:nth-child(6),
#pd-peers-table td:nth-child(6),
#pd-peers-table th:nth-child(7),
#pd-peers-table td:nth-child(7),
#pd-peers-table th:nth-child(8),
#pd-peers-table td:nth-child(8),
#pd-peers-table th:nth-child(9),
#pd-peers-table td:nth-child(9) {
  width: 6.67%;
}

#pd-peers-table td:nth-child(4),
#pd-peers-table td:nth-child(5),
#pd-peers-table td:nth-child(6),
#pd-peers-table td:nth-child(7),
#pd-peers-table td:nth-child(8),
#pd-peers-table td:nth-child(9) {
  white-space: nowrap;
}

#pd-section-peers .pd-peer-table-wrap .pd-table-wrap {
  max-height: 360px;
}

/* Charts grid */
.pd-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 1.25rem;
  padding: 1.25rem;
}

.pd-chart-card {
  background: #fff;
  border: 1px solid var(--graphite-10);
  border-radius: 5px;
  padding: 1rem;
}

.pd-chart-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.pd-category-chart-stack {
  display: grid;
  gap: 1.25rem;
  padding: 0.75rem 1.25rem 1.25rem;
}

.pd-category-chart-card {
  min-width: 0;
}

.pd-category-chart-card canvas {
  height: clamp(270px, 40vh, 440px) !important;
}

.pd-chart-note {
  margin: 0.125rem 0 0;
  color: var(--graphite-60);
  font-size: 0.75rem;
  line-height: 1.35;
}

.pd-metric-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.pd-metric-tab {
  min-height: 36px;
  padding: 0.45rem 0.75rem;
  border: 0;
  border-top: 4px solid rgba(34, 34, 34, 0.12);
  border-radius: 0;
  background: transparent;
  color: var(--graphite-70);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.pd-metric-tab:hover,
.pd-metric-tab:focus-visible {
  color: var(--graphite-ink);
  outline: 2px solid var(--primary-green-20);
  outline-offset: 2px;
}

.pd-metric-tab--active {
  border-top-color: var(--metric-color, var(--primary-green));
  color: var(--graphite-ink);
}

.pd-metric-tab--green { --metric-color: #006644; }
.pd-metric-tab--amber { --metric-color: #e8a30d; }
.pd-metric-tab--blue { --metric-color: #2563eb; }
.pd-metric-tab--gold { --metric-color: #f5b000; }
.pd-metric-tab--cyan { --metric-color: #3bd9d6; }
.pd-metric-tab--magenta { --metric-color: #d10fd1; }
.pd-metric-tab--red { --metric-color: #ef2d55; }
.pd-metric-tab--teal { --metric-color: #006b5c; }

.pd-competitor-link-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 1.5rem 1.5rem;
  padding: 1rem 1.125rem;
  border: 1px solid var(--primary-green-20);
  border-radius: 12px;
  background: var(--primary-green-10);
}

.pd-competitor-link-card h3 {
  margin: 0 0 0.25rem;
  color: var(--graphite-ink);
  font-size: 0.95rem;
}

.pd-competitor-link-card p {
  margin: 0;
  color: var(--graphite-70);
  font-size: 0.8125rem;
}

.pd-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0.5rem 0.875rem;
  border-radius: 8px;
  background: var(--primary-green);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.pd-chart-card--wide {
  grid-column: 1 / -1;
}

.pd-chart-card--wide canvas {
  height: clamp(220px, 34vh, 380px) !important;
}

#pd-chart-expiry {
  height: clamp(220px, 32vh, 360px) !important;
}

.pd-chart-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--graphite-70);
  margin-bottom: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pd-chart-empty {
  font-size: 0.875rem;
  color: var(--graphite-70);
  text-align: center;
  padding: 2rem;
}

/* Heatmap */
.pd-chart-card--wide .pd-heatmap,
.pd-sales-timing-card .pd-heatmap {
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: auto;
  overflow-y: visible;
  max-width: 100%;
  width: 100%;
  min-height: clamp(200px, 30vh, 320px);
  padding: 0.25rem 0.25rem 0.75rem;
  -webkit-overflow-scrolling: touch;
}

.pd-heatmap-outer {
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
  width: max-content;
  max-width: 100%;
  min-width: 0;
  margin-left: auto;
  margin-right: auto;
  /* Defaults before JS (desktop cap ≈13px) */
  --pd-heatmap-label-w: 28px;
  --pd-heatmap-cell: 12px;
  --pd-heatmap-gap: 2px;
}

.pd-heatmap-calendar-block {
  width: max-content;
  max-width: 100%;
}

.pd-heatmap-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.375rem 0.75rem;
  width: 100%;
  max-width: 100%;
  margin-bottom: 0.875rem;
  color: var(--graphite-70);
  font-size: 0.8125rem;
  text-align: center;
}

.pd-heatmap-summary strong {
  color: var(--graphite-ink);
  font-weight: 700;
}

.pd-heatmap-months {
  display: grid;
  grid-template-columns: var(--pd-heatmap-label-w, 28px) repeat(var(--pd-heatmap-weeks), var(--pd-heatmap-cell));
  gap: var(--pd-heatmap-gap);
  margin-bottom: 0.375rem;
  color: var(--graphite-70);
  font-size: 0.6875rem;
}

.pd-heatmap-body {
  display: flex;
  align-items: flex-start;
  gap: var(--pd-heatmap-gap);
}

.pd-heatmap-day-labels {
  display: grid;
  grid-template-rows: repeat(7, var(--pd-heatmap-cell));
  gap: var(--pd-heatmap-gap);
  width: var(--pd-heatmap-label-w, 28px);
  flex: 0 0 var(--pd-heatmap-label-w, 28px);
  color: var(--graphite-70);
  font-size: 0.6875rem;
  line-height: var(--pd-heatmap-cell);
}

.pd-heatmap-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, var(--pd-heatmap-cell));
  grid-auto-columns: var(--pd-heatmap-cell);
  gap: var(--pd-heatmap-gap);
  width: max-content;
}

.pd-heatmap-cell {
  position: relative;
  width: var(--pd-heatmap-cell);
  height: var(--pd-heatmap-cell);
  padding: 0;
  box-sizing: border-box;
  border: 1px solid rgba(27, 31, 35, 0.12);
  border-radius: 2px;
  background: var(--graphite-10);
  cursor: pointer;
  outline: none;
  transition: box-shadow 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}

.pd-heatmap-outer--dense .pd-heatmap-cell--level-0 {
  background: #ebedf0;
  border-color: rgba(27, 31, 35, 0.06);
}

.pd-heatmap-cell--level-0 {
  background: rgba(34, 34, 34, 0.08);
}

.pd-heatmap-cell--level-1 {
  background: rgba(0, 102, 68, 0.24);
}

.pd-heatmap-cell--level-2 {
  background: rgba(0, 102, 68, 0.45);
}

.pd-heatmap-cell--level-3 {
  background: rgba(0, 102, 68, 0.68);
}

.pd-heatmap-cell--level-4 {
  background: var(--primary-green);
}

.pd-heatmap-cell:hover,
.pd-heatmap-cell:focus-visible,
.pd-heatmap-cell--active {
  transform: translateY(-1px);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--primary-green);
  outline: none;
}

.pd-heatmap-outer--dense .pd-heatmap-cell:hover,
.pd-heatmap-outer--dense .pd-heatmap-cell:focus-visible,
.pd-heatmap-outer--dense .pd-heatmap-cell--active {
  transform: none;
  box-shadow: 0 0 0 1px #fff, 0 0 0 2px var(--primary-green);
  z-index: 1;
}

.pd-heatmap-cell--out {
  opacity: 0.32;
}

.pd-heatmap-cell--received {
  border-color: var(--pd-reception-store, var(--primary-green));
  border-width: 2px;
}

.pd-heatmap-outer--dense .pd-heatmap-cell--received {
  border-width: 1px;
}

.pd-heatmap-cell--received-multi {
  border-style: double;
}

.pd-heatmap-cell--received::before,
.pd-heatmap-cell--received::after,
.pd-heatmap-receipt-sample::before,
.pd-heatmap-receipt-sample::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 68%;
  height: 3px;
  border-radius: 999px;
  background: #d32f2f;
  transform: translate(-50%, -50%);
}

.pd-heatmap-cell--received::after,
.pd-heatmap-receipt-sample::after {
  width: 3px;
  height: 68%;
}

.pd-heatmap-outer--dense .pd-heatmap-cell--received::before,
.pd-heatmap-outer--dense .pd-heatmap-cell--received::after {
  width: 65%;
  height: 2px;
}

.pd-heatmap-outer--dense .pd-heatmap-cell--received::after {
  width: 2px;
  height: 65%;
}

.pd-heatmap-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1rem;
  width: 100%;
  max-width: 100%;
  margin-top: 1rem;
  color: var(--graphite-70);
  font-size: 0.75rem;
}

.pd-heatmap-legend-scale,
.pd-heatmap-legend-receipt {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.pd-heatmap-legend .pd-heatmap-cell {
  --pd-heatmap-cell: 14px;
  cursor: default;
  pointer-events: none;
}

.pd-heatmap-receipt-sample {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--primary-green);
  border-radius: 5px;
  background: #fff;
}

.pd-heatmap-store-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 100%;
  margin-top: 0.625rem;
}

.pd-heatmap-store-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 28px;
  padding: 0.25rem 0.5rem;
  border: 1px solid rgba(34, 34, 34, 0.1);
  border-radius: 999px;
  color: var(--graphite-70);
  background: #fff;
  font-size: 0.75rem;
}

.pd-heatmap-store-chip span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--pd-reception-store, var(--primary-green));
}

.pd-heatmap-detail {
  box-sizing: border-box;
  margin-top: 1rem;
  padding: 0.875rem 1rem;
  border: 1px solid var(--primary-green-20);
  border-radius: 5px;
  background: var(--primary-green-10);
  color: var(--graphite-ink);
  font-size: 0.8125rem;
  width: 100%;
  max-width: 100%;
  align-self: stretch;
}

.pd-heatmap-detail-title {
  font-weight: 700;
  margin-bottom: 0.625rem;
}

.pd-heatmap-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.625rem 0.75rem;
}

.pd-heatmap-stat-grid div {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.pd-heatmap-stat-grid span {
  color: var(--graphite-70);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pd-heatmap-stat-grid strong {
  color: var(--graphite-ink);
  font-variant-numeric: tabular-nums;
}

.pd-heatmap-receipt-line {
  margin-top: 0.625rem;
  color: var(--graphite-70);
  line-height: 1.35;
}

/* Responsive */
@media (max-width: 1100px) {
  .pd-chart-card--wide canvas {
    height: clamp(210px, 30vh, 340px) !important;
  }
}

@media (max-width: 768px) {
  .pd-detail-tabs {
    display: none;
  }

  .pd-detail-tab-select-wrap {
    display: block;
    margin: 0 0 1rem;
  }
}

@media (max-width: 1024px) {
  .pd-kpi-section {
    margin-bottom: 0.875rem;
  }

  .pd-snapshot-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .pd-snapshot-caption {
    text-align: left;
    max-width: none;
  }

  .pd-snapshot-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 0.85rem;
    row-gap: 1.15rem;
    padding: 0.65rem 0 0.15rem;
  }

  .pd-kpi-grid {
    gap: 0.625rem;
  }

  .pd-kpi-grid--row2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 0.875rem;
  }
  .pd-kpi-card {
    padding: 0;
  }
  .pd-kpi-value {
    font-size: 1.05rem;
  }
  .pd-kpi-value--sm {
    font-size: 0.95rem;
  }
  .pd-kpi-label {
    font-size: 0.72rem;
    margin-bottom: 0.25rem;
  }
  .pd-kpi-sub {
    font-size: 0.7rem;
  }
  .pd-two-col {
    grid-template-columns: 1fr;
  }
  #pd-section-drilldown .pd-two-col {
    grid-template-columns: 1fr;
  }
  .pd-charts-grid {
    grid-template-columns: 1fr;
  }
  .pd-controls {
    gap: 0.75rem;
  }

  .pd-store-toolbar,
  .pd-store-toolbar .pd-control-group,
  .pd-store-filter-toolbar,
  .pd-store-filter-toolbar .filter-controls,
  .pd-store-filter-toolbar .filter-dropdown,
  #pd-store-filter,
  #pd-store-filter .filter-select {
    width: 100%;
  }

  .pd-mini-charts-row,
  .pd-peer-body {
    grid-template-columns: 1fr;
  }

  .pd-table-block,
  .pd-mini-charts-row,
  .pd-peer-body,
  .pd-category-chart-stack,
  .pd-charts-grid {
    padding: 1rem;
  }

  .pd-chart-card-header,
  .pd-competitor-link-card {
    align-items: stretch;
    flex-direction: column;
  }

  .pd-metric-tabs {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.25rem;
  }

  .pd-metric-tab {
    flex: 0 0 auto;
  }

  .pd-competitor-link-card {
    margin: 0 1rem 1rem;
  }

  .pd-link-button {
    width: 100%;
  }

  #pd-section-variants .pd-table-wrap {
    margin: 0;
    width: 100%;
    padding: 0;
  }

  .pd-table-wrap {
    max-height: none;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .pd-table-wrap .table {
    min-width: 0;
    border-collapse: separate;
  }

  .pd-table-wrap .table thead {
    display: none;
  }

  .pd-table-wrap .table,
  .pd-table-wrap .table tbody,
  .pd-table-wrap .table tr,
  .pd-table-wrap .table td {
    display: block;
    width: 100%;
  }

  .pd-table-wrap .table tbody {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .pd-table-wrap .table tbody tr {
    padding: 0.875rem 1rem;
    margin: 0;
    border: 1px solid rgba(34, 34, 34, 0.08);
    border-radius: 2px;
    background: #fff;
    box-shadow: var(--shadow-sm);
  }

  .pd-table-wrap .table tbody tr:nth-child(even),
  .pd-table-wrap .table tbody tr:hover {
    background: #fff;
  }

  .pd-table-wrap .table td {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 0;
    white-space: normal;
    text-align: right;
  }

  .pd-table-wrap .table td + td {
    margin-top: 0.2rem;
  }

  .pd-table-wrap .table td::before {
    content: attr(data-label);
    flex: 0 0 44%;
    color: var(--graphite-70);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-align: left;
    text-transform: uppercase;
  }

  .pd-table-wrap .table td {
    row-gap: 0.15rem;
  }

  .pd-table-wrap .table tbody tr:has(.empty-state) {
    padding: 0;
    margin: 0;
    border: 0;
    box-shadow: none;
  }

  .pd-mobile-table-pagination {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0 1rem;
    padding: 0 0.25rem;
  }

  .pd-mobile-page-btn {
    min-height: 44px;
    border: 1px solid var(--graphite-10);
    border-radius: 5px;
    background: #fff;
    color: var(--primary-green);
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.55rem 0.75rem;
  }

  .pd-mobile-page-btn:disabled {
    opacity: 0.45;
  }

  .pd-mobile-page-meta {
    text-align: center;
    color: var(--graphite-70);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .pd-mobile-page-dots {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    gap: 0.45rem;
  }

  .pd-mobile-page-dot {
    width: 8px;
    height: 8px;
    border: 0;
    border-radius: 999px;
    background: var(--graphite-10);
    padding: 0;
  }

  .pd-mobile-page-dot.is-active {
    background: var(--primary-green);
  }

  .pd-table-wrap .table .empty-state {
    display: block;
    padding: 1rem;
    text-align: center;
  }

  .pd-table-wrap .table .empty-state::before {
    display: none;
  }

  #pd-peers-table td:first-child {
    width: auto;
    max-width: none;
    display: block;
    white-space: normal;
    overflow: visible;
    text-overflow: initial;
    text-align: left;
    padding-top: 0.2rem;
  }

  /* Reset desktop size-column constraints in mobile card mode */
  #pd-variants-table td:first-child {
    width: auto;
    max-width: none;
    display: flex;
    white-space: normal;
    overflow: visible;
    text-overflow: initial;
  }

  #pd-peers-table td:first-child::before {
    display: block;
    margin-bottom: 0.25rem;
  }

  #pd-peers-table td {
    align-items: flex-start;
  }

  #pd-peers-table td::before {
    flex-basis: 38%;
  }

  .pd-mini-chart-card canvas,
  .pd-comp-chart-card canvas,
  .pd-category-chart-card canvas,
  .pd-chart-card--wide canvas,
  #pd-chart-expiry {
    height: clamp(190px, 36vh, 280px) !important;
  }

  .pd-heatmap-outer {
    --pd-heatmap-label-w: 32px;
    min-width: max-content;
  }

}

@media (max-width: 768px) {
  .pd-table-wrap .table td::before {
    flex: 0 0 44%;
  }

  .pd-heatmap {
    margin-left: -0.25rem;
    margin-right: -0.25rem;
    align-items: stretch;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .pd-sales-timing-card .pd-heatmap {
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
  }

  .pd-heatmap-outer {
    --pd-heatmap-label-w: 36px;
    width: 100%;
  }

  .pd-heatmap-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .pd-heatmap-stat-grid div {
    padding: 0.5rem 0.65rem;
    background: #f3f4f6;
    border-radius: 5px;
    border: 1px solid rgba(34, 34, 34, 0.06);
  }

  .pd-heatmap-detail {
    margin-top: 1.125rem;
    padding: 1rem 1.05rem 1.1rem;
    background: #fff;
    border: 1px solid rgba(34, 34, 34, 0.1);
    border-radius: 2px;
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.08));
  }

  .pd-heatmap-detail-title {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
  }

  .pd-heatmap-receipt-line {
    margin-top: 0.75rem;
    padding: 0.7rem 0.8rem;
    background: #f3f4f6;
    border: 1px solid rgba(34, 34, 34, 0.06);
    border-radius: 5px;
    font-size: 0.8rem;
  }
}

@media (max-width: 640px) {
  .pd-snapshot-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pd-snapshot-metrics .pd-kpi-label {
    min-height: 0;
  }

  .pd-kpi-grid--row2 {
    grid-template-columns: 1fr;
  }

  .pd-kpi-card {
    border-right: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pd-kpi-card,
  .pd-heatmap-cell {
    transition: none;
  }

  .pd-kpi-card:hover,
  .pd-heatmap-cell:hover,
  .pd-heatmap-cell:focus-visible,
  .pd-heatmap-cell--active {
    transform: none;
  }
}
