:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #697586;
  --line: #d9dee7;
  --accent: #176b87;
  --accent-strong: #0e4d64;
  --danger: #b42318;
  --warning-bg: #fff4db;
  --purchase-mode-bg: #eef8f6;
  --purchase-mode-border: #12806f;
  --stock-receiving-mode-bg: #eef7fb;
  --stock-receiving-mode-border: #176b87;
  --inventory-option-image-size: 48px;
  --inventory-sticky-offset: 72px;
  --inventory-sticky-actions-height: 56px;
  --inventory-product-sticky-offset: calc(var(--inventory-sticky-offset) + var(--inventory-sticky-actions-height));
  --z-inventory-product-header: 17;
  --z-inventory-sticky-actions: 18;
  --z-inventory-column-menu: 19;
  --z-topbar: 20;
  --z-nav-submenu: 30;
  --z-purchase-combobox: 35;
  --z-option-image-viewer: 60;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
}

html.is-purchase-order-mode body {
  background: var(--purchase-mode-bg);
}

html.is-stock-receiving-mode body {
  background: var(--stock-receiving-mode-bg);
}

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

a:hover {
  text-decoration: underline;
}

.topbar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 28px;
  min-height: 64px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  transition: transform 180ms ease;
  z-index: var(--z-topbar);
}

.brand {
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
}

.nav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.nav a,
.nav-settings summary {
  color: #344054;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

.nav a.is-active,
.nav-settings.is-active > summary,
.nav-submenu a.is-active {
  color: var(--accent-strong);
}

.nav-settings {
  position: relative;
}

.nav-settings summary::-webkit-details-marker {
  display: none;
}

.nav-submenu {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  display: grid;
  gap: 2px;
  left: 0;
  min-width: 168px;
  padding: 8px;
  position: absolute;
  top: calc(100% + 10px);
  z-index: var(--z-nav-submenu);
}

.nav-submenu a {
  border-radius: 6px;
  padding: 8px 10px;
  white-space: nowrap;
}

.nav-submenu a:hover {
  background: #f2f4f7;
  text-decoration: none;
}

.nav-form {
  margin: 0;
}

.link-button {
  background: transparent;
  border: 0;
  color: #344054;
  cursor: pointer;
  font-weight: 600;
  min-height: 0;
  padding: 0;
}

.mobile-page-title,
.mobile-menu {
  display: none;
}

.page {
  margin: 0 auto;
  max-width: 1280px;
  padding: 28px;
}

.page-header {
  align-items: end;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 22px;
}

.page-header h1 {
  font-size: 28px;
  line-height: 1.2;
  margin: 0;
}

.page-header p {
  color: var(--muted);
  margin: 6px 0 0;
}

.metrics {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 20px;
}

.metrics.narrow {
  grid-template-columns: repeat(2, minmax(0, 220px));
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.metric span {
  color: var(--muted);
  display: block;
  font-size: 13px;
}

.metric strong {
  display: block;
  font-size: 28px;
  margin-top: 8px;
}

.metric.danger {
  background: var(--warning-bg);
  border-color: #f2cc7a;
}

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

.grid {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

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

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 18px;
  overflow: hidden;
}

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

.panel-header h2 {
  font-size: 18px;
  margin: 0;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 16px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f9fafb;
  color: #344054;
  font-size: 13px;
}

td small,
.line-item {
  color: var(--muted);
  display: block;
  margin-top: 4px;
}

.status-row {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}

.status-row:last-child {
  margin-bottom: 0;
}

.pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 9px;
  white-space: nowrap;
}

.pill.good {
  background: #e8f5ef;
  color: #1f7a4d;
}

.pill.warn {
  background: #fff4db;
  color: #9a5b00;
}

.pill.danger {
  background: #fff0ed;
  color: #b42318;
}

.pill.neutral {
  background: #eef2f6;
  color: #475467;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  max-width: 100%;
  min-width: 0;
}

.toolbar > * {
  flex-shrink: 0;
}

.inventory-title {
  align-items: flex-start;
}

.inventory-top-layout {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(220px, 0.9fr) minmax(320px, 1.3fr) minmax(300px, 1.1fr);
  margin-bottom: 14px;
}

.inventory-status-panel,
.inventory-view-panel,
.inventory-action-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
  padding: 13px 14px;
}

.inventory-status-panel {
  display: grid;
  gap: 7px;
}

.inventory-status-panel strong {
  font-size: 18px;
}

.inventory-status-panel small {
  color: var(--muted);
}

.inventory-status-meta {
  align-items: flex-start;
  display: grid;
  gap: 8px;
}

.inventory-status-actions {
  margin: 0;
}

.sync-failed {
  color: var(--danger);
  font-weight: 800;
  margin-left: 4px;
}

.inventory-status-pills,
.inventory-view-panel,
.inventory-action-panel {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.panel-kicker {
  color: var(--muted);
  flex: 1 0 100%;
  font-size: 12px;
  font-weight: 800;
}

.inventory-view-panel input[type="search"] {
  flex: 1 1 190px;
  min-width: 0;
}

.inventory-stock-limit-field {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  gap: 5px;
  min-height: 34px;
  white-space: nowrap;
}

.inventory-stock-limit-field input {
  box-sizing: border-box;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  min-height: 34px;
  padding: 7px 8px;
  text-align: right;
  width: 76px;
}

.inventory-view-row {
  align-items: center;
  display: flex;
  flex: 1 0 100%;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.inventory-view-label {
  color: var(--muted);
  flex: 0 0 34px;
  font-size: 12px;
  font-weight: 800;
}

.inventory-image-filter-toggle {
  white-space: nowrap;
}

.inventory-image-filter-toggle.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.inventory-layout-switch,
.inventory-stock-sort {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.active-filter-badges {
  align-items: center;
  display: flex;
  flex: 1 0 100%;
  flex-wrap: wrap;
  gap: 6px;
}

.stock-filter-buttons {
  align-items: center;
  display: flex;
  flex: 1 1 260px;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.inventory-view-row .stock-filter-buttons {
  flex: 0 1 auto;
}

.stock-filter-button {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #344054;
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  justify-content: center;
  line-height: 1.2;
  min-height: 34px;
  padding: 8px 10px;
  text-decoration: none;
  white-space: nowrap;
}

.stock-filter-button:hover {
  text-decoration: none;
}

.stock-filter-button.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.inventory-view-panel .inventory-view-control {
  align-items: center;
  box-sizing: border-box;
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  justify-content: center;
  line-height: 1.2;
  min-height: 34px;
  padding: 8px 10px;
  white-space: nowrap;
}

.inventory-view-panel a.inventory-view-control {
  text-decoration: none;
}

.inventory-view-panel input[type="search"] {
  min-height: 34px;
}

.inventory-action-panel .inline-form {
  margin: 0;
}

.inventory-refresh-form button {
  white-space: nowrap;
}

.inventory-core-actions,
.inventory-support-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.inventory-core-actions {
  flex: 1 1 210px;
}

.inventory-support-actions {
  flex: 1 1 220px;
}

.inventory-sticky-actions {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -2px 0 14px;
  padding: 10px 12px;
  position: sticky;
  top: var(--inventory-sticky-offset);
  z-index: var(--z-inventory-sticky-actions);
}

.inventory-sticky-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-right: 2px;
}

.inventory-sticky-actions button {
  white-space: nowrap;
}

.inventory-action-panel.is-purchase-order-mode,
.inventory-sticky-actions.is-purchase-order-mode {
  background: #f1fbf8;
  border-color: var(--purchase-mode-border);
}

.inventory-sticky-actions.is-purchase-order-mode {
  box-shadow: 0 10px 24px rgba(18, 128, 111, 0.16);
}

.is-purchase-order-mode [data-option-row] {
  cursor: pointer;
}

.inventory-action-panel.is-stock-receiving-mode,
.inventory-sticky-actions.is-stock-receiving-mode {
  background: var(--stock-receiving-mode-bg);
  border-color: var(--stock-receiving-mode-border);
}

.inventory-sticky-actions.is-stock-receiving-mode {
  box-shadow: 0 10px 24px rgba(23, 107, 135, 0.14);
}

.is-stock-receiving-mode [data-option-row] {
  cursor: pointer;
}

.inventory-product-groups {
  display: grid;
  gap: 14px;
}

.inventory-product-group {
  min-width: 0;
}

.inventory-product-header {
  align-items: stretch;
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  display: grid;
  gap: 12px;
  grid-template-areas: "photo main memo actions";
  grid-template-columns: 104px minmax(220px, 1.3fr) minmax(190px, 0.9fr) minmax(96px, auto);
  margin-bottom: 8px;
  padding: 12px;
  position: sticky;
  top: var(--inventory-product-sticky-offset);
  z-index: var(--z-inventory-product-header);
}

.inventory-product-photo {
  grid-area: photo;
  min-width: 0;
}

.inventory-product-header .product-thumbnail {
  block-size: 92px;
  max-block-size: 92px;
}

.thumbnail-frame.is-empty {
  align-items: center;
  color: var(--muted);
  display: grid;
  font-size: 12px;
  justify-items: center;
}

.inventory-product-main,
.inventory-product-memo,
.inventory-product-actions {
  min-width: 0;
}

.inventory-product-main {
  display: grid;
  gap: 4px;
  grid-area: main;
}

.inventory-product-code {
  overflow-wrap: anywhere;
}

.inventory-product-meta-line {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 4px;
  line-height: 1.35;
}

.inventory-meta-separator {
  color: #98a2b3;
}

.inventory-product-memo {
  align-content: start;
  display: grid;
  gap: 6px;
  grid-area: memo;
  max-width: none;
}

.inventory-product-memo-editor {
  min-width: 0;
}

.inventory-product-memo-editor summary::-webkit-details-marker {
  display: none;
}

.inventory-product-memo-summary {
  color: var(--muted);
  cursor: pointer;
  display: block;
  font-weight: 700;
  line-height: 1.35;
  list-style: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-product-memo > span.inventory-product-memo-summary {
  cursor: default;
}

.inventory-product-memo-summary:hover {
  color: var(--accent-strong);
}

.inventory-product-memo > span.inventory-product-memo-summary:hover {
  color: var(--muted);
}

.inventory-product-memo-editor form {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.inventory-product-actions {
  align-items: flex-start;
  display: flex;
  gap: 8px;
  grid-area: actions;
  justify-content: flex-end;
}

.inventory-header-option-panel {
  margin-bottom: 0;
}

.inventory-header-option-table {
  min-width: max-content;
}

[data-inventory-option-table] [data-column="option-name"] {
  min-width: clamp(120px, var(--inventory-option-name-width-px, var(--inventory-option-name-width, 18ch)), 360px);
  width: clamp(120px, var(--inventory-option-name-width-px, var(--inventory-option-name-width, 18ch)), 360px);
}

.inventory-header-option-table [data-column="option-name"] {
  border-right: 1px solid var(--line);
}

[data-inventory-option-table] [data-column="image"] {
  min-width: calc(var(--inventory-option-image-size, 48px) + 16px);
  text-align: center;
  width: calc(var(--inventory-option-image-size, 48px) + 16px);
}

.inventory-header-option-table th,
.inventory-header-option-table td {
  background: #ffffff;
}

.inventory-product-group.is-collapsed .inventory-header-option-panel {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  display: none;
}

.sync-strip {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 14px 16px;
}

.sync-strip-info {
  display: grid;
  gap: 4px;
}

.sync-strip-info span {
  color: var(--muted);
  font-size: 13px;
}

.sync-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.sync-actions form {
  margin: 0;
}

.inline-form {
  display: inline-flex;
  gap: 8px;
}

.field-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 18px;
}

.field-grid label {
  color: #344054;
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
}

.field-grid input,
.field-grid select {
  width: 100%;
}

.form-actions {
  border-top: 1px solid var(--line);
  padding: 16px 18px;
}

.number-compact {
  max-width: 110px;
  text-align: right;
}

.material-body {
  padding: 18px;
}

.material-template-picker {
  margin-bottom: 10px;
  max-width: 260px;
}

.material-template-picker summary {
  cursor: pointer;
  font-weight: 800;
  margin-bottom: 8px;
}

.material-template-picker label {
  align-items: center;
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.material-template-picker input {
  min-height: 0;
  width: auto;
}

.order-material-text {
  min-height: 180px;
  resize: vertical;
  width: 100%;
}

.photo-material-list {
  display: grid;
  gap: 16px;
  margin-top: 14px;
}

.photo-material-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.photo-material-card h3 {
  font-size: 15px;
  margin: 0 0 10px;
}

.photo-material-card canvas {
  border: 1px solid var(--line);
  display: block;
  height: auto;
  margin-bottom: 10px;
  max-width: 100%;
}

.template-position-preview {
  padding: 18px;
}

.template-position-preview img {
  border: 1px solid var(--line);
  cursor: crosshair;
  display: block;
  height: auto;
  max-width: min(100%, 860px);
}

.purchase-order-panel {
  overflow-x: auto;
}

.purchase-order-table {
  min-width: 840px;
}

.purchase-order-table input[type="text"] {
  min-width: 180px;
  width: 100%;
}

.purchase-local-nav-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  margin: -8px 0 18px;
}

.purchase-local-nav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  min-width: 0;
}

.purchase-local-nav-action {
  flex: 0 0 auto;
  margin-left: auto;
}

.purchase-local-nav a {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
  min-height: 34px;
  padding: 8px 12px;
  text-decoration: none;
}

.purchase-local-nav a.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.purchase-bulk-panel,
.purchase-image-detail-panel,
.purchase-image-list-panel {
  overflow: visible;
}

.purchase-bulk-grid,
.purchase-image-form {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  padding: 18px;
}

.purchase-bulk-grid label,
.purchase-image-form label,
.purchase-field-block {
  color: #344054;
  display: grid;
  font-weight: 700;
  gap: 6px;
}

.purchase-bulk-grid input,
.purchase-bulk-grid select,
.purchase-image-form input,
.purchase-image-form select {
  width: 100%;
}

.purchase-settings-table {
  min-width: 1180px;
}

.purchase-settings-table th:first-child,
.purchase-settings-table td:first-child {
  width: 48px;
}

.stock-receiving-panel,
.stock-set-group,
.stock-keyword-panel {
  overflow-x: auto;
}

.stock-receiving-table {
  min-width: 980px;
}

.stock-receiving-table .thumbnail-frame,
.stock-set-table .thumbnail-frame {
  height: 56px;
  width: 56px;
}

.stock-receiving-table .thumbnail-frame img,
.stock-set-table .thumbnail-frame img,
.stock-set-product-header .thumbnail-frame img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.stock-receiving-option-name,
.stock-receiving-table strong,
.stock-set-product-header strong {
  overflow-wrap: anywhere;
}

.stock-receiving-soft-note {
  background: var(--warning-bg);
  border: 1px solid #f2cc7a;
  border-radius: 6px;
  color: #7a4b00;
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-top: 6px;
  padding: 6px 8px;
}

.number-cell {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stock-set-groups {
  display: grid;
  gap: 18px;
}

.stock-set-product-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: 72px minmax(0, 1fr);
  padding: 14px 16px;
}

.stock-set-product-header .thumbnail-frame {
  height: 64px;
  width: 64px;
}

.stock-set-table {
  min-width: 760px;
}

.set-quantity-control {
  align-items: center;
  display: inline-grid;
  gap: 6px;
  grid-template-columns: 42px minmax(64px, 88px) 42px;
}

.set-quantity-control button {
  min-height: 34px;
  padding: 6px 8px;
}

.stock-keyword-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 18px;
}

.stock-keyword-box {
  display: grid;
  gap: 10px;
}

.stock-keyword-box label {
  color: #344054;
  display: grid;
  font-weight: 700;
  gap: 6px;
}

.stock-keyword-table {
  min-width: 680px;
}

.purchase-image-picker {
  min-width: 180px;
}

.purchase-image-picker details {
  position: relative;
}

.purchase-image-picker summary {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #344054;
  cursor: pointer;
  display: flex;
  font-weight: 700;
  gap: 8px;
  min-height: 38px;
  padding: 7px 10px;
}

.purchase-image-picker summary::-webkit-details-marker {
  display: none;
}

.purchase-image-picker img,
.purchase-image-list-item img {
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 6px;
  flex: 0 0 auto;
  height: 36px;
  object-fit: cover;
  width: 36px;
}

.purchase-image-menu {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  margin-top: 6px;
  max-height: 260px;
  min-width: 220px;
  overflow: auto;
  padding: 6px;
  z-index: 3;
}

.purchase-image-menu button {
  align-items: center;
  background: #ffffff;
  border: 0;
  color: #344054;
  display: flex;
  font-weight: 700;
  gap: 8px;
  justify-content: flex-start;
  min-height: 42px;
  padding: 4px 6px;
  text-align: left;
}

.purchase-image-menu button:hover {
  background: #f2f4f7;
}

.purchase-image-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 8px;
}

.purchase-combobox {
  min-width: 180px;
  position: relative;
  width: 100%;
}

.purchase-filter-combobox {
  width: min(220px, 100%);
}

.purchase-combobox-input {
  padding-right: 40px;
  width: 100%;
}

.purchase-combobox-input:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(23, 107, 135, 0.16);
  outline-offset: 0;
}

.purchase-combobox-toggle {
  align-items: center;
  background: #ffffff;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0 5px 5px 0;
  bottom: 1px;
  color: #344054;
  display: inline-flex;
  justify-content: center;
  min-height: 0;
  padding: 0;
  position: absolute;
  right: 1px;
  top: 1px;
  width: 34px;
}

.purchase-combobox-toggle::before {
  border-bottom: 1px solid currentColor;
  border-right: 1px solid currentColor;
  content: "";
  height: 7px;
  transform: translateY(-2px) rotate(45deg);
  width: 7px;
}

.purchase-combobox-toggle:hover {
  background: #f2f4f7;
  color: var(--accent-strong);
}

.purchase-combobox-menu {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  max-height: min(280px, calc(100vh - 24px));
  overflow: auto;
  padding: 6px;
  position: fixed;
  z-index: var(--z-purchase-combobox);
}

.purchase-combobox-menu button {
  background: #ffffff;
  border: 0;
  color: #344054;
  font-weight: 700;
  justify-content: flex-start;
  min-height: 42px;
  overflow-wrap: anywhere;
  padding: 8px 10px;
  text-align: left;
}

.purchase-combobox-menu button:hover,
.purchase-combobox-menu button.is-active {
  background: #eef8f6;
  color: var(--accent-strong);
}

.purchase-combobox-menu button.is-create {
  color: var(--accent-strong);
}

.purchase-combobox-menu button.is-empty,
.purchase-combobox-menu button.is-empty:hover {
  background: #ffffff;
  color: var(--muted);
  cursor: default;
}

.purchase-image-layout {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
}

.purchase-image-list {
  display: grid;
  gap: 4px;
  padding: 10px;
}

.purchase-image-list-item {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink);
  display: flex;
  gap: 10px;
  padding: 8px;
  text-decoration: none;
}

.purchase-image-list-item:hover,
.purchase-image-list-item.is-active {
  background: #eef8f6;
  border-color: #b7ddd5;
  text-decoration: none;
}

.purchase-image-list-item span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.purchase-image-list-item strong,
.purchase-image-list-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purchase-image-list-item small {
  color: var(--muted);
}

.purchase-image-list-item em {
  color: var(--danger);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.purchase-image-edit-form {
  border-bottom: 1px solid var(--line);
}

.purchase-position-preview {
  display: inline-block;
  max-width: 100%;
  padding: 18px;
  position: relative;
}

.purchase-position-preview img {
  border: 1px solid var(--line);
  cursor: crosshair;
  display: block;
  height: auto;
  max-width: min(100%, 860px);
}

.purchase-position-layer {
  bottom: 18px;
  left: 18px;
  pointer-events: none;
  position: absolute;
  right: 18px;
  top: 18px;
}

.purchase-position-marker {
  background: transparent;
  border: 0;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.95));
  min-height: 0;
  padding: 0;
  pointer-events: auto;
  position: absolute;
  text-shadow: 0 0 4px #ffffff, 0 0 8px #ffffff;
  transform: translate(-50%, -50%);
  white-space: nowrap;
}

.purchase-position-subheader {
  border-top: 1px solid var(--line);
}

.purchase-position-table {
  min-width: 840px;
}

.purchase-position-status {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.photo-material-meta {
  color: var(--muted);
  font-size: 13px;
  margin: -4px 0 10px;
}

.purchase-order-code {
  display: block;
  overflow-wrap: anywhere;
}

.purchase-material-panel {
  overflow: visible;
}

.purchase-material-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  padding: 18px;
}

.purchase-material-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 14px;
}

.purchase-material-card h3 {
  font-size: 15px;
  margin: 0;
}

.purchase-material-warning {
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 14px 18px;
}

.purchase-order-filter {
  padding: 14px 18px;
}

.purchase-order-setting-grid {
  align-items: end;
}

.checkbox-field {
  align-items: center;
  display: inline-flex;
  gap: 8px;
  min-height: 38px;
}

.checkbox-field input[type="checkbox"] {
  min-height: 0;
  width: auto;
}

.purchase-order-position-preview {
  border-top: 1px solid var(--line);
}

tr:last-child td {
  border-bottom: 0;
}

.empty {
  color: var(--muted);
  padding: 32px 16px;
  text-align: center;
}

.search-form {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

input,
select,
textarea,
button,
.action {
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  min-height: 38px;
  padding: 8px 12px;
}

input,
select,
textarea {
  background: #ffffff;
}

button,
.action {
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
}

button.secondary,
.action.secondary {
  background: #eef2f6;
  color: #344054;
}

button.secondary:hover,
.action.secondary:hover {
  background: #dfe5ee;
}

button.danger-secondary {
  background: #fff0ed;
  border-color: #f1b8b0;
  color: var(--danger);
}

button.danger-secondary:hover {
  background: var(--warning-bg);
  border-color: #f2cc7a;
  color: var(--danger);
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button:hover,
.action:hover {
  background: var(--accent-strong);
  text-decoration: none;
}

.link-button,
.link-button:hover {
  background: transparent;
  border: 0;
  color: #344054;
  font-weight: 600;
  min-height: 0;
  padding: 0;
}

.messages {
  margin-bottom: 18px;
}

.message {
  background: #e8f5ef;
  border: 1px solid #a6d7bd;
  border-radius: 8px;
  padding: 12px 14px;
}

.message.warning,
.message.error {
  background: #fff4db;
  border-color: #f2cc7a;
}

.message.error {
  background: #fff0ed;
  border-color: #f1b8b0;
}

.inventory-panel {
  max-width: 100%;
  overflow-x: auto;
  width: 100%;
}

.inventory-table {
  min-width: max-content;
  table-layout: auto;
  width: max-content;
}

.inventory-table th,
.inventory-table td {
  white-space: normal;
}

.product-heading small {
  display: block;
  font-weight: 600;
  white-space: normal;
}

.rail-table tbody tr.product-start > td {
  border-top: 12px solid var(--bg);
}

.rail-table tbody tr.product-start:first-child > td {
  border-top: 0;
}

.rail-option > td {
  background: #ffffff;
}

.rail-option.product-start > td:nth-child(2),
.rail-option.option-extra > td:first-child {
  border-left: 5px solid #dfe8ee;
}

.inventory-header-option-table .rail-option.product-start > td:nth-child(2),
.inventory-header-option-table .rail-option.option-extra > td:first-child {
  border-left: 0;
}

.rail-product {
  background: #f9fafb;
  border-left: 5px solid var(--accent);
  max-width: 210px;
  min-width: 0;
  width: max-content;
}

.rail-product > strong,
.product-name {
  display: block;
}

.rail-product > strong {
  margin-top: 8px;
  max-width: 190px;
  overflow-wrap: anywhere;
}

.product-name {
  font-weight: 800;
  line-height: 1.35;
  margin-top: 8px;
}

.product-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 10px 0 8px;
}

.product-number {
  overflow-wrap: anywhere;
}

.sync-at {
  color: var(--muted);
}

.column-menu {
  position: relative;
}

.column-menu summary {
  list-style: none;
}

.column-menu summary::-webkit-details-marker {
  display: none;
}

.buttonlike {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 700;
  min-height: 38px;
  padding: 8px 12px;
}

.buttonlike.secondary {
  background: #eef2f6;
  color: #344054;
}

.column-menu-panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
  display: grid;
  gap: 12px;
  left: 0;
  max-height: min(680px, calc(100vh - var(--inventory-sticky-offset, 72px) - 24px));
  overflow: auto;
  padding: 12px;
  position: absolute;
  top: calc(100% + 6px);
  width: min(380px, calc(100vw - 32px));
  z-index: var(--z-inventory-column-menu);
}

.column-menu-section {
  border-bottom: 1px solid #eef2f6;
  display: grid;
  gap: 9px;
  padding-bottom: 10px;
}

.column-menu-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.column-menu-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.column-menu-list {
  display: grid;
  gap: 8px;
}

.column-menu-row {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.column-menu-panel label {
  align-items: center;
  color: #344054;
  display: flex;
  font-weight: 700;
  gap: 8px;
  min-height: 28px;
  white-space: nowrap;
}

.column-menu-row.is-locked label {
  color: var(--muted);
}

.column-menu-panel input[type="checkbox"] {
  accent-color: var(--accent);
  flex: 0 0 auto;
  height: 16px;
  margin: 0;
  min-height: 0;
  padding: 0;
  width: 16px;
}

.column-move-actions {
  display: flex;
  gap: 4px;
}

.column-move-actions button {
  min-height: 28px;
  padding: 3px 7px;
}

.column-move-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.column-menu-control {
  display: grid;
  gap: 6px;
}

.column-menu-control > div:first-child {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.column-menu-control small,
.column-menu-section > small {
  color: var(--muted);
  font-size: 12px;
}

.column-control-label {
  color: #344054;
  font-weight: 700;
}

.column-control-value {
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.column-adjust-actions,
.stock-step-toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.column-adjust-actions button,
.stock-step-toggle-group button {
  min-height: 30px;
  padding: 4px 9px;
}

.column-menu-footer {
  display: flex;
  justify-content: flex-end;
}

.column-menu-footer button {
  min-height: 30px;
  padding: 4px 12px;
}

.stock-step-toggle-group button[aria-pressed="true"] {
  background: #e5f2f7;
  border-color: #a9d4e2;
  color: var(--accent-strong);
}

.option-name-lines {
  display: grid;
  gap: 3px;
}

.option-name-line {
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  display: -webkit-box;
  font-weight: 800;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: keep-all;
}

.option-code {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 7px;
}

.thumbnail-frame {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-sizing: border-box;
  contain: inline-size;
  display: block;
  max-inline-size: 100%;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

.thumbnail-frame img {
  display: block;
  height: 100%;
  inset: 0;
  object-fit: contain;
  position: absolute;
  width: 100%;
}

.product-thumbnail {
  aspect-ratio: 1 / 1;
  inline-size: auto;
  margin: 8px 0;
  max-block-size: 190px;
}

.option-thumbnail {
  aspect-ratio: 1 / 1;
  block-size: var(--inventory-option-image-size, 48px);
  inline-size: var(--inventory-option-image-size, 48px);
  margin: 0 auto;
  max-block-size: none;
}

.option-thumbnail img {
  object-fit: cover;
}

.option-thumbnail[data-option-image-viewer-trigger] {
  cursor: zoom-in;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.option-thumbnail[data-option-image-viewer-trigger]:hover,
.option-thumbnail[data-option-image-viewer-trigger]:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(23, 107, 135, 0.16);
  outline: none;
}

.option-thumbnail[data-option-image-viewer-trigger]:hover {
  transform: translateY(-1px);
}

.is-option-image-mode .option-thumbnail {
  background: #eef8fb;
  border-color: #7aaabc;
  border-style: dashed;
}

.is-option-image-mode .option-thumbnail img,
.option-thumbnail.has-pending img {
  object-fit: contain;
}

.option-thumbnail.is-empty {
  align-items: center;
  border-style: dashed;
  color: var(--muted);
  display: grid;
  font-size: 12px;
  line-height: 1.2;
  min-block-size: var(--inventory-option-image-size, 48px);
  padding: 4px;
  text-align: center;
}

.option-thumbnail.has-pending {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.option-thumbnail.is-drop-active,
.option-image-bulk-drop.is-drop-active {
  background: #e8f5f8;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 107, 135, 0.14);
}

.option-thumbnail.will-remove {
  background: #fff0ed;
  border-color: #f0b8af;
  color: var(--danger);
}

.option-image-check {
  align-items: center;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  gap: 5px;
  margin-bottom: 7px;
}

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

.option-image-bar {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
  max-width: 100%;
  overflow: hidden;
  padding: 12px;
}

.option-image-bar-main,
.option-value-actions,
.option-image-recent {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.option-image-bulk-drop {
  background: #f8fafc;
  border: 1px dashed #9db0bf;
  border-radius: 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
  min-height: 42px;
  padding: 10px 12px;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.option-image-viewer {
  align-items: center;
  display: grid;
  inset: 0;
  justify-items: center;
  padding: 24px;
  position: fixed;
  z-index: var(--z-option-image-viewer);
}

.option-image-viewer-backdrop {
  background: rgba(23, 32, 42, 0.48);
  inset: 0;
  position: absolute;
}

.option-image-viewer-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(23, 32, 42, 0.24);
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 48px);
  max-width: min(760px, calc(100vw - 48px));
  padding: 14px;
  position: relative;
  width: max-content;
}

.option-image-viewer-header {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-width: 0;
}

.option-image-viewer-header strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.option-image-viewer img {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  block-size: min(640px, 70vh);
  display: block;
  inline-size: min(720px, 80vw);
  max-height: 80vh;
  max-width: min(720px, 80vw);
  object-fit: contain;
}

html.is-option-image-viewer-open {
  overflow: hidden;
}

.option-value-actions span,
.option-image-recent span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.option-image-recent-button {
  min-height: 0;
  padding: 2px;
}

.option-image-recent-button img {
  border-radius: 5px;
  display: block;
  height: 38px;
  object-fit: cover;
  width: 38px;
}

.option-image-change-summary {
  color: var(--muted);
  font-weight: 700;
}

.rail-option.image-pending > td {
  box-shadow: inset 0 0 0 2px rgba(31, 122, 77, 0.18);
}

.product-memo {
  margin-top: 12px;
  min-width: 0;
}

.product-row {
  background: #f9fafb;
}

.stock-editor {
  align-items: center;
  display: grid;
  gap: 5px;
  grid-template-columns: 36px 36px;
  justify-content: center;
  justify-items: center;
  margin: 0 auto;
  width: 78px;
}

.stock-editor input {
  grid-column: 1 / -1;
  font-variant-numeric: tabular-nums;
  text-align: center;
  width: 62px;
}

.stock-editor input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.stock-editor input[type="number"]::-webkit-inner-spin-button,
.stock-editor input[type="number"]::-webkit-outer-spin-button {
  appearance: none;
  margin: 0;
}

.stock-editor .step {
  min-height: 32px;
  padding: 4px 0;
  width: 36px;
}

.stock-editor .plus {
  border-color: #bfe4cb;
  color: #1f7a4d;
}

.stock-editor .minus {
  border-color: #f0b8af;
  color: var(--danger);
}

.inventory-header-option-table .stock-editor {
  display: inline-flex;
  gap: 4px;
  grid-template-columns: none;
  width: max-content;
}

.inventory-header-option-table .stock-editor input {
  grid-column: auto;
  width: 64px;
}

.inventory-header-option-table .stock-editor .step {
  width: 34px;
}

.stock-empty {
  background: #fff0ed;
}

.stock-low {
  background: #fff4db;
}

.rail-option > td.stock-empty {
  background: #fff0ed;
}

.rail-option > td.stock-low {
  background: #fff4db;
}

.rail-table .rail-option.has-stock-empty > td:not(.rail-product),
.inventory-header-option-table .rail-option.has-stock-empty > td {
  background: #fff0ed;
}

.rail-table .rail-option.has-stock-low > td:not(.rail-product),
.inventory-header-option-table .rail-option.has-stock-low > td {
  background: #fff8e6;
}

.rail-option.purchase-selected > td:not(.rail-product),
.inventory-header-option-table .rail-option.purchase-selected > td {
  box-shadow: inset 0 0 0 3px var(--purchase-mode-border);
}

.rail-option.stock-receiving-selected > td:not(.rail-product),
.inventory-header-option-table .rail-option.stock-receiving-selected > td {
  box-shadow: inset 0 0 0 3px var(--stock-receiving-mode-border);
}

.rail-option.purchase-selected > td:first-child {
  border-bottom-left-radius: 6px;
  border-top-left-radius: 6px;
}

.rail-option.purchase-selected > td:last-child {
  border-bottom-right-radius: 6px;
  border-top-right-radius: 6px;
}

.rail-option.stock-receiving-selected > td:first-child {
  border-bottom-left-radius: 6px;
  border-top-left-radius: 6px;
}

.rail-option.stock-receiving-selected > td:last-child {
  border-bottom-right-radius: 6px;
  border-top-right-radius: 6px;
}

.changed {
  background: #e8f5ef;
}

.rail-option.changed > td:not(.rail-product) {
  background: #e8f5ef;
}

.failed {
  background: #fff0ed;
}

.locked {
  color: #697586;
}

.memo-cell {
  max-width: 170px;
  min-width: 0;
  overflow-wrap: anywhere;
  width: max-content;
}

.memo-cell textarea {
  min-height: 84px;
  width: 100%;
}

.compact {
  grid-template-columns: minmax(240px, 420px);
}

@media (max-width: 860px) {
  .page-header,
  .sync-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  .purchase-local-nav-row {
    align-items: flex-start;
  }

  .topbar {
    gap: 12px;
    justify-content: space-between;
    min-height: 54px;
    padding: 0 18px;
  }

  .topbar.is-hidden {
    transform: translateY(-100%);
  }

  .brand,
  .desktop-nav {
    display: none;
  }

  .mobile-page-title {
    color: var(--ink);
    display: inline-flex;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.2;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-page-title:hover {
    text-decoration: none;
  }

  .mobile-menu {
    display: block;
    flex: 0 0 auto;
    margin-left: auto;
    position: relative;
  }

  .mobile-menu > summary {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: #344054;
    cursor: pointer;
    font-weight: 800;
    list-style: none;
    min-height: 36px;
    padding: 8px 12px;
  }

  .mobile-menu > summary::-webkit-details-marker {
    display: none;
  }

  .mobile-menu[open] > summary {
    border-color: var(--accent);
    color: var(--accent-strong);
  }

  .mobile-menu .mobile-nav {
    align-items: stretch;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
    display: grid;
    gap: 2px;
    padding: 8px;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: min(78vw, 280px);
    z-index: 40;
  }

  .mobile-menu .nav a,
  .mobile-menu .nav-settings summary,
  .mobile-menu .link-button {
    border-radius: 6px;
    display: flex;
    justify-content: flex-start;
    padding: 10px 12px;
    text-align: left;
    width: 100%;
  }

  .mobile-menu .nav a:hover,
  .mobile-menu .nav-settings summary:hover,
  .mobile-menu .link-button:hover {
    background: #f2f4f7;
    text-decoration: none;
  }

  .mobile-menu .nav-settings {
    position: static;
    width: 100%;
  }

  .mobile-menu .nav-submenu {
    background: #f9fafb;
    border: 0;
    border-radius: 6px;
    box-shadow: none;
    margin: 2px 0 4px;
    min-width: 0;
    padding: 4px 0 4px 10px;
    position: static;
  }

  .mobile-menu .nav-form {
    width: 100%;
  }

  .sync-actions {
    justify-content: flex-start;
  }

  .search-form {
    align-items: flex-start;
    width: 100%;
  }

  .search-form input[type="search"] {
    flex: 1 1 160px;
    min-width: 0;
  }

  .page {
    padding: 18px;
  }

  .inventory-title {
    margin-bottom: 8px;
  }

  .inventory-title p {
    display: none;
  }

  .metrics,
  .grid.two,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .panel {
    overflow-x: auto;
  }

  .purchase-order-panel {
    overflow-x: visible;
  }

  .stock-receiving-panel,
  .stock-set-group,
  .stock-keyword-panel {
    overflow-x: visible;
  }

  .purchase-order-table {
    min-width: 0;
    width: 100%;
  }

  .purchase-order-table thead {
    display: none;
  }

  .purchase-order-table,
  .purchase-order-table tbody,
  .purchase-order-table tr,
  .purchase-order-table td {
    display: block;
  }

  .purchase-order-table tbody {
    display: grid;
    gap: 10px;
    padding: 10px;
  }

  .purchase-order-table tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 8px;
    padding: 12px;
  }

  .purchase-order-table td {
    border-bottom: 0;
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(86px, 34%) minmax(0, 1fr);
    padding: 0;
  }

  .purchase-order-table td[data-label]::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 12px;
    font-weight: 800;
  }

  .purchase-order-table input[type="text"],
  .purchase-order-table .number-compact {
    min-width: 0;
    width: 100%;
  }

  .stock-keyword-grid {
    grid-template-columns: 1fr;
  }

  .stock-set-product-header {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .toolbar,
  .option-image-bar,
  .inventory-top-layout,
  .inventory-sticky-actions,
  .inventory-product-groups {
    max-width: calc(100vw - 36px);
    width: calc(100vw - 36px);
  }

  .toolbar {
    align-items: flex-start;
  }

  .inventory-top-layout {
    gap: 8px;
    grid-template-columns: 1fr;
    margin-bottom: 8px;
  }

  .inventory-status-panel,
  .inventory-view-panel,
  .inventory-action-panel {
    padding: 10px;
    width: 100%;
  }

  .inventory-layout-switch {
    flex: 1 1 100%;
  }

  .inventory-product-header {
    align-items: start;
    gap: 6px;
    grid-template-areas:
      "photo main"
      "actions memo";
    grid-template-columns: 78px minmax(0, 1fr);
    margin-bottom: 4px;
    padding: 8px;
  }

  .inventory-product-header .product-thumbnail {
    block-size: 64px;
    max-block-size: 64px;
  }

  .inventory-product-main {
    gap: 2px;
  }

  .inventory-product-header .product-summary {
    gap: 4px;
    margin: 5px 0 0;
  }

  .inventory-product-meta-line {
    line-height: 1.25;
  }

  .inventory-product-memo {
    align-self: center;
    gap: 3px;
  }

  .inventory-product-actions {
    align-self: start;
    justify-content: flex-start;
  }

  :root {
    --inventory-sticky-offset: 56px;
    --inventory-sticky-actions-height: 50px;
  }

  .inventory-action-panel > *,
  .inventory-core-actions,
  .inventory-support-actions {
    flex: 1 1 100%;
    width: 100%;
  }

  .column-menu-panel {
    left: 18px;
    max-height: calc(100vh - var(--inventory-sticky-offset, 56px) - 16px);
    position: fixed;
    right: 18px;
    top: calc(var(--inventory-sticky-offset, 56px) + 8px);
    width: auto;
  }

  .inventory-status-pills,
  .inventory-view-panel,
  .inventory-action-panel,
  .inventory-core-actions,
  .inventory-support-actions,
  .inventory-sticky-actions,
  .option-image-bar-main,
  .option-value-actions,
  .option-image-recent {
    align-items: center;
  }

  .inventory-view-panel input[type="search"] {
    flex-basis: 180px;
  }

  .inventory-sticky-actions {
    gap: 6px;
    margin: -4px 0 6px;
    padding: 6px 8px;
  }

  .inventory-sticky-title {
    flex: 0 0 auto;
    font-size: 11px;
    margin-right: 0;
    white-space: nowrap;
  }

  .inventory-sticky-actions button,
  .inventory-product-actions .toggle-row {
    min-height: 36px;
    padding: 5px 10px;
  }

  .inventory-product-groups {
    gap: 10px;
  }

  table {
    min-width: 760px;
  }

  .inventory-table {
    min-width: max-content;
    width: max-content;
  }

  .inventory-table th,
  .inventory-table td {
    padding: 9px 4px;
  }

  .product-heading {
    max-width: 128px;
  }

  .rail-product {
    max-width: 128px;
    min-width: 0;
  }

  .product-thumbnail {
    max-block-size: 118px;
  }

  .option-thumbnail {
    block-size: var(--inventory-option-image-size, 48px);
    inline-size: var(--inventory-option-image-size, 48px);
    min-block-size: var(--inventory-option-image-size, 48px);
  }

  .option-image-bar {
    padding: 10px;
  }

  .option-image-viewer {
    padding: 16px;
  }

  .option-image-viewer-panel {
    max-height: calc(100vh - 32px);
    max-width: calc(100vw - 32px);
    padding: 12px;
    width: calc(100vw - 32px);
  }

  .option-image-viewer img {
    max-height: 70vh;
    max-width: 100%;
    width: 100%;
  }

  .option-image-bar-main,
  .option-value-actions,
  .option-image-recent {
    width: 100%;
  }

  .stock-editor {
    gap: 4px;
    grid-template-columns: 30px 30px;
    width: 64px;
  }

  .stock-editor .step {
    min-height: 30px;
    width: 30px;
  }

  .stock-editor input {
    width: 52px;
  }

  .inventory-header-option-table .stock-editor {
    grid-template-columns: none;
    width: max-content;
  }

  .inventory-header-option-table .stock-editor input {
    grid-column: auto;
    width: 52px;
  }

  .inventory-header-option-table .stock-editor .step {
    width: 30px;
  }

  .memo-cell {
    max-width: 90px;
    min-width: 54px;
  }

  .inventory-product-memo.memo-cell {
    max-width: none;
  }

  .pill {
    padding: 3px 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .topbar {
    transition: none;
  }
}

@media (max-width: 860px) {
  .purchase-image-layout {
    grid-template-columns: 1fr;
  }

  .purchase-bulk-grid,
  .purchase-image-form {
    grid-template-columns: 1fr;
  }

  .purchase-settings-table,
  .purchase-position-table {
    min-width: 0;
  }

  .purchase-image-picker,
  .purchase-image-menu {
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 420px) {
  :root {
    --inventory-sticky-offset: 56px;
    --inventory-sticky-actions-height: 50px;
  }

  .inventory-sticky-title {
    flex: 0 0 auto;
  }

  .inventory-product-header {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .inventory-product-actions {
    justify-content: flex-start;
  }

  .inventory-core-actions > *,
  .inventory-support-actions > *,
  .inventory-sticky-actions button {
    flex: 0 1 auto;
  }

  .inventory-view-panel input[type="search"] {
    flex: 1 0 100%;
  }
}
