/* NorthStock — Shopify Polaris (Admin-native)
   Tokens follow Polaris web components / Admin: Inter, #f1f1f1 page, dark primary. */

:root {
  --p-color-bg: #f1f1f1;
  --p-color-bg-surface: #ffffff;
  --p-color-bg-surface-hover: #f7f7f7;
  --p-color-bg-fill-brand: #303030;
  --p-color-bg-fill-brand-hover: #1a1a1a;
  --p-color-text: #303030;
  --p-color-text-secondary: #616161;
  --p-color-border: #e3e3e3;
  --p-color-border-emphasis: #8a8a8a;
  --p-color-text-info: #005bd3;
  --p-color-bg-fill-info: #eaf4ff;
  --p-color-text-success: #0c5132;
  --p-color-bg-fill-success: #cdfee1;
  --p-color-text-warning: #5e4200;
  --p-color-bg-fill-warning: #fff1e3;
  --p-color-text-critical: #8e1f0b;
  --p-color-bg-fill-critical: #fedad9;
  --p-font-family: "Inter", -apple-system, BlinkMacSystemFont, "San Francisco",
    "Segoe UI", Roboto, "Helvetica Neue", sans-serif;

  --bg: var(--p-color-bg);
  --bg-elevated: #ebebeb;
  --bg-card: var(--p-color-bg-surface);
  --bg-hover: var(--p-color-bg-surface-hover);
  --border: var(--p-color-border);
  --border-strong: var(--p-color-border-emphasis);
  --text: var(--p-color-text);
  --text-muted: var(--p-color-text-secondary);
  --text-soft: #4a4a4a;
  --accent: var(--p-color-text-info);
  --accent-hover: #004299;
  --accent-soft: rgba(0, 91, 211, 0.08);
  --taupe: #8a8a8a;
  --taupe-deep: var(--p-color-bg-fill-brand);
  --taupe-hover: var(--p-color-bg-fill-brand-hover);
  --taupe-ink: var(--p-color-text);
  --bg-muted: #f7f7f7;
  --bg-table-head: #f7f7f7;
  --focus-ring: 0 0 0 3px rgba(0, 91, 211, 0.35);
  --success: var(--p-color-text-success);
  --success-bg: var(--p-color-bg-fill-success);
  --warning: var(--p-color-text-warning);
  --warning-bg: var(--p-color-bg-fill-warning);
  --danger: var(--p-color-text-critical);
  --danger-bg: var(--p-color-bg-fill-critical);
  --info: var(--p-color-text-info);
  --info-bg: var(--p-color-bg-fill-info);
  --offline: #616161;
  --live: var(--p-color-text-success);
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 0 rgba(26, 26, 26, 0.07);
  --shadow-hover: 0 4px 12px rgba(26, 26, 26, 0.08);
  --font: var(--p-font-family);
  --mono: "Cascadia Code", "Consolas", "SF Mono", monospace;
  --header-bg: #ffffff;
  --header-text: #303030;
  --utility-bg: #f1f1f1;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: var(--accent);
}

s-page {
  display: block;
}

s-banner[hidden] {
  display: none !important;
}

.shopify-connecting {
  display: none;
  min-height: 70vh;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
}

.shopify-connecting-panel {
  width: 100%;
  max-width: 22rem;
  text-align: center;
  margin-bottom: 0;
}

.shopify-connecting-panel h1 {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
  font-weight: 500;
}

.shopify-connecting-panel > .muted {
  margin-bottom: 0.75rem !important;
}

.shopify-connecting-panel .form-actions {
  justify-content: center;
  margin-top: 0.75rem;
}

html.shopify-auth-pending .shopify-connecting {
  display: flex;
}

html.shopify-auth-pending .announce-bar,
html.shopify-auth-pending .app-shell,
html.shopify-auth-pending ui-nav-menu,
html.shopify-auth-pending .outage-banner,
html.shopify-auth-pending .warning-banner,
html.shopify-auth-pending .trial-banner,
html.shopify-auth-pending .review-prompt,
html.shopify-auth-pending .app-modal {
  display: none !important;
}

/* Top bar — Polaris Admin surface */
.announce-bar {
  background: var(--header-bg);
  color: var(--header-text);
  border-bottom: 1px solid var(--border);
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
}

.announce-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

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

.company-name {
  color: var(--text-soft);
  font-weight: 500;
}

.announce-left #btn-home {
  margin-right: -0.15rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge.offline {
  background: rgba(194, 183, 172, 0.35);
  color: var(--taupe-ink);
  border: 1px solid var(--border-strong);
}

.badge.live {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(41, 132, 90, 0.35);
}

.badge.catalog-loading-chip {
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid rgba(0, 91, 211, 0.22);
  max-width: min(28rem, calc(100vw - 8rem));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
}

.badge.catalog-loading-chip[hidden] {
  display: none !important;
}

.outage-banner {
  background: var(--warning-bg);
  color: var(--warning);
  border-bottom: 1px solid rgba(180, 83, 9, 0.22);
  padding: 0.5rem 1.25rem;
  font-size: 0.88rem;
  font-weight: 500;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.outage-banner[hidden] {
  display: none;
}

.outage-banner-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.outage-banner-link:hover {
  color: var(--accent-hover);
}

.warning-banner {
  background: var(--warning-bg);
  color: var(--warning);
  border-bottom: 1px solid rgba(180, 83, 9, 0.22);
  border-left: 4px solid var(--warning);
  padding: 0.5rem 1.25rem;
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 0.65rem;
  flex-wrap: wrap;
  text-align: center;
}

.warning-banner[hidden] {
  display: none;
}

.warning-banner-icon {
  font-size: 1.05rem;
  line-height: 1;
}

.warning-banner-label {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.warning-banner-message {
  font-weight: 500;
  color: var(--text-soft);
}

.trial-banner {
  background: var(--info-bg);
  color: var(--info);
  border-bottom: 1px solid var(--border);
  border-left: 4px solid var(--info);
  padding: 0.5rem 1.25rem;
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 0.85rem;
  flex-wrap: wrap;
  text-align: center;
}

.trial-banner[hidden] {
  display: none;
}

.trial-banner-message {
  font-weight: 500;
  color: var(--text-soft);
}

.review-prompt {
  background: var(--bg-card);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  border-left: 4px solid var(--taupe-deep);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1.1rem;
  flex-wrap: wrap;
  text-align: left;
  position: relative;
  box-shadow: var(--shadow);
}

.review-prompt[hidden] {
  display: none;
}

.review-prompt-body {
  min-width: 12rem;
  max-width: 36rem;
}

.review-prompt-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.review-prompt-copy {
  margin: 0.2rem 0 0;
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--text-muted);
}

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

.review-prompt-close {
  position: absolute;
  top: 0.35rem;
  right: 0.45rem;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius);
}

.review-prompt-close:hover,
.review-prompt-close:focus-visible {
  color: var(--text);
  background: var(--bg-hover);
}

.billing-trial-panel {
  margin-bottom: 1rem;
}

.billing-trial-days {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 500;
}

/* Status badges — product + workflow states (light UI surfaces) */
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.2;
  white-space: nowrap;
  border: 1px solid transparent;
  vertical-align: middle;
  max-width: 100%;
}

.status-badge--active,
.status-badge--complete,
.status-badge--success,
.status-badge--ready {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(41, 132, 90, 0.28);
}

.status-badge--draft,
.status-badge--inactive,
.status-badge--pending,
.status-badge--skipped,
.status-badge--empty,
.status-badge--neutral {
  background: var(--bg-elevated);
  color: var(--text-muted);
  border-color: var(--border);
}

.status-badge--archived,
.status-badge--paused,
.status-badge--warning {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: rgba(180, 83, 9, 0.28);
}

.status-badge--unlisted,
.status-badge--processing,
.status-badge--posting,
.status-badge--info {
  background: var(--info-bg);
  color: var(--info);
  border-color: rgba(21, 50, 203, 0.22);
}

.status-badge--preorder {
  background: rgba(162, 28, 175, 0.12); /* fuchsia — matches Preorder KPI/bar */
  color: #a21caf;
  border-color: rgba(162, 28, 175, 0.28);
}

.status-badge--failed,
.status-badge--error {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(142, 31, 11, 0.28);
}

/* Stack product status + Preorder badges in one cell */
.status-badge-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  max-width: 100%;
}

/* Table cells with badges */
td .status-badge {
  font-size: 0.7rem;
}

.detail-body dd .status-badge {
  margin-top: 0.1rem;
}

.detail-body dd .status-badge-group {
  margin-top: 0.1rem;
}

.announce-right {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  flex: 1;
  justify-content: flex-end;
  min-width: 200px;
}

.global-search {
  display: flex;
  gap: 0.35rem;
  flex: 1;
  max-width: 380px;
}

.global-search input {
  flex: 1;
  min-width: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45rem 0.75rem;
  color: var(--text);
}

.global-search input::placeholder {
  color: var(--text-muted);
}

.global-search input:focus {
  outline: 2px solid rgba(0, 91, 211, 0.45);
  border-color: var(--accent);
  background: var(--bg-card);
}

.announce-bar .btn-ghost,
.announce-bar .btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-soft);
}

.announce-bar .btn-ghost:hover:not(:disabled),
.announce-bar .btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-icon {
  padding: 0.3rem 0.45rem;
  min-width: 2.25rem;
}

.btn-icon-glyph {
  display: block;
  width: 1.15rem;
  height: 1.15rem;
}

.btn-icon-glyph svg {
  display: block;
  width: 100%;
  height: 100%;
}

.announce-bar .btn-icon {
  align-self: stretch;
  min-width: 2.35rem;
  padding: 0 0.5rem;
}

.announce-bar .btn-icon-glyph {
  width: 1.2rem;
  height: 1.2rem;
}

/* Layout */
.app-shell {
  max-width: 1180px;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3.5rem;
}

/* Build version stamp — bottom-right on every screen */
.app-build-footer {
  position: fixed;
  right: 1.25rem;
  bottom: 0.85rem;
  z-index: 40;
  margin: 0;
  padding: 0.25rem 0.55rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  pointer-events: none;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.3;
  color: var(--text-muted);
  background: rgba(241, 241, 241, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  user-select: none;
}

.app-legal-links {
  display: inline-flex;
  gap: 0.55rem;
  pointer-events: auto;
}

.app-legal-links a {
  color: var(--accent);
  text-decoration: none;
}

.app-legal-links a:hover {
  text-decoration: underline;
}

.screen {
  display: none;
  animation: fadeIn 0.2s ease;
}

.screen.active {
  display: block;
  min-width: 0;
  max-width: 100%;
}

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

/*
 * Screen headers: title + actions on row 1; subtitle always full page width on row 2.
 * Supports both layouts:
 *   <div><h1/><p/></div><div class="header-actions"/>
 *   <div><h1/></div><div class="header-actions"/><p/>
 */
.screen-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 1rem;
  row-gap: 0.5rem;
  align-items: start;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

/* Let h1 / p inside the title wrapper participate in the parent grid */
.screen-header > div:not(.header-actions) {
  display: contents;
}

.screen-header h1 {
  grid-column: 1;
  grid-row: 1;
  margin: 0;
  min-width: 0;
  font-size: 1.85rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text);
}

.screen-header > .header-actions {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  align-self: start;
}

#screen-menu .screen-header > .header-actions {
  align-self: stretch;
  justify-self: end;
  align-items: flex-start;
}

/* Subtitle: full content width (never squeezed beside action buttons) */
.screen-header p {
  grid-column: 1 / -1;
  grid-row: 2;
  margin: 0;
  max-width: none;
  width: 100%;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

/* A second line (e.g. “Adjusting at …”) stacks below the description */
.screen-header p + p {
  grid-row: 3;
}

.screen-header .transfer-location-name,
.screen-header .context-name {
  font-weight: 600;
  color: var(--text);
}

/* Legacy class — full-width subtitle is now the default for all headers */
.screen-header--full-subtitle > p {
  grid-column: 1 / -1;
  max-width: none;
}

#screen-purchase-order .screen-header h1 {
  white-space: nowrap;
}

#screen-purchase-order .header-actions {
  flex-wrap: nowrap;
}

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

/* Buttons — Polaris: dark primary, outlined secondary */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  border-radius: var(--radius);
  font-weight: 550;
  font-size: 0.875rem;
  letter-spacing: 0;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

/* Author .btn display must not override the HTML hidden attribute */
.btn[hidden],
button[hidden] {
  display: none !important;
}

[data-requires-preorder][hidden],
[data-requires-get-started][hidden] {
  display: none !important;
}

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

.btn-primary {
  background: var(--taupe-deep);
  color: #fff;
  border-color: var(--taupe-deep);
}

.btn-primary:hover:not(:disabled) {
  background: var(--taupe-hover);
  border-color: var(--taupe-hover);
  box-shadow: var(--shadow);
}

.btn-secondary {
  background: #fff;
  border-color: var(--border-strong);
  color: var(--text-soft);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--taupe-deep);
  color: var(--text);
}

.btn-danger {
  background: var(--danger-bg);
  border-color: rgba(142, 31, 11, 0.35);
  color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
  background: #fde8e4;
}

.btn-success {
  background: var(--success-bg);
  border-color: rgba(41, 132, 90, 0.35);
  color: var(--success);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
}

/* Store capacity indicator — two lines, split after units, text on the right */
.store-capacity {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 0.28rem;
  box-sizing: border-box;
  height: auto;
  min-height: 1.85rem;
  min-width: 22rem;
  max-width: 36rem;
  padding: 0.4rem 0.9rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  text-align: right;
}

/* Author display:flex must not override the HTML hidden attribute */
.store-capacity[hidden] {
  display: none !important;
}

.store-capacity-identity {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 0.55rem;
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
  white-space: nowrap;
}

.store-capacity-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0;
}

.store-capacity-values {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 0.2rem 0.28rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.store-capacity-used {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.store-capacity-sep {
  color: var(--text-muted);
  font-weight: 500;
}

.store-capacity-max {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-soft);
}

.store-capacity-unit {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.store-capacity-stats {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem 0.85rem;
  width: 100%;
  min-width: 0;
}

.store-capacity-meter {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  flex: 1 1 7.5rem;
  min-width: 6.5rem;
}

.store-capacity-inventory-value {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
  text-align: right;
}

.store-capacity-value-amt {
  font-weight: 600;
  color: var(--text-soft);
}

.store-capacity--loading .store-capacity-value-amt {
  color: var(--text-muted);
  font-weight: 500;
}

.store-capacity-bar {
  margin: 0;
  flex: 1 1 auto;
  height: 0.35rem;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  overflow: hidden;
}

.store-capacity-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--success);
  transition: width 0.35s ease, background-color 0.25s ease;
}

.store-capacity--ok .store-capacity-bar-fill {
  background: var(--success);
}

.store-capacity--warn .store-capacity-bar-fill {
  background: var(--warning);
}

.store-capacity--over .store-capacity-bar-fill {
  background: var(--danger);
}

.store-capacity--unset .store-capacity-bar-fill {
  background: var(--taupe);
}

.store-capacity--loading .store-capacity-used,
.store-capacity--loading .store-capacity-max {
  color: var(--text-muted);
}

.store-capacity-pct {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.store-capacity--over .store-capacity-pct {
  color: var(--danger);
}

.store-capacity--warn .store-capacity-pct {
  color: var(--warning);
}

.store-capacity-config-link {
  font-size: 0.75rem;
  white-space: nowrap;
}

/* Operations Dashboard — left section nav + tile panel */
.menu-shell {
  display: grid;
  grid-template-columns: minmax(200px, 240px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.menu-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 0.55rem;
  position: sticky;
  top: 0.75rem;
}

.menu-nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  text-align: left;
  padding: 0.7rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

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

.menu-nav-item.is-active {
  background: var(--accent-soft);
  border-color: rgba(21, 50, 203, 0.18);
  color: var(--accent);
  font-weight: 600;
}

.menu-nav-item:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.menu-nav-icon {
  flex: 0 0 auto;
  width: 1.75rem;
  text-align: center;
  font-size: 1.15rem;
  line-height: 1;
}

.menu-nav-label {
  font-size: 0.95rem;
  line-height: 1.3;
}

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

.menu-panel {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.2rem 1.25rem;
}

.menu-panel.is-active {
  display: block;
}

.menu-panel-header {
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.menu-panel-header h2 {
  margin: 0 0 0.2rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.menu-panel-header p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.9rem;
}

.get-started-group {
  max-width: 40rem;
}

.get-started-group:not(:has(.get-started-item:not([hidden]))) {
  display: none;
}

.get-started-group + .get-started-group {
  margin-top: 1.1rem;
  padding-top: 0.95rem;
  border-top: 1px solid var(--border);
}

.get-started-group-title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.get-started-checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.get-started-checklist > li:has([hidden]) {
  display: none;
}

.get-started-checklist > li:not(:has([hidden])) ~ li:not(:has([hidden])) {
  border-top: 1px solid var(--border);
}

.get-started-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  padding: 0.75rem 0.45rem;
  box-shadow: none;
  transition: background 0.15s;
}

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

.get-started-item:hover .get-started-icon {
  background: var(--bg-card);
  border-color: var(--border-strong);
}

.get-started-item:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.get-started-item::after {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  margin-left: auto;
  flex-shrink: 0;
  border-right: 1.5px solid var(--text-muted);
  border-bottom: 1.5px solid var(--text-muted);
  transform: rotate(-45deg);
  opacity: 0.7;
}

.get-started-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-muted);
  font-size: 0.95rem;
  line-height: 1;
}

.get-started-item-body {
  min-width: 0;
  flex: 1;
}

.get-started-item-title {
  display: block;
  font-weight: 500;
  color: var(--text);
  font-size: 0.95rem;
}

.get-started-item-copy {
  display: block;
  margin-top: 0.15rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.get-started-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.85rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  max-width: 40rem;
}

.get-started-footer .hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.menu-subsection {
  margin-top: 1.35rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
}

.menu-subsection:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.menu-subsection-title {
  margin: 0 0 0.2rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.menu-subsection-copy {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.toolbar-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.86rem;
  color: var(--text-soft);
  white-space: nowrap;
}

.toolbar-check input[type="checkbox"] {
  accent-color: var(--taupe-deep);
}

.menu-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.1rem;
  text-align: left;
  box-shadow: none;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s, background 0.18s;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  position: relative;
  overflow: hidden;
}

.menu-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--taupe);
  opacity: 0;
  transition: opacity 0.18s;
}

.menu-card:hover {
  border-color: var(--taupe);
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.menu-card:hover::before {
  opacity: 1;
}

.menu-card .icon {
  font-size: 1.45rem;
  line-height: 1;
  opacity: 0.9;
}

.menu-card h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text);
}

.menu-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.menu-card-badge {
  display: inline-block;
  min-width: 1.25rem;
  padding: 0.08rem 0.4rem;
  margin-left: 0.35rem;
  border-radius: 999px;
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(180, 83, 9, 0.28);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.3;
  vertical-align: middle;
}

@media (max-width: 720px) {
  .store-capacity {
    min-width: 0;
    max-width: none;
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 0.45rem 0.75rem;
    gap: 0.35rem;
  }

  .store-capacity-identity {
    flex-wrap: wrap;
    white-space: normal;
    justify-content: flex-end;
  }

  .store-capacity-stats {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .store-capacity-meter {
    flex: 1 1 8rem;
    min-width: 0;
  }

  .menu-shell {
    grid-template-columns: 1fr;
  }

  .menu-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .menu-nav-item {
    flex: 1 1 auto;
    min-width: calc(50% - 0.35rem);
  }

  table.data-table {
    font-size: 0.78rem;
  }

  table.data-table th,
  table.data-table td {
    padding: 0.4rem 0.4rem;
  }
}

/* Location picker on analytics, reports, and Count Inventory */
.analytics-location-bar,
.toolbar.toolbar-location {
  margin-top: -0.5rem;
}

.analytics-location-bar .toolbar-select,
.toolbar-location .toolbar-select {
  min-width: 14rem;
  max-width: 22rem;
}

.toolbar-location {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

/* display:flex above would otherwise keep a one-location picker visible */
.toolbar-location[hidden] {
  display: none;
}

/* Higher specificity than .toolbar so stacked location pickers stay left-aligned. */
.toolbar.transfer-location-stack {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.65rem;
}

.transfer-location-field {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  width: min(100%, 22rem);
}

.transfer-location-stack .toolbar-select {
  width: 100%;
  max-width: none;
}

/* Analytics KPI sections */
.analytics-section {
  margin-bottom: 2rem;
}

.analytics-section .kpi-grid {
  margin-bottom: 0;
}

/* KPI cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.25rem, 11.25rem));
  justify-content: start;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 720px) {
  .kpi-grid {
    grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  }
}

.kpi-card {
  --kpi-accent: var(--border-strong);
  appearance: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
  min-height: 5.75rem;
  margin: 0;
  padding: 0.85rem 0.95rem 0.8rem;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 3px 0 var(--kpi-accent), var(--shadow);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.kpi-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
  box-shadow: inset 0 3px 0 var(--kpi-accent), var(--shadow-hover);
}

.kpi-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.kpi-card .label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.3;
  min-height: 2.6em;
}

.kpi-card .value {
  font-size: 1.55rem;
  font-weight: 600;
  line-height: 1.15;
  min-height: 1.8rem;
  margin: 0.2rem 0 0;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Accent matches the distribution bar for that card */
.kpi-card.positive {
  --kpi-accent: #29845a;
}
.kpi-card.zero {
  --kpi-accent: #b45309;
}
.kpi-card.neg {
  --kpi-accent: #8e1f0b;
}
.kpi-card.activeitems {
  --kpi-accent: #15803d;
}
.kpi-card.missingcost {
  --kpi-accent: #d97706;
}
.kpi-card.missingsupplier {
  --kpi-accent: #4f46e5;
}
.kpi-card.missingtags {
  --kpi-accent: #0f766e;
}
.kpi-card.missingcollection {
  --kpi-accent: #7c3aed;
}
.kpi-card.uncategorized {
  --kpi-accent: #c2410c;
}
.kpi-card.preorder {
  --kpi-accent: #a21caf;
}
.kpi-card.invalid {
  --kpi-accent: #1d4ed8;
}
.kpi-card.draft {
  --kpi-accent: #64748b;
}
.kpi-card.archived {
  --kpi-accent: #be123c;
}
.kpi-card.nottracked,
.kpi-card.allitems {
  --kpi-accent: var(--taupe-deep);
}

.kpi-card.is-loading {
  cursor: wait;
  opacity: 0.92;
}

.kpi-card.is-loading:hover {
  box-shadow: inset 0 3px 0 var(--kpi-accent), var(--shadow);
  border-color: var(--border);
}

.kpi-card .value .kpi-spinner,
.kpi-spinner {
  display: inline-block;
  width: 1.15rem;
  height: 1.15rem;
  border: 2px solid var(--border);
  border-top-color: var(--taupe, #8b7e74);
  border-radius: 50%;
  animation: kpi-spin 0.7s linear infinite;
  vertical-align: middle;
}

.kpi-card .value .kpi-spinner {
  width: 1.4rem;
  height: 1.4rem;
  margin-top: 0.35rem;
}

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

/* Forms */
.form-panel.profile-flash {
  animation: profile-flash 0.55s ease;
}

@keyframes profile-flash {
  0% {
    box-shadow: 0 0 0 0 rgba(21, 50, 203, 0);
  }
  30% {
    box-shadow: 0 0 0 3px rgba(194, 183, 172, 0.85);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(21, 50, 203, 0);
  }
}

/* Configuration — left nav + panel layout */
.config-layout {
  display: grid;
  grid-template-columns: minmax(200px, 240px) 1fr;
  gap: 1.25rem;
  align-items: start;
}

.config-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.65rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0.75rem;
}

.config-nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-soft);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.3;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

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

.config-nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(21, 50, 203, 0.18);
  font-weight: 600;
}

.config-nav-item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(194, 183, 172, 0.55);
}

.config-main {
  min-width: 0;
}

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

.config-panel > .form-actions {
  margin-top: 0.25rem;
}

@media (max-width: 720px) {
  .supplier-form-grid,
  .supplier-form-grid.supplier-form-grid--no-type,
  .supplier-contact-grid,
  .supplier-address-row {
    grid-template-columns: 1fr;
  }

  .config-layout {
    grid-template-columns: 1fr;
  }

  .config-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .config-nav-item {
    flex: 1 1 auto;
    text-align: center;
  }
}

/* Supplier configuration list */
.supplier-list-wrap {
  margin: 0.75rem 0 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: hidden;
  overflow-y: hidden;
  max-width: 100%;
  min-width: 0;
  background: #fff;
}

.supplier-table {
  width: 100%;
  min-width: 0;
  margin: 0;
  border: none;
  box-shadow: none;
  table-layout: fixed;
}

.supplier-table th,
.supplier-table td {
  padding: 0.65rem 0.85rem;
  vertical-align: middle;
}

.supplier-table .col-type {
  width: 7.5rem;
  white-space: nowrap;
}

.supplier-table .col-margin {
  width: 6.5rem;
  text-align: right;
  white-space: nowrap;
}

.supplier-table .col-returns {
  width: 8.5rem;
  text-align: center;
  white-space: nowrap;
}

.supplier-table .col-actions {
  width: 9.5rem;
  text-align: right;
  white-space: nowrap;
}

.supplier-table .supplier-actions {
  display: flex;
  gap: 0.35rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.supplier-table tbody tr.is-editing {
  background: var(--accent-soft);
}

.supplier-table tbody tr.is-disabled {
  background: var(--bg-elevated);
  color: var(--text-muted);
}

.supplier-table tbody tr.is-disabled .supplier-margin-value,
.supplier-table tbody tr.is-disabled .supplier-type-value {
  color: var(--text-muted);
}

.supplier-type-value {
  font-size: 0.9rem;
}

.supplier-table.supplier-table--hide-type .col-type,
.supplier-table.supplier-table--hide-type .supplier-type-cell {
  display: none;
}

.supplier-list-empty {
  margin: 0;
  padding: 1rem 0.85rem;
  text-align: center;
}

.supplier-add-form {
  margin-top: 0.25rem;
  padding: 1rem 1.05rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.supplier-form-title {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.supplier-form-section {
  margin-top: 0.9rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.supplier-form-section:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.supplier-form-section-title {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.supplier-form-grid {
  grid-template-columns: 1fr minmax(120px, 160px) minmax(100px, 140px);
}

.supplier-contact-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.supplier-address-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 0.8fr);
  gap: 0.9rem 1.1rem;
}

.supplier-country-field {
  grid-column: 1 / -1;
  max-width: 16rem;
}

.supplier-country-field .toolbar-select,
.supplier-address-row .toolbar-select {
  width: 100%;
}

.supplier-name-primary {
  font-weight: 500;
}

.supplier-name-meta {
  margin-top: 0.1rem;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
}

.supplier-form-grid.supplier-form-grid--no-type {
  grid-template-columns: 1fr minmax(100px, 140px);
}

.supplier-form-grid .field-supplier-type .toolbar-select {
  width: 100%;
}

.supplier-form-grid .field-margin input {
  max-width: 100%;
}

.supplier-form-grid .supplier-returns-field {
  grid-column: 1 / -1;
  margin-top: 0.15rem;
}

.supplier-form-grid .supplier-returns-field .checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.supplier-form-grid .supplier-returns-field input[type='checkbox'] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--taupe-deep, var(--accent));
  cursor: pointer;
}

.supplier-form-grid .field-supplier-vendor,
.supplier-form-grid .field-supplier-product-tag {
  grid-column: 1 / -1;
  max-width: 28rem;
}

.supplier-notes-field textarea {
  min-height: 6.5rem;
  resize: vertical;
  line-height: 1.4;
}

.supplier-match-typeahead {
  position: relative;
  width: 100%;
}

.supplier-match-typeahead .toolbar-select {
  width: 100%;
  cursor: text;
}

.supplier-match-suggestions {
  position: absolute;
  z-index: 40;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  max-height: 12rem;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.supplier-match-suggestion {
  padding: 0.4rem 0.7rem;
  cursor: pointer;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.supplier-match-suggestion:hover,
.supplier-match-suggestion.is-active {
  background: var(--bg-hover);
}

.supplier-match-suggestion-empty {
  cursor: default;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.supplier-match-suggestion-empty:hover {
  background: transparent;
}

.supplier-margin-value {
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  font-size: 0.9rem;
}

.supplier-returns-value {
  font-size: 0.9rem;
  font-weight: 500;
}

.supplier-returns-value.is-yes {
  color: var(--success);
}

.supplier-returns-value.is-no {
  color: var(--text-muted);
}

/* Inline margin editor (Update Missing Costs) */
.inline-margin-input {
  width: 4.5rem;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  font-family: var(--mono);
  font-size: 0.85rem;
  text-align: right;
}

.inline-margin-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.form-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.4rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.form-panel h2,
.form-panel h3 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text);
}

.form-panel > .muted {
  margin-top: 0 !important;
  margin-bottom: 1rem !important;
}

.onboarding-layout {
  display: grid;
  gap: 1rem;
  max-width: 48rem;
}

.onboarding-step-list {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.45;
}

.onboarding-step-list li + li {
  margin-top: 0.45rem;
}

.onboarding-step h2 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.onboarding-step p {
  margin: 0.45rem 0 0;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.45;
}

.onboarding-shot {
  margin: 0.85rem 0 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}

.onboarding-shot img {
  display: block;
  width: 100%;
  height: auto;
}

.onboarding-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 999px;
  background: var(--taupe-deep);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  flex-shrink: 0;
}

.onboarding-step--optional h2 {
  display: block;
}

.onboarding-step--optional .muted {
  margin: 0.2rem 0 0.45rem;
}

.field .toolbar-select {
  width: 100%;
  max-width: none;
  min-width: 0;
}

.form-actions--flush {
  margin-top: 1rem;
  border-top: none;
  padding-top: 0;
}

.pick-panel {
  max-width: 32rem;
}

.pick-panel .toolbar-select {
  width: 100%;
  max-width: none;
}

.pick-panel > .pick-panel-note {
  margin-top: 0.75rem !important;
  margin-bottom: 0 !important;
}

.pick-panel > .pick-panel-summary {
  margin-top: 0.5rem !important;
  margin-bottom: 0 !important;
}

.shopify-install-grid {
  margin-top: 1rem;
}

.shopify-install-hint {
  margin-top: 0.75rem;
}

.supplier-form-actions {
  border-top: none;
  padding-top: 0.5rem;
  margin-top: 0.5rem;
}

.loading-msg {
  margin-bottom: 0.75rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.9rem 1.1rem;
}

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

.field[hidden] {
  display: none !important;
}

.field label {
  font-size: 0.78rem;
  color: var(--text-soft);
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.7rem;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

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

.field-full {
  grid-column: 1 / -1;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.plan-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow: var(--shadow);
}

.plan-card.is-current {
  border-color: var(--taupe-deep);
}

.plan-card h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 500;
}

.plan-card .plan-price {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.plan-card .plan-price span {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-muted);
}

.plan-card .plan-features {
  margin: 0 0 0.25rem;
  padding-left: 1.15rem;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.plan-card .plan-features li + li {
  margin-top: 0.25rem;
}

.plan-card .plan-current {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--success);
}

.plan-card .btn {
  margin-top: auto;
}

#billing-test-note,
#config-plan-test-note {
  margin-top: 0;
}

.feature-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.feature-list .toggle-row {
  margin-bottom: 0;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.15rem;
  padding: 0.75rem 0.9rem;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.switch {
  position: relative;
  width: 48px;
  height: 26px;
  background: var(--border-strong);
  border-radius: 999px;
  border: none;
  padding: 0;
  flex-shrink: 0;
}

.switch.on {
  background: var(--taupe-deep);
}

.switch .knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.switch.on .knob {
  transform: translateX(22px);
}

.switch[disabled],
.switch[aria-disabled='true'] {
  opacity: 0.72;
  cursor: not-allowed;
}

.toggle-label {
  font-weight: 500;
  color: var(--text);
  font-size: 0.95rem;
}

.feature-toggle-warning {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--warning);
}

.feature-toggle-warning[hidden] {
  display: none;
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.error-box {
  background: var(--danger-bg);
  border: 1px solid rgba(142, 31, 11, 0.28);
  color: var(--danger);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  white-space: pre-wrap;
  display: none;
}

.error-box.visible {
  display: block;
}

.success-box {
  background: var(--success-bg);
  border: 1px solid rgba(41, 132, 90, 0.3);
  color: var(--success);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  white-space: pre-wrap;
  display: none;
  font-weight: 500;
}

.success-box.visible {
  display: block;
}

#shopify-test-success.visible,
#shopify-test-error.visible {
  display: block;
}

/* Tables */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.85rem;
}

/* Selection controls always sit on their own row under the filters */
.toolbar-selection {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  width: 100%;
}

.toolbar input[type="search"],
.toolbar input[type="text"],
.toolbar-select {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45rem 0.7rem;
  min-width: 180px;
  color: var(--text);
  font: inherit;
}

.toolbar-select {
  min-width: 12rem;
  max-width: 18rem;
  cursor: pointer;
}

.count-find-toolbar {
  flex-wrap: wrap;
  margin-top: 0.5rem;
  margin-bottom: 0;
}

.count-find-toolbar .toolbar-select {
  min-width: 10rem;
  max-width: 16rem;
}

.toolbar-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
  white-space: nowrap;
}

.toolbar input[type="search"]:focus,
.toolbar input[type="text"]:focus,
.toolbar-select:focus {
  outline: none;
  border-color: var(--taupe-deep);
  box-shadow: 0 0 0 3px rgba(194, 183, 172, 0.4);
}

/* Stretch to the page width so every column stays in view (no in-table scrollbar). */
.table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow);
}

table.data-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  font-size: 0.875rem;
  table-layout: fixed;
}

table.data-table th,
table.data-table td {
  padding: 0.55rem 0.55rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  overflow: hidden;
  overflow-wrap: break-word;
  word-break: normal;
}

table.data-table th {
  background: var(--bg-table-head);
  color: var(--text-soft);
  font-weight: 500;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  text-overflow: ellipsis;
  line-height: 1.3;
}

table.data-table th:hover {
  color: var(--text);
  background: var(--bg-elevated);
}

table.data-table th .sort-ind {
  opacity: 0.5;
  margin-left: 0.25rem;
}

table.data-table tbody tr {
  cursor: pointer;
  transition: background 0.12s;
}

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

table.data-table tbody tr.selected {
  background: var(--accent-soft);
}

table.data-table th.col-admin,
table.data-table td.col-admin {
  width: 5.5rem;
  text-align: center;
  white-space: nowrap;
  overflow: visible;
}

table.data-table a.report-admin-link {
  text-decoration: none;
}

table.data-table a.report-admin-link:hover {
  border-color: var(--taupe-deep);
  color: var(--text);
}

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

table.data-table th.checkbox-cell,
table.data-table td.checkbox-cell {
  width: 2.4rem;
  max-width: 2.4rem;
  text-align: center;
  white-space: nowrap;
  overflow: visible;
}

table.data-table th.num-col,
table.data-table td.num-col {
  width: 6.5rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

table.data-table td.mono {
  white-space: nowrap;
  text-overflow: ellipsis;
}

table.data-table td:has(.btn),
table.data-table th.col-actions,
table.data-table td.col-actions {
  overflow: hidden;
  white-space: normal;
}

table.data-table td:has(.btn) .btn {
  max-width: 100%;
}

table.data-table input[type="number"],
table.data-table input[type="text"],
table.data-table input[type="search"] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

table.data-table th[data-sort="thumbnail"],
table.data-table td.col-thumb {
  width: 3.5rem;
  text-align: center;
}

.thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 3px;
  background: var(--bg);
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.qty-pos {
  color: var(--success);
  font-weight: 600;
}
.qty-zero {
  color: var(--warning);
  font-weight: 600;
}
.qty-neg {
  color: var(--danger);
  font-weight: 600;
}

/* Post adjustments — Message column shows Shopify / API errors */
.post-msg {
  max-width: 28rem;
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
}

.post-msg--error {
  color: var(--danger);
  font-weight: 500;
}

.post-msg--ok {
  color: var(--success);
  font-weight: 500;
}

table.data-table tbody tr.post-row--failed {
  background: var(--danger-bg);
}

table.data-table tbody tr.post-row--failed:hover {
  background: #fce8e4;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.85rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Detail */
.detail-card {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  max-width: 560px;
  box-shadow: var(--shadow);
}

.detail-thumb-empty {
  width: 120px;
  height: 120px;
}

.detail-card img,
.detail-thumb-img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
  display: block;
}

.detail-thumb-btn {
  display: block;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: zoom-in;
  border-radius: var(--radius);
  line-height: 0;
  position: relative;
}

.detail-thumb-btn:hover .detail-thumb-img,
.detail-thumb-btn:focus-visible .detail-thumb-img {
  box-shadow: 0 0 0 3px rgba(194, 183, 172, 0.55);
  border-color: var(--taupe-deep);
}

.detail-thumb-btn:focus-visible {
  outline: none;
}

/* App modals (count scan miss, etc.) */
body.app-modal-open,
body.image-modal-open {
  overflow: hidden;
}

.app-modal {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.app-modal[hidden] {
  display: none !important;
}

.app-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 14, 13, 0.72);
}

.app-modal-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 26rem);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.4rem 1.2rem;
  box-shadow: var(--shadow-hover);
}

.app-modal-panel--alert {
  border-color: rgba(142, 31, 11, 0.35);
  box-shadow: 0 12px 36px rgba(0, 17, 40, 0.18);
}

.app-modal-title {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--danger);
  letter-spacing: -0.01em;
}

.app-modal-panel--form {
  width: min(100%, 32rem);
  max-height: min(92vh, 44rem);
  overflow: auto;
}

.app-modal-panel--form .app-modal-title {
  margin: 0;
  color: var(--text);
  font-weight: 500;
}

.app-modal-form-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
}

.app-modal-intro {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.app-modal-close {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  margin: -0.25rem -0.35rem 0 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  font-size: 1.45rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.app-modal-close:hover,
.app-modal-close:focus-visible {
  color: var(--text);
  background: var(--bg-hover);
  outline: none;
  box-shadow: var(--focus-ring);
}

.app-modal-panel--form .form-actions {
  margin-top: 1rem;
}

.app-modal-panel--form .error-box {
  margin-top: 0.85rem;
}

.app-modal-panel--form textarea {
  min-height: 7.5rem;
  resize: vertical;
}

.app-modal-message {
  margin: 0 0 1.15rem;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--text);
  word-break: break-word;
}

.app-modal-message .mono {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text-soft);
}

.app-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.app-modal-panel--about {
  width: min(100%, 28rem);
}

.app-modal-panel--command {
  width: min(100%, 32rem);
}

/* Keep Menu and the command field usable while a command dialog is open. */
body.command-modal-open .announce-bar {
  position: relative;
  z-index: 2200;
}

.command-modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 0 0 1rem;
}

.command-qty-card,
.command-pick-list {
  margin: 0;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.command-qty-card h3,
.command-pick-name {
  margin: 0 0 0.2rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
}

.command-qty-meta,
.command-pick-meta {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.command-qty-total {
  margin: 0.55rem 0 0;
  font-size: 1.05rem;
  font-weight: 500;
}

.command-qty-locations {
  margin: 0.45rem 0 0;
  padding-left: 1.1rem;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.command-action-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.command-action-list .btn {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

.command-pick-btn {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.7rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
}

.command-pick-btn:hover,
.command-pick-btn:focus-visible {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  outline: none;
  box-shadow: var(--focus-ring);
}

.app-modal-panel--help {
  width: min(100%, 38rem);
  max-height: min(92vh, 46rem);
}

.page-help-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 0 0 1.15rem;
}

.page-help-section h3 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.page-help-section p,
.page-help-section li {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text);
}

.page-help-section ul {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
}

.page-help-section li + li {
  margin-top: 0.3rem;
}

.support-photo-list {
  list-style: none;
  margin: 0.65rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.support-photo-item {
  display: grid;
  grid-template-columns: 3.25rem 1fr auto;
  gap: 0.65rem;
  align-items: start;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.support-photo-thumb {
  width: 3.25rem;
  height: 3.25rem;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

.support-photo-item .field {
  margin: 0;
}

.support-photo-item input[type='text'] {
  width: 100%;
}

.support-photo-remove {
  margin-top: 1.35rem;
}

.support-issue-thanks .success-box {
  margin-top: 0;
}

.support-issue-thanks .hint {
  margin: 0.7rem 0 0;
}

.about-meta {
  margin: 0 0 1.2rem;
  display: grid;
  gap: 0.7rem 1rem;
}

.about-meta > div {
  display: grid;
  grid-template-columns: 7.25rem 1fr;
  gap: 0.35rem 0.85rem;
  align-items: baseline;
}

.about-meta dt {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.about-meta dd {
  margin: 0;
  color: var(--text);
  font-weight: 500;
  word-break: break-word;
}

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

.release-note {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.release-note-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  padding: 0.95rem 1.15rem;
  font-weight: 500;
}

.release-note-summary::-webkit-details-marker {
  display: none;
}

.release-note-summary::after {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  margin-left: auto;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  flex: 0 0 auto;
}

.release-note[open] .release-note-summary::after {
  transform: rotate(225deg);
  margin-top: 0.35rem;
}

.release-note-summary:hover {
  background: var(--bg-hover);
}

.release-note-summary:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.release-note-version {
  color: var(--text);
}

.release-note-date {
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 400;
}

.release-note-body {
  margin: 0;
  padding: 0 1.15rem 1rem 2rem;
  color: var(--text);
}

.release-note-body li + li {
  margin-top: 0.35rem;
}

/* Full-size product image modal */

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.image-modal[hidden] {
  display: none !important;
}

.image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 14, 13, 0.72);
  cursor: zoom-out;
}

.image-modal-panel {
  position: relative;
  z-index: 1;
  max-width: min(92vw, 720px);
  max-height: min(90vh, 900px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1rem 0.85rem;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
}

.image-modal-panel img {
  display: block;
  max-width: min(88vw, 680px);
  max-height: min(78vh, 800px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
}

.image-modal-caption {
  margin: 0;
  max-width: min(88vw, 680px);
  text-align: center;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
}

.image-modal-close {
  position: absolute;
  top: 0.35rem;
  right: 0.45rem;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 999px;
  background: rgba(28, 25, 23, 0.75);
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.image-modal-close:hover,
.image-modal-close:focus-visible {
  background: rgba(28, 25, 23, 0.92);
  outline: none;
  box-shadow: 0 0 0 3px rgba(194, 183, 172, 0.55);
}

.detail-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.detail-card dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.45rem 1rem;
}

.detail-card dt {
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}

.product-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.product-tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(194, 183, 172, 0.35);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.8rem;
  line-height: 1.3;
  max-width: 100%;
  word-break: break-word;
}

.detail-card dd {
  margin: 0;
  font-weight: 500;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.detail-actions a.btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.detail-admin-note {
  margin: 0;
  font-size: 0.85rem;
}

.cfg-meta-list {
  margin: 0.75rem 0 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.4rem 1.25rem;
  font-size: 0.9rem;
}

.cfg-meta-list dt {
  color: var(--text-muted);
  font-weight: 500;
}

.cfg-meta-list dd {
  margin: 0;
  font-weight: 600;
}

/* Count workflow */
.count-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 900px) {
  .count-layout.two-col {
    grid-template-columns: 1fr 320px;
  }
}

.scan-panel {
  min-width: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  box-shadow: var(--shadow);
}

.scan-input {
  width: 100%;
  font-size: 1.2rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: #fff;
  font-family: var(--mono);
}

.scan-input:focus {
  border-color: var(--taupe-deep);
  outline: none;
  box-shadow: 0 0 0 3px rgba(194, 183, 172, 0.5);
}

.count-find-row label {
  display: block;
  margin-bottom: 0.35rem;
}

.count-find-input {
  width: 100%;
  font-size: 0.95rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
}

.count-find-row {
  margin-top: 1rem;
}

.count-find-input:focus {
  border-color: var(--taupe-deep);
  outline: none;
  box-shadow: var(--focus-ring);
}

.feedback-tone {
  margin-top: 0.75rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius);
  font-weight: 500;
  min-height: 2.5rem;
}

.feedback-tone.count-feedback-clickable {
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.feedback-tone.count-feedback-clickable:hover {
  filter: brightness(0.97);
}

/* Count items — single stable table */
.count-find-hint {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
}

.count-summary-heading {
  margin-top: 1rem;
}

.count-items-panel {
  min-width: 0;
  margin-top: 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
}

.count-items-meta {
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  font-size: 0.85rem;
}

.count-items-table {
  max-height: none;
  overflow-x: hidden;
  overflow-y: visible;
  margin: 0;
  border: none;
  border-radius: 0;
}

.count-items-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.55rem 0.9rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
  font-size: 0.85rem;
}

.count-items-pager[hidden] {
  display: none !important;
}

.count-qty-input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  font-family: var(--mono);
  font-size: 0.9rem;
  padding: 0.28rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.count-qty-input:focus {
  border-color: var(--taupe-deep);
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Count line status colours */
#screen-count tr.count-row-match {
  background: var(--success-bg);
}

#screen-count tr.count-row-over {
  background: var(--danger-bg);
}

#screen-count tr.count-row-under {
  background: var(--warning-bg);
}

#screen-count tr.count-row-focus {
  outline: 2px solid var(--taupe-deep);
  outline-offset: -2px;
  box-shadow: inset 0 0 0 1px var(--border);
}

#screen-count tr.count-row-focus.count-row-match {
  background: var(--success-bg);
}

#screen-count tr.count-row-focus.count-row-over {
  background: var(--danger-bg);
}

#screen-count tr.count-row-focus.count-row-under {
  background: var(--warning-bg);
}

#screen-count tr:focus {
  outline: 2px solid var(--taupe-deep);
  outline-offset: -2px;
}

#screen-count tr.count-empty-row td {
  text-align: center;
  font-style: italic;
}

.feedback-tone.warn {
  background: var(--warning-bg);
  color: var(--warning);
}

.feedback-tone.ok {
  background: var(--success-bg);
  color: var(--success);
}
.feedback-tone.err {
  background: var(--danger-bg);
  color: var(--danger);
}
.feedback-tone.info {
  background: var(--info-bg);
  color: var(--accent);
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  /* Fit 10 action rows without scrolling */
  max-height: none;
  overflow: visible;
  min-height: calc(10 * 2.4rem);
}

.history-list li {
  box-sizing: border-box;
  min-height: 2.4rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.15rem 0.25rem;
}

.history-sku-link {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 600;
  font-family: var(--mono);
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.history-sku-link:hover {
  color: var(--accent-hover);
}

.history-list li strong {
  color: var(--text);
}

.progress-bar-track {
  height: 10px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin: 0.5rem 0;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--taupe-deep), var(--taupe));
  width: 0%;
  transition: width 0.2s ease;
}

.section-block {
  margin-bottom: 0.85rem;
}

.section-block h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 500;
}

.section-block.pos h3 {
  color: var(--success);
}
.section-block.neg h3 {
  color: var(--danger);
}
.section-block.none h3 {
  color: var(--text-muted);
}

/* Discrepancy review — editable counted qty */
#screen-discrepancy .disc-qty-input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--border-strong, var(--border));
  border-radius: var(--radius);
  font: inherit;
  font-variant-numeric: tabular-nums;
  background: var(--bg-card);
  color: var(--text);
}

#screen-discrepancy .disc-qty-input:focus {
  outline: 2px solid var(--taupe, var(--border-strong));
  outline-offset: 1px;
  border-color: var(--taupe-deep, var(--border-strong));
}

#screen-discrepancy td.disc-qty-col {
  overflow: hidden;
  max-width: none;
}

#screen-discrepancy .disc-kind-col {
  white-space: nowrap;
}

#screen-discrepancy .disc-actions-col {
  width: 5.75rem;
  text-align: right;
  white-space: normal;
  overflow: hidden;
}

/* Adjust Inventory — editable cost and quantity */
#screen-adjust-edit .adjust-cost-input,
#screen-adjust-edit .adjust-qty-input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--border-strong, var(--border));
  border-radius: var(--radius);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  background: var(--bg-card);
  color: var(--text);
}

#screen-adjust-edit .adjust-cost-input:focus,
#screen-adjust-edit .adjust-qty-input:focus {
  outline: 2px solid var(--taupe, var(--border-strong));
  outline-offset: 1px;
  border-color: var(--taupe-deep, var(--border-strong));
}

#screen-adjust-edit .adjust-cost-input {
  width: 100%;
}

#transfer-table tbody tr.transfer-row-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Transfer Inventory — editable transfer quantity */
#screen-transfer-edit .transfer-qty-input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--border-strong, var(--border));
  border-radius: var(--radius);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  background: var(--bg-card);
  color: var(--text);
}

#screen-transfer-edit .transfer-qty-input:focus {
  outline: 2px solid var(--taupe, var(--border-strong));
  outline-offset: 1px;
  border-color: var(--taupe-deep, var(--border-strong));
}

/* Compact tag chicklets — small but readable in the dense review table */
#screen-discrepancy td.disc-tags-col {
  min-width: 0;
  max-width: none;
  white-space: normal;
  overflow: hidden;
  text-overflow: unset;
  vertical-align: middle;
}

#screen-discrepancy td.disc-tags-col .product-tags {
  gap: 0.2rem;
}

#screen-discrepancy td.disc-tags-col .product-tag {
  padding: 0.08rem 0.38rem;
  font-size: 0.7rem;
  line-height: 1.25;
  font-weight: 500;
  max-width: 8.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Vendor Return */
.vendor-return-setup-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.vendor-return-setup-field .vendor-return-supplier-select {
  width: 100%;
  max-width: none;
}

.vendor-return-supplier-select {
  width: 100%;
  max-width: 28rem;
  margin-top: 0.35rem;
}

#vendor-return-table thead th {
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-soft);
}

.vendor-return-qty-col {
  width: 7rem;
}

.vendor-return-actions-col {
  width: 6.5rem;
  text-align: right;
}

#vendor-return-table thead th.vendor-return-actions-col {
  text-align: right;
}

#vendor-return-table td.vendor-return-qty-col {
  overflow: hidden;
}

.vendor-return-qty-input {
  width: 5rem;
  min-width: 4rem;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--border-strong, var(--border));
  border-radius: var(--radius);
  font: inherit;
  font-variant-numeric: tabular-nums;
  background: var(--bg-card);
  color: var(--text);
}

.vendor-return-qty-input:focus {
  outline: 2px solid var(--taupe, var(--border-strong));
  outline-offset: 1px;
  border-color: var(--taupe-deep, var(--border-strong));
}

#vendor-return-table tbody tr.vendor-return-line-flash {
  background: var(--accent-soft, var(--bg-hover));
  transition: background 0.35s ease;
}

.vendor-return-typeahead,
.receive-typeahead {
  position: relative;
  width: 100%;
}

.vendor-return-suggestions,
.receive-suggestions {
  position: absolute;
  z-index: 40;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  max-height: 14rem;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.vendor-return-suggestions[hidden],
.receive-suggestions[hidden] {
  display: none;
}

.vendor-return-suggestion,
.receive-suggestion {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.15rem 0.75rem;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  color: var(--text);
}

.vendor-return-suggestion:hover,
.vendor-return-suggestion.is-active,
.receive-suggestion:hover,
.receive-suggestion.is-active {
  background: var(--bg-hover);
}

.vendor-return-suggestion-empty,
.receive-suggestion-empty {
  cursor: default;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.vendor-return-suggestion-empty:hover,
.receive-suggestion-empty:hover {
  background: transparent;
}

.vendor-return-match-name,
.receive-match-name {
  font-weight: 500;
}

.vendor-return-match-meta,
.receive-match-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--mono);
}

/* Print discrepancy review: table only, no chrome/actions */
@media print {
  body {
    background: #fff;
    color: #000;
  }

  .announce-bar,
  .outage-banner,
  .trial-banner,
  .warning-banner,
  .review-prompt,
  .app-build-footer,
  .no-print,
  #toast-root,
  #image-modal,
  .error-box:not(.visible) {
    display: none !important;
  }

  .app-shell {
    margin: 0;
    padding: 0;
    max-width: none;
  }

  .screen {
    display: none !important;
    animation: none !important;
  }

  .screen.active {
    display: block !important;
  }

  #screen-discrepancy .header-actions {
    display: none !important;
  }

  #screen-discrepancy .screen-header {
    display: block;
    border-bottom: 1px solid #ccc;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
  }

  #screen-discrepancy .screen-header h1 {
    font-size: 1.25rem;
    margin: 0 0 0.25rem;
  }

  #screen-discrepancy .screen-header p {
    margin: 0;
    color: #333;
  }

  #screen-discrepancy .table-wrap {
    overflow: visible;
    box-shadow: none;
    border: 1px solid #ccc;
  }

  #discrepancy-table {
    width: 100%;
    font-size: 0.8rem;
  }

  #discrepancy-table th,
  #discrepancy-table td {
    padding: 0.25rem 0.35rem;
    border-bottom: 1px solid #ddd;
  }

  /* Print the counted value, not the number input control */
  #screen-discrepancy .disc-qty-input {
    border: none;
    background: transparent;
    padding: 0;
    width: auto;
    min-width: 0;
    -moz-appearance: textfield;
    appearance: textfield;
  }

  #screen-discrepancy .disc-qty-input::-webkit-outer-spin-button,
  #screen-discrepancy .disc-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }

  #screen-discrepancy td.disc-tags-col .product-tag {
    border-color: #bbb;
    background: #f0f0f0;
    color: #000;
    max-width: none;
    white-space: normal;
  }
}

/* Purchase Inventory — drag & drop upload */
.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 220px;
  padding: 2rem 1.5rem;
  background: var(--bg-card);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  outline: none;
  margin-bottom: 1.25rem;
}

.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--taupe-deep);
  background: #fff;
  box-shadow: var(--shadow-hover);
}

.dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone.has-file {
  min-height: 140px;
  border-style: solid;
  border-color: var(--border);
}

.dropzone-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.dropzone-icon {
  font-size: 2.5rem;
  line-height: 1;
  margin-bottom: 0.35rem;
}

.dropzone-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 500;
  text-align: center;
}

.dropzone-hint,
.dropzone-formats {
  margin: 0;
  text-align: center;
  font-size: 0.9rem;
}

.link-btn {
  display: inline;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
}

.link-btn:hover {
  color: var(--accent-hover);
}

.purchase-entry-mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.85rem;
  margin-top: 0.75rem;
}

.purchase-entry-mode-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  text-align: left;
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s, transform 0.18s;
  font: inherit;
  color: inherit;
}

.purchase-entry-mode-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--taupe);
  opacity: 0;
  transition: opacity 0.18s, background 0.18s;
}

.purchase-entry-mode-card:hover,
.purchase-entry-mode-card:focus-visible {
  border-color: var(--taupe);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  outline: none;
}

.purchase-entry-mode-card:hover::before,
.purchase-entry-mode-card:focus-visible::before {
  opacity: 1;
}

.purchase-entry-mode-card.is-active {
  border-color: var(--taupe-deep);
  background: var(--bg-hover);
  box-shadow: var(--shadow);
}

.purchase-entry-mode-card.is-active::before {
  opacity: 1;
  background: var(--taupe-deep);
}

.purchase-entry-mode-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.purchase-entry-mode-title {
  font-weight: 600;
  font-size: 1.02rem;
}

.purchase-entry-mode-desc {
  font-size: 0.9rem;
  line-height: 1.35;
}

.purchase-scan-row {
  max-width: 28rem;
  margin-bottom: 1rem;
}

.purchase-scan-row .scan-input {
  width: 100%;
  margin-top: 0.35rem;
}

#purchase-scan-feedback {
  margin-top: 0.5rem;
}

/* Compact tables across Purchase + Receive Inventory — fit without horizontal scroll */
[data-screen^="purchase"] .table-wrap,
[data-screen^="receive"] .table-wrap {
  overflow: visible;
  max-width: 100%;
}

[data-screen^="purchase"] table.data-table,
[data-screen^="receive"] table.data-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: 0.78rem;
}

[data-screen^="purchase"] table.data-table th,
[data-screen^="purchase"] table.data-table td,
[data-screen^="receive"] table.data-table th,
[data-screen^="receive"] table.data-table td {
  padding: 0.32rem 0.4rem;
  white-space: normal;
  overflow: hidden;
  vertical-align: top;
  word-break: break-word;
  overflow-wrap: anywhere;
}

[data-screen^="purchase"] table.data-table th,
[data-screen^="receive"] table.data-table th {
  font-size: 0.64rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-screen^="purchase"] table.data-table td.mono,
[data-screen^="receive"] table.data-table td.mono {
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-screen^="purchase"] table.data-table th.checkbox-cell,
[data-screen^="purchase"] table.data-table td.checkbox-cell,
[data-screen^="receive"] table.data-table th.checkbox-cell,
[data-screen^="receive"] table.data-table td.checkbox-cell {
  width: 2.4rem;
  max-width: 2.4rem;
  text-align: center;
  white-space: nowrap;
  overflow: visible;
  vertical-align: middle;
}

[data-screen^="purchase"] table.data-table .status-badge,
[data-screen^="receive"] table.data-table .status-badge {
  display: inline-block;
  padding: 0.06rem 0.28rem;
  font-size: 0.58rem;
  letter-spacing: 0.02em;
  line-height: 1.2;
  white-space: normal;
  text-align: center;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  vertical-align: middle;
  overflow-wrap: break-word;
}

[data-screen^="purchase"] table.data-table .status-badge-group,
[data-screen^="receive"] table.data-table .status-badge-group {
  gap: 0.15rem;
  max-width: 100%;
}

[data-screen^="purchase"] table.data-table .product-tag,
[data-screen^="receive"] table.data-table .product-tag {
  padding: 0.04rem 0.28rem;
  font-size: 0.62rem;
  line-height: 1.2;
}

[data-screen^="purchase"] table.data-table input[type="number"],
[data-screen^="receive"] table.data-table input[type="number"] {
  width: 100%;
  max-width: none;
  min-width: 0;
  padding: 0.2rem 0.28rem;
  font-size: 0.75rem;
  -moz-appearance: textfield;
  appearance: textfield;
}

[data-screen^="purchase"] table.data-table input[type="number"]::-webkit-outer-spin-button,
[data-screen^="purchase"] table.data-table input[type="number"]::-webkit-inner-spin-button,
[data-screen^="receive"] table.data-table input[type="number"]::-webkit-outer-spin-button,
[data-screen^="receive"] table.data-table input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

@media (max-width: 900px) {
  [data-screen^="purchase"] table.data-table,
  [data-screen^="receive"] table.data-table {
    font-size: 0.72rem;
  }

  [data-screen^="purchase"] table.data-table th,
  [data-screen^="purchase"] table.data-table td,
  [data-screen^="receive"] table.data-table th,
  [data-screen^="receive"] table.data-table td {
    padding: 0.25rem 0.28rem;
  }

  [data-screen^="purchase"] table.data-table th,
  [data-screen^="receive"] table.data-table th {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }

  [data-screen^="purchase"] table.data-table .status-badge,
  [data-screen^="receive"] table.data-table .status-badge {
    padding: 0.04rem 0.22rem;
    font-size: 0.54rem;
  }
}

#purchase-scan-table col.purchase-scan-col-check {
  width: 4%;
}

#purchase-scan-table col.purchase-scan-col-isbn {
  width: 12%;
}

#purchase-scan-table col.purchase-scan-col-title {
  width: 22%;
}

#purchase-scan-table col.purchase-scan-col-author {
  width: 13%;
}

#purchase-scan-table col.purchase-scan-col-distributor {
  width: 15%;
}

#purchase-scan-table col.purchase-scan-col-catalog {
  width: 12%;
}

#purchase-scan-table col.purchase-scan-col-qty {
  width: 10%;
}

#purchase-scan-table col.purchase-scan-col-actions {
  width: 12%;
}

#purchase-scan-table tbody tr[data-purchase-scan-selectable='1'] {
  cursor: pointer;
}

#purchase-scan-table tbody tr.purchase-scan-row-disabled {
  opacity: 0.55;
}

#purchase-scan-table th.purchase-scan-qty-col,
#purchase-scan-table td.purchase-scan-qty-col,
#purchase-scan-table th.purchase-scan-catalog-col,
#purchase-scan-table th.purchase-scan-actions-col,
#purchase-scan-table td.purchase-scan-actions-col {
  text-align: center;
  white-space: nowrap;
}

#purchase-scan-table td.purchase-scan-catalog-col {
  text-align: center;
  white-space: normal;
}

#purchase-scan-table td.purchase-scan-qty-col,
#purchase-scan-table td.purchase-scan-actions-col {
  overflow: visible;
}

#purchase-scan-table td.purchase-scan-actions-col .btn {
  padding: 0.2rem 0.45rem;
  font-size: 0.72rem;
}

#purchase-scan-table td.purchase-scan-catalog-col .status-badge {
  max-width: 100%;
}

.purchase-scan-qty-input {
  text-align: center;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}

.purchase-scan-qty-input:focus {
  outline: none;
  border-color: var(--taupe-deep);
  box-shadow: var(--focus-ring);
}

#purchase-scan-table tbody tr.purchase-scan-row-flash {
  animation: purchase-scan-flash 0.7s ease;
}

@keyframes purchase-scan-flash {
  0% {
    background: rgba(194, 183, 172, 0.45);
  }
  100% {
    background: transparent;
  }
}

.purchase-file-card {
  margin-bottom: 1.25rem;
}

.purchase-file-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.purchase-file-name {
  font-weight: 500;
  font-size: 1.05rem;
  word-break: break-word;
}

.purchase-file-status {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

#purchase-supplier-panel {
  margin-bottom: 1.25rem;
}

.purchase-setup-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.purchase-setup-field {
  max-width: 28rem;
}

.purchase-setup-select {
  width: 100%;
  max-width: none;
  margin-top: 0.35rem;
}

#purchase-location-wrap[hidden] {
  display: none;
}

#purchase-supplier-panel .required-mark {
  color: var(--danger, #b42318);
  font-weight: 600;
}

.purchase-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0 0 0.75rem;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

#purchase-preview-panel .table-wrap {
  max-height: 420px;
  overflow-x: hidden;
  overflow-y: auto;
}

#purchase-preview-table tbody tr[data-purchase-key][data-purchase-selectable='1'] {
  cursor: pointer;
}

#purchase-preview-table tbody tr.purchase-row-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#purchase-preview-table th.purchase-col-supplier,
#purchase-preview-table td.purchase-col-supplier {
  font-weight: 500;
}

.purchase-order-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 1rem;
}

.purchase-order-summary-value {
  font-weight: 500;
  font-size: 1.05rem;
  margin-top: 0.15rem;
  word-break: break-word;
}

#purchase-order-table th.purchase-order-col-status,
#purchase-order-table td.purchase-order-col-status {
  width: 8.25rem;
  white-space: normal;
  overflow: hidden;
}

#purchase-order-table tbody tr.purchase-order-row-missing {
  background: var(--danger-bg);
}

#purchase-order-table tbody tr.purchase-order-row-found {
  background: var(--success-bg);
}

.purchase-order-confirm-dl {
  display: grid;
  gap: 0.65rem 1.25rem;
  margin: 0.5rem 0 0;
}

.purchase-order-confirm-row {
  display: grid;
  grid-template-columns: minmax(9rem, 14rem) 1fr;
  gap: 0.35rem 1rem;
  align-items: start;
}

.purchase-order-confirm-dl dt {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.purchase-order-confirm-dl dd {
  margin: 0;
  font-weight: 500;
  word-break: break-word;
}

.purchase-order-confirm-note-field {
  margin-top: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-width: 40rem;
}

.purchase-order-confirm-note-field label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.purchase-order-confirm-note {
  width: 100%;
  min-height: 5.5rem;
  resize: vertical;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  font: inherit;
  line-height: 1.4;
  color: var(--text);
}

.purchase-order-confirm-note:focus {
  outline: none;
  border-color: var(--taupe-deep);
  box-shadow: 0 0 0 3px rgba(194, 183, 172, 0.4);
}

.purchase-order-confirm-note:disabled,
.purchase-order-confirm-note[readonly] {
  background: var(--bg-muted);
  color: var(--text-soft);
  cursor: default;
}

.purchase-order-confirm-note-hint {
  margin: 0;
  font-size: 0.82rem;
}

#purchase-order-confirm-table col.purchase-confirm-col-idx {
  width: 5%;
}

#purchase-order-confirm-table col.purchase-confirm-col-isbn {
  width: 14%;
}

#purchase-order-confirm-table col.purchase-confirm-col-title {
  width: 36%;
}

#purchase-order-confirm-table col.purchase-confirm-col-onhand,
#purchase-order-confirm-table col.purchase-confirm-col-incoming {
  width: 9%;
}

#purchase-order-confirm-table col.purchase-confirm-col-qty {
  width: 13%;
}

#purchase-order-confirm-table col.purchase-confirm-col-cost {
  width: 14%;
}

#purchase-order-confirm-table td.purchase-order-confirm-qty-col,
#purchase-order-confirm-table td.purchase-order-confirm-cost-col {
  overflow: visible;
  white-space: nowrap;
}

.purchase-order-confirm-cost-input {
  font-family: var(--mono);
}

.purchase-order-confirm-qty-input:disabled,
.purchase-order-confirm-cost-input:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  background: var(--bg-muted);
}

.purchase-order-export-steps {
  margin: 0.35rem 0 1rem 1.15rem;
  padding: 0;
  color: var(--text);
  line-height: 1.5;
}

.purchase-order-export-steps li {
  margin: 0.35rem 0;
}

.purchase-order-export-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.purchase-order-export-buttons a.btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.purchase-order-export-buttons a.btn.btn-disabled,
.purchase-order-export-buttons a.btn[aria-disabled='true'] {
  opacity: 0.55;
  pointer-events: none;
  cursor: not-allowed;
}

.purchase-order-export-note {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  max-width: 40rem;
}

.purchase-order-export-fields-heading {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
}

.purchase-order-export-field {
  margin-top: 0.9rem;
}

.purchase-order-export-field:first-of-type {
  margin-top: 0.75rem;
}

.purchase-order-export-note h4,
.purchase-order-export-field h4 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.purchase-order-export-note-text {
  margin: 0.35rem 0 0;
  padding: 0.65rem 0.75rem;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
  line-height: 1.4;
  color: var(--text);
}

.purchase-order-export-note-text.is-empty {
  color: var(--text-muted);
}

#purchase-create-products-table col.purchase-create-col-isbn {
  width: 12%;
}

#purchase-create-products-table col.purchase-create-col-title {
  width: 18%;
}

#purchase-create-products-table col.purchase-create-col-author {
  width: 11%;
}

#purchase-create-products-table col.purchase-create-col-price {
  width: 7%;
}

#purchase-create-products-table col.purchase-create-col-cost {
  width: 8%;
}

#purchase-create-products-table col.purchase-create-col-tags {
  width: 19%;
}

#purchase-create-products-table col.purchase-create-col-status {
  width: 9%;
}

#purchase-create-products-table col.purchase-create-col-msg {
  width: 16%;
}

@media (max-width: 900px) {
  #purchase-create-products-table col.purchase-create-col-isbn {
    width: 17%;
  }

  #purchase-create-products-table col.purchase-create-col-title {
    width: 14%;
  }

  #purchase-create-products-table col.purchase-create-col-author {
    width: 10%;
  }

  #purchase-create-products-table col.purchase-create-col-price {
    width: 8%;
  }

  #purchase-create-products-table col.purchase-create-col-cost {
    width: 10%;
  }

  #purchase-create-products-table col.purchase-create-col-tags {
    width: 16%;
  }

  #purchase-create-products-table col.purchase-create-col-status {
    width: 9%;
  }

  #purchase-create-products-table col.purchase-create-col-msg {
    width: 16%;
  }
}

#purchase-create-products-table td.purchase-create-isbn-col,
#purchase-create-products-table td.purchase-create-price-col {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#purchase-create-products-table td.purchase-create-status-col {
  white-space: normal;
  overflow: hidden;
  text-align: center;
}

#purchase-create-products-table td.purchase-create-cost-col {
  overflow: visible;
  white-space: nowrap;
}

.purchase-create-cost-input:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  background: var(--bg-muted);
}

#purchase-create-products-table td.purchase-create-tags-col {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}

/* Message column: wrap long API text inside the column */
#purchase-create-products-table td.post-msg,
#purchase-create-products-table td.purchase-create-msg-col {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  overflow: hidden;
  text-overflow: unset;
}

.purchase-create-tags-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.28rem;
  min-width: 0;
  width: 100%;
}

.purchase-create-tag-chips {
  min-height: 0;
  gap: 0.2rem;
}

.purchase-create-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.12rem;
  padding: 0.04rem 0.22rem 0.04rem 0.28rem;
  font-size: 0.62rem;
}

.purchase-create-tag-label {
  max-width: 6.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purchase-create-tag-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.95rem;
  height: 0.95rem;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
}

.purchase-create-tag-remove:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.08);
  color: var(--danger, #8e1f0b);
}

.purchase-create-tag-remove:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.purchase-create-tag-typeahead {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

#purchase-create-products-table .purchase-create-tag-add {
  width: 100%;
  max-width: none;
  min-width: 0;
  padding: 0.22rem 0.4rem;
  font-size: 0.75rem;
  cursor: text;
}

.purchase-create-tag-suggestions {
  position: absolute;
  z-index: 40;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  max-height: 12rem;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow, 0 4px 14px rgba(0, 0, 0, 0.12));
}

.purchase-create-tag-suggestion {
  padding: 0.28rem 0.5rem;
  cursor: pointer;
  color: var(--text);
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.purchase-create-tag-suggestion:hover,
.purchase-create-tag-suggestion.is-active {
  background: rgba(194, 183, 172, 0.35);
}

.purchase-create-tag-suggestion.is-new {
  font-style: italic;
  color: var(--text-muted, #5c564f);
}

.purchase-create-tag-suggestion.is-new::before {
  content: '+ ';
  font-style: normal;
  font-weight: 600;
  color: var(--accent);
}

.purchase-create-tag-suggestion-empty {
  cursor: default;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.purchase-create-tag-suggestion-empty:hover {
  background: transparent;
}

.purchase-create-tags-empty,
.purchase-create-tag-add-hint {
  font-size: 0.72rem;
}

.purchase-create-catalist-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  white-space: nowrap;
  max-width: 100%;
  padding: 0.2rem 0.45rem;
  font-size: 0.72rem;
}

.assign-supplier-catalist-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  min-width: 0;
  max-width: 100%;
}

.assign-supplier-catalist-value {
  line-height: 1.3;
}

.assign-supplier-catalist-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  white-space: nowrap;
}

/* Find a Book (BiblioShare) — search + full-page detail */
.find-book-form {
  margin-bottom: 1rem;
}

.find-book-search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.find-book-query-input {
  flex: 1 1 18rem;
  min-width: 14rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: #fff;
  font-size: 1.05rem;
}

.find-book-query-input:focus {
  outline: none;
  border-color: var(--taupe-deep);
  box-shadow: var(--focus-ring);
}

.find-book-advanced {
  margin-top: 0.85rem;
  color: var(--text-muted);
}

.find-book-advanced summary {
  cursor: pointer;
  user-select: none;
  font-size: 0.95rem;
}

.find-book-advanced-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.75rem 1rem;
  margin-top: 0.75rem;
}

.find-book-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.65rem;
  min-height: 1.4rem;
}

.find-book-table-wrap {
  width: 100%;
}

#find-book-results-table th.col-cover,
#find-book-results-table td.col-cover {
  width: 4.25rem;
  text-align: center;
}

#find-book-results-table th.col-source,
#find-book-results-table td.find-book-source-cell {
  width: 7.5rem;
  white-space: nowrap;
}

.find-book-source-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.2;
  border: 1px solid transparent;
  white-space: nowrap;
}

.find-book-source-badge--biblioshare {
  background: var(--info-bg);
  color: var(--info);
  border-color: rgba(21, 50, 203, 0.22);
}

.find-book-source-badge--openlibrary {
  background: var(--bg-elevated);
  color: var(--taupe-ink);
  border-color: var(--border-strong);
}

#find-book-results-table th.col-actions,
#find-book-results-table td.col-actions {
  width: 6.5rem;
  text-align: right;
  white-space: nowrap;
}

#find-book-results-table tbody tr.find-book-row {
  cursor: pointer;
}

#find-book-results-table tbody tr.find-book-row:hover,
#find-book-results-table tbody tr.find-book-row:focus-within {
  background: var(--bg-hover);
}

.find-book-table-cover {
  width: 2.75rem;
  height: 3.75rem;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  vertical-align: middle;
  display: block;
  margin: 0 auto;
}

.find-book-table-cover-ph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 3.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.65rem;
  line-height: 1.15;
  text-align: center;
  padding: 0.15rem;
}

.find-book-title-cell {
  font-weight: 500;
  color: var(--text);
  max-width: 22rem;
}

.find-book-title-cell .find-book-subtitle {
  display: block;
  margin-top: 0.15rem;
  font-weight: 400;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.find-book-isbn-cell {
  font-family: var(--mono);
  font-size: 0.88rem;
  white-space: nowrap;
}

/* Full-page book detail (uses full content width) */
.find-book-detail-page {
  width: 100%;
  max-width: none;
  margin: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.75rem 1.75rem;
  box-sizing: border-box;
}

.find-book-detail-layout {
  display: grid;
  grid-template-columns: minmax(10rem, 14rem) minmax(0, 1fr);
  gap: 1.75rem 2.25rem;
  align-items: start;
  width: 100%;
}

.find-book-detail-cover-col {
  position: sticky;
  top: 0.75rem;
}

.find-book-detail-cover-btn {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: zoom-in;
  border-radius: var(--radius);
  line-height: 0;
}

.find-book-detail-cover-img {
  display: block;
  width: 100%;
  max-width: 14rem;
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}

.find-book-detail-cover-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 14rem;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  border: 1px dashed var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 1rem;
}

.find-book-detail-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.find-book-detail-title-block h2 {
  margin: 0 0 0.35rem;
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--text);
}

.find-book-detail-title-block .find-book-detail-subtitle {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  color: var(--text-muted);
  font-weight: 400;
}

.find-book-detail-title-block .find-book-detail-byline {
  margin: 0;
  font-size: 1rem;
  color: var(--text-soft);
}

.find-book-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

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

.find-book-detail-section h3 {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.find-book-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.85rem 1.5rem;
  margin: 0;
}

.find-book-detail-grid > div {
  min-width: 0;
}

.find-book-detail-grid dt {
  margin: 0 0 0.2rem;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.find-book-detail-grid dd {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  word-break: break-word;
}

.find-book-detail-grid dd.mono {
  font-family: var(--mono);
  font-size: 0.92rem;
  font-weight: 500;
}

.find-book-contrib-list,
.find-book-subject-list {
  margin: 0;
  padding-left: 1.15rem;
}

.find-book-contrib-list li,
.find-book-subject-list li {
  margin: 0.15rem 0;
}

.find-book-subject-list {
  color: var(--text-soft, var(--text));
  line-height: 1.45;
}

.find-book-description {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: 0.98rem;
  color: var(--text-soft);
  max-width: 72ch;
}

/* Keywords as chiclets (pill chips) */
.find-book-keywords {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.find-book-keyword-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated, rgba(194, 183, 172, 0.18));
  color: var(--text-soft, var(--text));
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 720px) {
  .find-book-detail-layout {
    grid-template-columns: 1fr;
  }
  .find-book-detail-cover-col {
    position: static;
    max-width: 12rem;
  }
  .find-book-detail-page {
    padding: 1.1rem 1rem 1.25rem;
  }
}

/* Receive Inventory ------------------------------------------------------- */

.receive-filter-panel,
.receive-list-panel,
.receive-meta-panel,
.receive-tally-panel,
.receive-lines-panel {
  margin-bottom: 1.15rem;
}

.receive-setup-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.receive-setup-field .receive-location-select {
  width: 100%;
  max-width: none;
}

.receive-location-select {
  width: 100%;
  max-width: 28rem;
  margin-top: 0.35rem;
}

.receive-scan-row {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.receive-scan-row .scan-input {
  width: 100%;
}

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

.receive-list-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.65rem;
}

.receive-list-header h3 {
  margin: 0;
  font-weight: 500;
  font-size: 1.05rem;
}

#receive-filter-feedback,
#receive-tally-feedback {
  margin-top: 0.75rem;
}

#receive-product-chip {
  margin-top: 0.55rem;
  padding: 0.45rem 0.65rem;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

#receive-transfers-table col.receive-col-created {
  width: 10%;
}

#receive-transfers-table col.receive-col-transfer {
  width: 14%;
}

#receive-transfers-table col.receive-col-po {
  width: 12%;
}

#receive-transfers-table col.receive-col-origin,
#receive-transfers-table col.receive-col-dest {
  width: 10%;
}

#receive-transfers-table col.receive-col-status {
  width: 12%;
}

#receive-transfers-table col.receive-col-remaining {
  width: 9%;
}

#receive-transfers-table col.receive-col-matched {
  width: 12%;
}

#receive-transfers-table col.receive-col-actions {
  width: 11%;
}

#receive-lines-table col.receive-line-col-product {
  width: 34%;
}

#receive-lines-table col.receive-line-col-sku {
  width: 20%;
}

#receive-lines-table col.receive-line-col-expected {
  width: 9%;
}

#receive-lines-table col.receive-line-col-received {
  width: 14%;
}

#receive-lines-table col.receive-line-col-remaining {
  width: 10%;
}

#receive-lines-table col.receive-line-col-tally {
  width: 13%;
}

.receive-matched-col {
  min-width: 0;
}

.receive-actions-col {
  text-align: right;
  white-space: nowrap;
  overflow: visible;
}

#receive-transfers-table td.receive-actions-col .btn {
  padding: 0.2rem 0.45rem;
  font-size: 0.72rem;
}

#receive-transfers-table tbody tr[data-receive-transfer-id] {
  cursor: pointer;
}

#receive-transfers-table tbody tr[data-receive-transfer-id]:hover {
  background: var(--bg-hover);
}

#receive-transfers-table a.receive-transfer-admin-link,
#receive-transfers-table a.receive-po-admin-link {
  font-weight: 600;
  color: var(--accent, var(--taupe-deep));
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

#receive-transfers-table a.receive-transfer-admin-link:hover,
#receive-transfers-table a.receive-po-admin-link:hover {
  border-bottom-color: currentColor;
  color: var(--text);
}

#receive-transfers-table a.receive-transfer-admin-link:focus-visible,
#receive-transfers-table a.receive-po-admin-link:focus-visible {
  outline: 2px solid var(--accent, var(--taupe-deep));
  outline-offset: 2px;
  border-radius: 2px;
}

#receive-transfers-table a.receive-po-admin-link {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.72rem;
}

#receive-transfers-table .receive-po-col,
#receive-transfers-table .receive-created-col {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#receive-transfers-table .receive-created-col {
  font-variant-numeric: tabular-nums;
  color: var(--text-soft, var(--text));
}

.receive-transfer-ref {
  font-size: 0.72rem;
}

#receive-transfers-table th,
#receive-transfers-table td,
#receive-lines-table th,
#receive-lines-table td {
  vertical-align: middle;
}

#receive-transfers-table td.receive-status-col {
  white-space: normal;
  overflow: hidden;
  text-align: center;
}

.receive-matched-line {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.75rem;
  min-width: 0;
}

.receive-matched-line .receive-matched-title {
  font-weight: 500;
}

.receive-matched-line .receive-matched-meta {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.7rem;
}

.receive-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.85rem 1.25rem;
}

.receive-meta-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.receive-meta-value {
  font-weight: 500;
  color: var(--text);
}

.num-col {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

table.data-table td.num-col {
  font-family: var(--mono);
}

.receive-tally-col {
  font-weight: 600;
  color: var(--taupe-deep);
}

#receive-lines-table tbody tr.receive-line-flash {
  animation: receive-line-flash 0.75s ease;
}

#receive-lines-table tbody tr.receive-line-complete {
  background: var(--success-bg);
}

#receive-lines-table tbody tr.receive-line-over {
  background: var(--warning-bg);
}

#receive-lines-table tbody tr.receive-line-active {
  outline: 2px solid var(--taupe-deep);
  outline-offset: -2px;
}

@keyframes receive-line-flash {
  0% {
    background: rgba(194, 183, 172, 0.45);
  }
  100% {
    background: transparent;
  }
}

.receive-qty-input {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: right;
  background: var(--bg-card);
  color: var(--taupe-deep);
}

#receive-lines-table td.receive-tally-col {
  overflow: visible;
  white-space: nowrap;
}

.receive-qty-input.is-zero {
  font-weight: 500;
  color: var(--text-muted);
}

.receive-qty-input:focus {
  outline: none;
  border-color: var(--taupe-deep);
  box-shadow: 0 0 0 3px rgba(194, 183, 172, 0.4);
  color: var(--text);
}

.receive-complete-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.btn-lg {
  font-size: 1.05rem;
  padding: 0.7rem 1.25rem;
}

@media (max-width: 720px) {
  .receive-complete-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .receive-complete-bar .btn {
    width: 100%;
  }
}

.under-construction {
  text-align: center;
  padding: 3.25rem 1.5rem;
  background: var(--bg-card);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.under-construction .big-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

.under-construction h2 {
  margin: 0 0 0.5rem;
  font-weight: 500;
}

.under-construction p {
  color: var(--text-muted);
  margin: 0;
}

/* Toast */
#toast-root {
  position: fixed;
  bottom: 3.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(360px, calc(100vw - 2rem));
  pointer-events: none;
}

.toast {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--p-color-bg-fill-brand);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow-hover);
  font-size: 0.875rem;
  color: var(--text);
  animation: toastIn 0.2s ease;
  pointer-events: auto;
}

.toast.success {
  border-left-color: var(--success);
}
.toast.error {
  border-left-color: var(--danger);
}
.toast.info {
  border-left-color: var(--accent);
}

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

.checkbox-cell {
  width: 2rem;
}

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

.mono {
  font-family: var(--mono);
  font-size: 0.85em;
}

.empty-state {
  padding: 2.25rem;
  text-align: center;
  color: var(--text-muted);
}

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

/* Soft page accent strip under header (bookstore utility bar nod) */
body::before {
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--taupe) 0%, #e8e0d8 50%, var(--taupe) 100%);
}

@media (max-width: 600px) {
  .detail-card {
    grid-template-columns: 1fr;
  }
  .announce-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .announce-right {
    justify-content: stretch;
  }
  .global-search {
    max-width: none;
  }
  .screen-header {
    grid-template-columns: 1fr;
  }
  .screen-header h1 {
    grid-column: 1;
    grid-row: 1;
    font-size: 1.5rem;
  }
  .screen-header > .header-actions {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
  }
  .screen-header p {
    grid-column: 1;
    grid-row: 3;
  }
  .screen-header p + p {
    grid-row: 4;
  }
}
