/* ============================================================
   Lukeron Production Lookup — App Stylesheet
   Extends brand.css (imported below). Do not duplicate tokens
   already defined there — only app-specific layout/components.
   ============================================================ */

@import url('brand.css');

/* --- CARD / PANEL ACCENT OVERRIDES (app-wide) ---
   Restyles brand.css's generic .card, .admin-tile and .spec-card so every
   titled section across the app (product form, orders, backup, users,
   search results, etc.) shares one accent-header + shadow language. */

.card {
  box-shadow: var(--shadow-sm);
  /* overflow:hidden + border-radius can leave a sliver of an unclipped
     child border visible at non-100% browser zoom (a Chromium subpixel
     rounding quirk) — clip-path clips reliably regardless of zoom. */
  clip-path: inset(0 round var(--radius-lg));
}

.card-header {
  padding: var(--space-4) var(--space-5);
  border-left: 4px solid var(--color-primary-yellow);
  border-top-left-radius: var(--radius-lg);
}

.card-title {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary-blue);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

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

.spec-card {
  box-shadow: var(--shadow-sm);
}

/* --- COLLAPSIBLE CARD (a <details class="card"> with a <summary
   class="card-header qd-summary-toggle"> in place of the usual header
   div) — collapsed by default, e.g. Quotation Details on the Quotation
   edit page, so a rarely-touched form doesn't push the frequently-used
   content below it down the page. --- */
.qd-summary-toggle {
  cursor: pointer;
  list-style: none;
}

.qd-summary-toggle::-webkit-details-marker {
  display: none;
}

.qd-summary-action {
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
}

.qd-chevron {
  display: inline-block;
  transition: transform var(--transition-fast);
}

details[open] > .qd-summary-toggle .qd-chevron {
  transform: rotate(90deg);
}


/* --- DETAIL MODAL (native <dialog> — a "View" button calls .showModal()
   via one inline onclick; closing needs no JS at all via a
   <form method="dialog"> submit button, or the Esc key / backdrop click
   handled by the small listener in detail-modal.js). Used first by Expo
   Leads' "View" button to show a scanned card's full details without
   truncating them into a table row. --- */
.detail-modal {
  max-width: var(--max-width-sm);
  width: 100%;
  padding: 0;
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
}

.detail-modal::backdrop {
  background: rgba(26, 26, 26, 0.5);
}

.detail-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-left: 4px solid var(--color-primary-yellow);
  border-top-left-radius: var(--radius-lg);
  background: var(--color-surface-secondary);
}

.detail-modal-title {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary-blue);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

.detail-modal-body {
  padding: var(--space-5);
  display: grid;
  gap: var(--space-3);
  max-height: 60vh;
  overflow-y: auto;
}

.detail-modal-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  border-bottom: 1px solid var(--color-border-light);
  padding-bottom: var(--space-2);
}

.detail-modal-label {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  white-space: nowrap;
  flex-shrink: 0;
}

.detail-modal-value {
  text-align: right;
  color: var(--color-text-primary);
  white-space: pre-wrap;
}

.detail-modal-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}


/* --- SIDEBAR NAV (replaces the old horizontal .navbar) --- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--color-primary-blue);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  z-index: var(--z-sticky);
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  text-decoration: none;
  flex: 1;
  min-width: 0;
}

.sidebar-logo-img {
  height: 48px;
  width: auto;
  max-width: 100%;
  display: block;
}

.sidebar-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  margin-right: var(--space-3);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.sidebar-toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text-on-blue);
  border-radius: 2px;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.sidebar.sidebar-open .sidebar-toggle-bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.sidebar.sidebar-open .sidebar-toggle-bar:nth-child(2) {
  opacity: 0;
}

.sidebar.sidebar-open .sidebar-toggle-bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.sidebar-collapsible {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-3) var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  background: var(--color-primary-yellow);
}

/* Non-interactive uppercase caption grouping related items — the sidebar's
   actual "table of contents." Always sits after at least one link (Dashboard
   at minimum), so a leading divider never looks orphaned. */
.sidebar-section {
  color: rgba(48, 65, 100, 0.5);
  text-transform: uppercase;
  font-size: 10px;
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-wide);
  margin-top: var(--space-2);
  padding: var(--space-3) var(--space-3) 2px;
  border-top: 1px solid rgba(48, 65, 100, 0.15);
}

.sidebar-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-search {
  position: relative;
  margin-bottom: var(--space-2);
}

.sidebar-search-input {
  width: 100%;
  color: var(--color-text-on-yellow);
  background: rgba(48, 65, 100, 0.08);
  border: 1px solid rgba(48, 65, 100, 0.2);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  font-size: var(--font-size-sm);
  font-family: inherit;
  transition: all var(--transition-fast);
}

.sidebar-search-input::placeholder {
  color: rgba(48, 65, 100, 0.55);
}

.sidebar-search-input:focus {
  outline: none;
  background: rgba(48, 65, 100, 0.12);
  border-color: var(--color-primary-blue);
}

.sidebar-search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  z-index: 5;
}

.sidebar-search-result {
  display: block;
  padding: var(--space-2) var(--space-3);
  color: var(--color-text-primary);
  text-decoration: none;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

.sidebar-search-result:hover,
.sidebar-search-result.active {
  background: var(--color-primary-blue);
  color: var(--color-primary-yellow);
}

.sidebar-link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-2);
  color: rgba(48, 65, 100, 0.8);
  text-decoration: none;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.sidebar-link:hover {
  color: var(--color-primary-blue);
  background: rgba(48, 65, 100, 0.1);
}

.sidebar-link.active {
  color: var(--color-primary-yellow);
  background: var(--color-primary-blue);
}

.sidebar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-left: auto;
  border-radius: var(--radius-full);
  background: var(--color-error);
  color: #fff;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  line-height: 1;
}

.sidebar-badge-mention {
  box-shadow: 0 0 0 2px var(--color-primary-blue);
}

/* --- CHAT --- */

.chat-mention {
  font-weight: var(--font-weight-bold);
  color: var(--color-primary-blue);
  background: rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-sm);
  padding: 0 3px;
}

.chat-mention-mine-bubble {
  background: rgba(255, 255, 255, 0.35);
}

.chat-mention-me {
  background: var(--color-primary-yellow);
}

.chat-bubble-mentioned {
  box-shadow: 0 0 0 2px var(--color-primary-yellow);
}

.chat-mention-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  margin-bottom: 4px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  z-index: var(--z-sticky);
  min-width: 160px;
  max-width: 100%;
}

.chat-mention-option {
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  font-size: var(--font-size-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-mention-option:hover,
.chat-mention-option.active {
  background: var(--color-primary-yellow);
  color: var(--color-primary-blue);
}

.sidebar-submenu-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  cursor: pointer;
  list-style: none;
}

.sidebar-submenu-toggle::-webkit-details-marker {
  display: none;
}

.sidebar-submenu-toggle::after {
  content: '▸';
  margin-left: auto;
  font-size: var(--font-size-xs);
  transition: transform var(--transition-fast);
}

.sidebar-submenu[open] > .sidebar-submenu-toggle::after {
  transform: rotate(90deg);
}

.sidebar-submenu-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-1) 0 var(--space-1) var(--space-4);
}

.sidebar-sublink {
  display: block;
  color: rgba(48, 65, 100, 0.7);
  text-decoration: none;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.sidebar-sublink:hover {
  color: var(--color-primary-blue);
  background: rgba(48, 65, 100, 0.1);
}

.sidebar-sublink.active {
  color: var(--color-primary-yellow);
  background: var(--color-primary-blue);
  font-weight: var(--font-weight-semibold);
}

.sidebar-submenu-group {
  color: rgba(48, 65, 100, 0.5);
  text-transform: uppercase;
  font-size: 10px;
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-wide);
  padding: var(--space-2) var(--space-3) 2px;
}

.sidebar-submenu-group:not(:first-child) {
  margin-top: var(--space-1);
}

.app-main {
  flex: 1;
  min-width: 0;
}

/* Sits beside the Factory Line logo in the sidebar's own top bar — already
   navy, so a filled button would blend in; a plain yellow icon (matching
   the brand accent used for the title's hover states elsewhere) reads
   clearly against it instead. */
.sidebar-top-logout-form {
  flex-shrink: 0;
}

.sidebar-top-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-right: var(--space-2);
  background: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--color-primary-yellow);
  transition: all var(--transition-fast);
}

.sidebar-top-logout-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.sidebar-collapse-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-right: var(--space-2);
  background: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--color-primary-yellow);
  transition: all var(--transition-fast);
}

.sidebar-collapse-toggle:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

/* --- COLLAPSIBLE ICON RAIL (desktop only — mobile keeps its own separate
   sidebar-open drawer, above, completely untouched by any of this) --- */
@media (min-width: 769px) {
  body.sidebar-collapsed .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width-collapsed);
    overflow-x: hidden;
    transition: width var(--transition-fast);
  }

  /* .sidebar-peek is JS-driven (mouseenter/focusin in the script below),
     not plain CSS :hover/:focus-within — collapsing has to be able to
     suppress it for the pointer/focus that's still sitting on the sidebar
     right after the click that triggered the collapse in the first place.
     Widens the rail as an overlay on top of the page — .app-main's margin
     below stays fixed at the rail width regardless, so the page content
     never reflows just from peeking in/out. */
  body.sidebar-collapsed .sidebar.sidebar-peek {
    width: var(--sidebar-width);
    box-shadow: var(--shadow-lg);
  }

  body.sidebar-collapsed .app-main {
    margin-left: var(--sidebar-width-collapsed);
  }

  /* font-size: 0 collapses every label's text to nothing at rail width,
     without touching a single line of sidebar markup — each link's icon
     is a fixed-pixel-size SVG (not font-size-relative), so it stays fully
     visible and correctly sized while its sibling text — and a submenu's
     trailing ▸ arrow, itself a font-sized ::after glyph — shrink to zero.
     (An earlier overflow:hidden-based approach clipped at a hard pixel
     boundary instead, which could leave a stray first letter or two of a
     label peeking out depending on the rail's exact width — this doesn't
     depend on width at all.) Peeking the rail back open restores the
     normal font-size and all labels immediately. */
  body.sidebar-collapsed .sidebar:not(.sidebar-peek) .sidebar-link,
  body.sidebar-collapsed .sidebar:not(.sidebar-peek) .sidebar-section {
    overflow: hidden;
    font-size: 0;
  }

  /* With the label gone, center the icon in the rail instead of leaving it
     sitting wherever flex-start + the now-pointless icon/text gap put it. */
  body.sidebar-collapsed .sidebar:not(.sidebar-peek) .sidebar-link {
    justify-content: center;
    gap: 0;
    padding-left: 0;
    padding-right: 0;
  }

  /* Sublinks have no icon at all (only top-level links and submenu-toggle
     summaries do) — font-size:0'ing them would leave blank, invisible-but-
     still-clickable rows if a submenu happened to already be open. Hide
     the whole list instead; peeking the rail back open shows it again,
     same open/closed <details> state as before. */
  body.sidebar-collapsed .sidebar:not(.sidebar-peek) .sidebar-submenu-list {
    display: none;
  }

  /* The ▸ arrow sets its own explicit font-size (not inherited), so the
     .sidebar-link rule above's font-size:0 doesn't reach it — hide it
     directly instead. */
  body.sidebar-collapsed .sidebar:not(.sidebar-peek) .sidebar-submenu-toggle::after {
    display: none;
  }

  body.sidebar-collapsed .sidebar:not(.sidebar-peek) .sidebar-logo-img,
  body.sidebar-collapsed .sidebar:not(.sidebar-peek) .sidebar-search,
  body.sidebar-collapsed .sidebar:not(.sidebar-peek) .sidebar-badge {
    display: none;
  }

  body.sidebar-collapsed .sidebar-collapse-toggle svg {
    transition: transform var(--transition-fast);
  }

  body.sidebar-collapsed .sidebar-collapse-toggle[aria-pressed="true"] svg {
    transform: rotate(180deg);
  }
}

@media (max-width: 768px) {
  .sidebar-collapse-toggle {
    display: none;
  }
}

@media (max-width: 768px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: sticky;
    top: 0;
    overflow-y: visible;
    z-index: var(--z-sticky);
  }

  .sidebar-logo {
    padding: var(--space-2) var(--space-4);
  }

  .sidebar-toggle {
    display: flex;
  }

  .sidebar-collapsible {
    display: none;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
  }

  .sidebar.sidebar-open .sidebar-collapsible {
    display: flex;
  }

  .sidebar-nav {
    padding: var(--space-3);
  }

  .form-grid-2col {
    grid-template-columns: 1fr;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }
}


/* --- LOGIN --- */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: var(--color-bg);
}

.login-card {
  width: 100%;
  max-width: var(--max-width-sm);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-8);
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-6);
}

.login-brand-logo {
  width: 100%;
  max-width: 320px;
  height: auto;
  display: block;
}

.navbar-logo-img {
  height: 46px;
  width: auto;
  flex-shrink: 0;
}


/* --- SEARCH BAR --- */

.search-bar {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: var(--space-4);
}

.search-bar .form-group {
  margin-bottom: 0;
  flex: 1 1 240px;
}

.search-bar .form-group.boxes-group {
  flex: 0 1 140px;
}

.filter-row {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}

.filter-row .form-group {
  margin-bottom: 0;
  flex: 1 1 180px;
}

/* --- PICK LIST (multiple search matches) --- */

.pick-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.pick-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  width: 100%;
}

.pick-list-item:hover {
  border-color: var(--color-primary-blue);
  background: var(--color-primary-yellow-light);
}

.pick-list-name {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

.pick-list-meta {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}


/* --- RESULT: PRODUCT SUMMARY --- */

.result-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.result-summary-name {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary-blue);
}

.result-summary-meta {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.result-mrp {
  font-family: var(--font-mono);
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
}


/* --- SPEC CARDS GRID (bottle/box/cap/label) --- */

.spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.spec-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.spec-card-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--color-surface-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.spec-card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.spec-card-image.placeholder {
  color: var(--color-text-faint);
  font-size: var(--font-size-sm);
  flex-direction: column;
  gap: var(--space-2);
}

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

.spec-card-title {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary-blue);
  margin-bottom: var(--space-2);
}

.spec-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  padding: 4px 0;
  border-bottom: 1px solid var(--color-border-light);
}

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

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

.spec-row-value {
  color: var(--color-text-primary);
  font-weight: var(--font-weight-medium);
  text-align: right;
}

.spec-card-qty {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 2px solid var(--color-primary-yellow);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.spec-card-qty-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.spec-card-qty-value {
  font-family: var(--font-mono);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary-blue);
}


/* --- TOTALS TABLE --- */

.totals-wrap {
  margin-bottom: var(--space-4);
}

/* --- STAT GRID (reusable label-over-value blocks, e.g. Order Totals) --- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-4);
}

.stat-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
}

.stat-value {
  font-family: var(--font-mono);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary-blue);
}

/* --- DASHBOARD (icon stat cards, trend chart, ranked list, hero panel) --- */

.dash-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.dash-stat-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
}

a.dash-stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.dash-stat-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dash-stat-icon svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
}

.dash-stat-icon-blue    { background: var(--color-primary-blue); color: var(--color-primary-yellow); }
.dash-stat-icon-yellow  { background: var(--color-primary-yellow-light); color: var(--color-primary-blue); }
.dash-stat-icon-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.dash-stat-icon-error   { background: var(--color-error-bg); color: var(--color-error); }
.dash-stat-icon-success { background: var(--color-success-bg); color: var(--color-success); }

.dash-stat-body { min-width: 0; }

.dash-stat-value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: var(--font-weight-bold);
  color: var(--color-primary-blue);
  line-height: 1.15;
}

.dash-stat-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-top: 2px;
}

.dash-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  align-items: stretch;
}

@media (max-width: 900px) {
  .dash-row { grid-template-columns: 1fr; }
}

.dash-chart-card,
.dash-list-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.dash-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--space-4);
}

.dash-card-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary-blue);
}

.dash-card-subtitle {
  font-size: var(--font-size-xs);
  color: var(--color-text-faint);
}

.dash-chart-svg {
  width: 100%;
  height: 160px;
  display: block;
  overflow: visible;
}

.dash-chart-labels {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-2);
  font-size: var(--font-size-xs);
  color: var(--color-text-faint);
}

.dash-ranked-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.dash-ranked-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.dash-ranked-rank {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--color-primary-yellow-light);
  color: var(--color-primary-blue);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dash-ranked-main { flex: 1 1 auto; min-width: 0; }

.dash-ranked-name {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  font-size: var(--font-size-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-ranked-bar-track {
  height: 6px;
  background: var(--color-bg);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 4px;
}

.dash-ranked-bar-fill {
  height: 100%;
  background: var(--color-primary-yellow);
  border-radius: var(--radius-full);
}

.dash-ranked-value {
  font-family: var(--font-mono);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary-blue);
  min-width: 28px;
  text-align: right;
  flex-shrink: 0;
}

.dash-hero {
  background: var(--color-primary-blue);
  color: #fff;
  border-radius: var(--radius-xl);
  padding: var(--space-5) var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.dash-hero-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
}

.dash-hero-desc {
  color: rgba(255, 255, 255, 0.75);
  font-size: var(--font-size-sm);
  margin-top: 4px;
}

.dash-hero .btn {
  flex-shrink: 0;
  background: var(--color-primary-yellow);
  color: var(--color-primary-blue);
  border: none;
  font-weight: var(--font-weight-bold);
}

.dash-hero .btn:hover {
  background: var(--color-primary-yellow-hover);
}

/* --- BADGE VARIANT (brand.css defines draft/success/error; this app also
   needs an in-progress state for order fulfillment tracking) --- */

.badge-warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  border-color: var(--color-warning-border);
}

/* --- PAGINATION --- */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-4);
}

.pagination-info {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.pagination-disabled {
  opacity: 0.4;
  pointer-events: none;
  cursor: default;
}

.print-btn-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: var(--space-4);
}


/* --- ORDER PANEL / ORDER ROW LIST (dashboard recent-orders + orders/index) --- */

.order-panel-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-6);
  overflow: hidden;
}

.order-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary-yellow);
}

.order-panel-title {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary-blue);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

.order-panel-link {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-primary-blue);
  text-decoration: none;
}

.order-panel-link:hover {
  text-decoration: underline;
}

.order-panel-list {
  display: flex;
  flex-direction: column;
  padding: var(--space-2);
  overflow-x: auto;
}

.order-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: var(--space-6);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  text-decoration: none;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}

.order-row:hover {
  background: var(--color-primary-yellow-light);
  border-color: var(--color-primary-yellow-dark);
}

.order-row-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1 1 auto;
  min-width: 0;
}

.order-row-pi {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary-blue);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-row-customer {
  font-size: var(--font-size-base);
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-row-side {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  flex-shrink: 0;
}

.order-row-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}

.order-row-stat-date   { width: 96px; }
.order-row-stat-count  { width: 68px; }
.order-row-stat-user   { width: 100px; }
.order-row-stat-status { width: 92px; }

.order-row-stat-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

.order-row-stat-value {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-row-empty {
  padding: var(--space-8) var(--space-5);
  text-align: center;
  color: var(--color-text-faint);
}

.order-row-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.order-row-actions form {
  display: inline-flex;
}


/* --- SEARCH FORM SPACING (dashboard, nested in a plain .card) --- */

.card-body.search-form .search-bar {
  margin-bottom: var(--space-4);
}


/* --- ADMIN LAYOUT --- */

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
}

.admin-tile {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary-yellow);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.admin-tile:hover {
  border-color: var(--color-border-dark);
  border-left-color: var(--color-primary-yellow);
  box-shadow: var(--shadow-md);
}

.admin-tile-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary-blue);
  margin-bottom: var(--space-1);
}

.admin-tile-desc {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.admin-tile-warning {
  margin-top: var(--space-2);
  display: inline-block;
}

.admin-section-title {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin: var(--space-6) 0 var(--space-3);
}

.admin-section-title:first-child {
  margin-top: 0;
}

.flow-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.flow-step {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary-yellow);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-sm);
}

.flow-step-number {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-primary-yellow);
  color: var(--color-primary-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-weight-semibold);
}

.flow-step-body {
  flex: 1;
  min-width: 0;
}

.flow-step-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary-blue);
}

.flow-step-desc {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-top: 2px;
}

.flow-step-status {
  font-size: var(--font-size-xs);
  color: var(--color-text-faint);
  margin-top: var(--space-1);
}

.flow-step-action {
  flex-shrink: 0;
}

.admin-grid-muted .admin-tile {
  box-shadow: none;
  border-left-color: var(--color-border);
}

.admin-grid-muted .admin-tile-title {
  font-size: var(--font-size-base);
  color: var(--color-text-secondary);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
}

.form-grid-2col {
  grid-template-columns: repeat(2, 1fr);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  align-items: start;
}

.card-grid > .card {
  margin-bottom: 0;
}

.form-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

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

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

/* --- BULK IMPORT PREVIEW --- */

.import-summary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.import-stat {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-5);
  text-align: center;
}

.import-stat-value {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary-blue);
}

.import-stat-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

.diff-added {
  background: var(--color-success-bg);
  color: var(--color-success);
  padding: 1px 4px;
  border-radius: var(--radius-xs);
}

.diff-changed {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  padding: 1px 4px;
  border-radius: var(--radius-xs);
}


/* --- MISC UTILITIES --- */

.text-muted { color: var(--color-text-muted); }
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.hidden { display: none !important; }


/* --- PRINT --- */

@media print {
  .sidebar, .search-bar, .filter-row, .print-btn-row, .pick-list, .price-list-toolbar {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  body {
    background: #fff;
  }

  .page {
    max-width: 100%;
    padding: 0;
  }

  .spec-card, .card {
    border: 1px solid #999;
    box-shadow: none;
    break-inside: avoid;
  }

  .spec-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- PRICE LIST / MRP LIST REPORTS --- */

.price-list-heading {
  text-align: center;
  padding: var(--space-4) var(--space-4) 0;
}

.price-list-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.price-list-wef {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-top: var(--space-1);
}

.price-list-table th, .price-list-table td {
  text-align: center;
  white-space: nowrap;
}

.price-list-table th:nth-child(2), .price-list-table td:nth-child(2) {
  text-align: left;
  white-space: normal;
}

.price-list-notes {
  padding: var(--space-4);
  font-size: 0.85rem;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-4);
}

/* --- FILE INPUTS ---
   The native "Choose File / No file chosen" control can't be fully
   reskinned in CSS (the "No file chosen" text isn't a stylable element in
   any browser), but ::file-selector-button lets us restyle just the button
   part to match .btn-outline — that's the piece that actually reads as
   "old-fashioned" against the rest of the UI. No markup change needed;
   every <input type="file" class="input"> in the app picks this up. */

input[type="file"].input {
  border: none;
  background: transparent;
  padding: 0;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

input[type="file"].input::file-selector-button {
  font-family: var(--font-primary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-primary-blue);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  margin-right: var(--space-3);
  cursor: pointer;
  transition: all var(--transition-fast);
}

input[type="file"].input::file-selector-button:hover {
  border-color: var(--color-primary-blue);
  background: var(--color-primary-yellow-light);
}

/* Compact variant inside dense table cells (e.g. Packaging Costs' per-pack-size photo uploads) */
.table input[type="file"].input::file-selector-button {
  padding: 5px 10px;
  font-size: var(--font-size-xs);
  margin-right: var(--space-2);
}

/* --- SEARCHABLE SELECT (searchable-select.js progressive enhancement) --- */

/* .card clips its rounded corners two ways — overflow:hidden AND a
   clip-path (the latter added later, for a Chromium subpixel-zoom
   rounding quirk — see .card's own comment). Both independently clip
   this dropdown's absolutely-positioned list to the card's own box, so
   both need overriding — undoing just overflow left clip-path silently
   still clipping it, the exact bug this comment used to describe having
   already fixed. With the list positioned right under a form field near
   the bottom of the card, only a sliver of the first row was visible,
   making the picker look broken/unsearchable. */
.card:has(.searchable-select-list) {
  overflow: visible;
  clip-path: none;
}

.searchable-select {
  position: relative;
}

.searchable-select-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: min(480px, 90vw);
  max-height: 260px;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.searchable-select-option {
  padding: 8px 12px;
  font-size: var(--font-size-base);
  cursor: pointer;
  white-space: normal;
  word-break: break-word;
}

.searchable-select-option.is-active {
  background: var(--color-bg);
}

.searchable-select-empty {
  padding: 8px 12px;
  font-size: var(--font-size-sm);
  color: var(--color-text-faint);
}


/* --- TOAST NOTIFICATIONS (toast.js) — floating, replaces the old static
   in-page flash banner. Reuses the same success/error/warning tokens
   .alert already used, so it's the same brand palette, just presented
   as a dismissing floating card instead of a static block at the top
   of the page. --- */
.toast-viewport {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 440px;
  width: calc(100% - var(--space-8));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-relaxed);
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.2s ease-out;
}

.toast-success {
  background: var(--color-success-bg);
  border: 1px solid var(--color-success-border);
  color: var(--color-success);
}

.toast-error {
  background: var(--color-error-bg);
  border: 1px solid var(--color-error-border);
  color: var(--color-error);
}

.toast-warning {
  background: var(--color-warning-bg);
  border: 1px solid var(--color-warning-border);
  color: var(--color-warning);
}

.toast-info {
  background: var(--color-primary-yellow-light);
  border: 1px solid var(--color-primary-yellow);
  color: var(--color-primary-blue);
}

.toast-icon {
  flex-shrink: 0;
  font-size: 1.2em;
}

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

.toast-close {
  flex-shrink: 0;
  cursor: pointer;
  background: none;
  border: none;
  font-size: var(--font-size-xl);
  line-height: 1;
  color: inherit;
  opacity: 0.55;
  padding: 0;
}

.toast-close:hover {
  opacity: 1;
}

.toast.toast-leaving {
  animation: toast-out 0.15s ease-in forwards;
}

@keyframes toast-in {
  from { transform: translateX(16px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toast-out {
  to { transform: translateX(16px); opacity: 0; }
}

@media (max-width: 600px) {
  .toast-viewport {
    left: var(--space-4);
    right: var(--space-4);
    max-width: none;
    width: auto;
  }
}


/* --- TRAINING GUIDE (guide/index.blade.php, guide/admin.blade.php) —
   a two-column in-page TOC + long-form content layout, all within the
   normal .page content area (still uses the main app sidebar/layout,
   this is just this one page's own internal navigation). --- */
.guide-layout {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: var(--space-6);
  align-items: start;
}

.guide-toc {
  position: sticky;
  top: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: calc(100vh - var(--space-8));
  overflow-y: auto;
}

.guide-toc-heading {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
  color: var(--color-text-faint);
  font-weight: var(--font-weight-bold);
  padding: var(--space-3) var(--space-3) var(--space-1);
}

.guide-toc a {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: var(--font-size-sm);
}

.guide-toc a:hover {
  background: var(--color-bg);
  color: var(--color-primary-blue);
}

.guide-content section {
  margin-bottom: var(--space-8);
  scroll-margin-top: var(--space-4);
}

.guide-content h2 {
  font-size: var(--font-size-xl);
  color: var(--color-primary-blue);
  border-bottom: 2px solid var(--color-border);
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-4);
}

.guide-content h3 {
  font-size: var(--font-size-lg);
  margin: var(--space-5) 0 var(--space-2);
  color: var(--color-text-primary);
}

.guide-content p {
  margin-bottom: var(--space-3);
  line-height: var(--line-height-relaxed);
}

.guide-content ol,
.guide-content ul {
  margin: 0 0 var(--space-3) var(--space-5);
  line-height: var(--line-height-relaxed);
}

.guide-content li {
  margin-bottom: var(--space-1);
}

.guide-content code {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--color-primary-blue);
}

.guide-example {
  background: var(--color-primary-yellow-light);
  border-left: 4px solid var(--color-primary-yellow);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin: var(--space-3) 0;
}

.guide-example strong {
  color: var(--color-primary-blue);
}

@media (max-width: 900px) {
  .guide-layout {
    grid-template-columns: 1fr;
  }

  .guide-toc {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    max-height: none;
  }
}

/* --- PACKAGING COSTS: collapsible per-row Photos / Manage menus ---
   A dense per-pack-size table row used to spell out 3 photo pickers and
   4 action buttons inline; both collapse into a small button that reveals
   a floating panel on click, native <details> — no JS. */

.pc-disclosure {
  position: relative;
  display: inline-block;
}

.pc-disclosure > summary {
  list-style: none;
  cursor: pointer;
}

.pc-disclosure > summary::-webkit-details-marker {
  display: none;
}

.pc-disclosure[open] > summary {
  background: var(--color-primary-yellow);
  border-color: var(--color-primary-yellow);
  color: var(--color-primary-blue);
}

.pc-disclosure-panel {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 5;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: var(--space-3);
}

.pc-manage-menu {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 160px;
}

.pc-manage-menu a {
  display: block;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  text-decoration: none;
  font-size: var(--font-size-sm);
  white-space: nowrap;
}

.pc-manage-menu a:hover {
  background: var(--color-primary-yellow-light);
}

.pc-photos-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: 220px;
}

.pc-photo-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pc-photo-row-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.pc-photo-thumb {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.pc-photo-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
  color: var(--color-text-muted);
}

.pc-photo-row input[type="file"] {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font-size: var(--font-size-xs);
  padding: 4px 6px;
}

/* Rows near the bottom of a table don't have room for the panel to open
   downward before it hits the card's clipped edge (clip-path on .card,
   plus overflow-x:auto on .table-wrap forcing overflow-y to clip too) —
   flip those to open upward instead. Thresholds sized to each panel's
   rough height in row-units (photos: ~4 rows tall, manage: ~2). */
tbody tr:nth-last-child(-n+4) .pc-photos-panel,
tbody tr:nth-last-child(-n+2) .pc-manage-menu {
  top: auto;
  bottom: calc(100% + 4px);
}

.pc-stock-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 8px;
  font-size: var(--font-size-sm);
  white-space: nowrap;
}
