:root {
  --bg: #f4f5f6;
  --panel: #ffffff;
  --panel-strong: #e9ecef;
  --ink: #202327;
  --muted: #68707a;
  --line: #cfd5dc;
  --accent: #3f4650;
  --accent-soft: #dfe3e7;
  --shadow: 0 18px 40px rgba(32, 35, 39, 0.08);
  font-family:
    Inter, "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", Meiryo, system-ui,
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  min-width: 1080px;
  overflow: hidden;
  color: var(--ink);
  background: var(--bg);
}

button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #cfd4da;
  border-radius: 7px;
  font: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(63, 70, 80, 0.2);
  border-color: #7a828d;
}

textarea {
  resize: vertical;
  line-height: 1.6;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  padding: 24px 18px;
  overflow: auto;
  background: #e7e9ec;
  border-right: 1px solid #d2d6db;
}

.brand {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  color: #fff;
  background: var(--accent);
  border-radius: 8px;
  font-weight: 700;
}

.brand p,
.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
}

.brand h1,
.topbar h2,
.empty-state h3 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  font-size: 20px;
}

.side-nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(63, 70, 80, 0.18);
}

.nav-item.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
  min-width: 0;
  min-height: 0;
  height: 100vh;
  overflow: hidden;
  padding: 28px;
  background: var(--panel);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 42px;
}

.topbar h2 {
  font-size: 26px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
}

.workspace {
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.empty-state {
  display: grid;
  align-content: center;
  min-height: 420px;
  max-width: 720px;
}

.empty-state h3 {
  margin-bottom: 12px;
  font-size: 28px;
}

.empty-state p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.page-note {
  display: grid;
  gap: 12px;
  max-width: 760px;
  padding: 22px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.page-note h3,
.page-note p {
  margin: 0;
}

.page-note h3 {
  font-size: 22px;
}

.page-note p {
  color: var(--muted);
  line-height: 1.7;
}

.product-master,
.item-master,
.material-master,
.supplier-master,
.variable-master,
.variable-option-master,
.bulk-settings-page {
  display: grid;
  gap: 18px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.product-master,
.item-master,
.supplier-master,
.variable-master,
.variable-option-master,
.bulk-settings-page {
  grid-template-rows: minmax(0, 1fr);
}

.material-master {
  grid-template-rows: auto minmax(0, 1fr);
}

.section-heading,
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.material-tabs {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(120px, auto);
  width: fit-content;
  padding: 4px;
  background: #f1f4f7;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.material-tab {
  min-height: 38px;
  padding: 0 16px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.material-tab.active {
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.section-heading h4 {
  margin: 0;
  letter-spacing: 0;
  font-size: 16px;
}

.section-heading span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.compact-heading {
  gap: 10px;
  min-height: 38px;
}

.filter-control,
.form-grid label {
  display: grid;
  gap: 6px;
}

.filter-control span,
.form-grid label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.master-plain-field {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
}

.master-plain-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.master-plain-field strong {
  min-width: 0;
  min-height: 38px;
  color: #30363d;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.editor-panel.is-empty {
  align-content: start;
  color: #7b838d;
}

.filter-control {
  min-width: 250px;
}

.filter-control.compact {
  min-width: 128px;
}

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

.list-heading-tools,
.category-list-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.list-heading-tools .filter-control,
.category-list-tools .filter-control {
  min-width: 220px;
}

.variable-option-category-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.variable-option-category-actions.is-editing {
  display: grid;
  grid-template-columns: minmax(180px, 260px) auto auto;
}

.variable-option-category-actions input,
.variable-option-category-actions button {
  min-height: 34px;
  font-size: 13px;
}

.category-current-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  height: 44px;
  min-height: 44px;
  max-height: 44px;
  padding: 4px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.category-current-panel label {
  display: block;
  min-width: 0;
}

.category-current-panel span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.category-current-panel strong {
  min-width: 0;
  color: #30363d;
  font-size: 15px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.category-current-panel.is-empty strong {
  color: var(--muted);
}

.category-current-panel input,
.category-current-panel button {
  min-height: 34px;
  font-size: 13px;
}

.category-current-panel.is-editing {
  grid-template-columns: minmax(180px, 1fr) auto auto;
}

.category-current-panel.is-editing label span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.category-current-panel.is-disabled {
  grid-template-columns: auto minmax(0, 1fr) auto;
  color: var(--muted);
  background: #f4f6f8;
}

.category-current-panel.is-disabled strong {
  color: #30363d;
  font-size: 15px;
  font-weight: 600;
}

.category-current-panel em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.primary-button,
.secondary-button,
.danger-button,
.icon-button {
  min-height: 38px;
  border-radius: 7px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 600;
}

.primary-button {
  padding: 8px 14px;
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.secondary-button {
  padding: 8px 14px;
  color: #343a42;
  background: #eef0f2;
  border-color: #cfd4da;
}

.secondary-button:disabled {
  cursor: default;
  color: #8b949e;
  background: #f3f4f6;
  border-color: #dde1e6;
}

.danger-button {
  margin-right: auto;
  padding: 8px 14px;
  color: #8f2632;
  background: #fff;
  border-color: #d9a4ac;
}

.table-delete-button {
  width: 26px;
  min-width: 26px;
  height: 26px;
  min-height: 26px;
  margin-right: 0;
  padding: 0;
  border-radius: 6px;
  font-size: 0;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  padding: 0;
  color: #5a626d;
  background: #f1f2f4;
  border-color: #d4d8dd;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.trash-button,
.icon-button[data-action^="remove-"] {
  position: relative;
  display: inline-grid;
  place-items: center;
  color: #8f2632;
  background: #fff;
  border-color: #d9a4ac;
  font-size: 0;
  line-height: 1;
}

.trash-button {
  width: 22px;
  min-width: 22px;
  height: 22px;
  min-height: 22px;
}

.icon-button[data-action^="remove-"] {
  width: 22px;
  min-width: 22px;
  height: 22px;
  min-height: 22px;
  align-self: center;
  border-radius: 5px;
}

.trash-button::before,
.icon-button[data-action^="remove-"]::before {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  display: block;
  width: 12px;
  height: 12px;
  background: currentColor;
  transform: translate(-50%, -50%);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M8 6V4h8v2'/%3E%3Cpath d='M19 6l-1 14H6L5 6'/%3E%3Cpath d='M10 11v6'/%3E%3Cpath d='M14 11v6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M8 6V4h8v2'/%3E%3Cpath d='M19 6l-1 14H6L5 6'/%3E%3Cpath d='M10 11v6'/%3E%3Cpath d='M14 11v6'/%3E%3C/svg%3E") center / contain no-repeat;
}

.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.icon-button:hover {
  filter: brightness(0.96);
}

.product-layout {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 3fr) minmax(0, 2fr);
  gap: 18px;
  min-height: 0;
  height: 100%;
  align-items: stretch;
}

.item-layout,
.material-layout,
.supplier-layout,
.variable-layout {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 3fr) minmax(0, 2fr);
  gap: 18px;
  min-height: 0;
  height: 100%;
  align-items: stretch;
}

.material-layout {
  min-height: 0;
}

.variable-option-layout {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 3fr) minmax(0, 2fr);
  gap: 18px;
  min-height: 0;
  height: 100%;
  align-items: stretch;
}

.bulk-settings-layout {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-columns: 1fr;
  gap: 18px;
  height: 100%;
  min-height: 0;
}

.bulk-change-panel {
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.bulk-change-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  gap: 12px;
  padding-bottom: 12px;
  background: #f9fafb;
  border-bottom: 1px solid #d8dde3;
}

.bulk-change-top-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 12px;
  align-items: end;
}

.bulk-change-form {
  align-items: end;
}

.bulk-update-button {
  align-self: end;
  white-space: nowrap;
}

.bulk-preview-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
  overflow: hidden;
}

.bulk-preview-list {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  overflow: auto;
}

.bulk-preview-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 6px 10px;
  min-width: 0;
  padding: 12px;
  background: #f9fafb;
  border: 1px solid #c9d0d8;
  border-radius: 7px;
}

.bulk-preview-row strong {
  min-width: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.bulk-preview-row strong.after {
  color: #2563eb;
}

.bulk-preview-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.compact-empty {
  min-height: 72px;
}

.bulk-row-editor {
  display: grid;
  gap: 8px;
}

.bulk-product-shop-head,
.bulk-product-shop-row,
.bulk-enclosure-head,
.bulk-enclosure-row {
  display: grid;
  gap: 8px;
  align-items: center;
}

.bulk-product-shop-head,
.bulk-product-shop-row {
  grid-template-columns:
    minmax(140px, 0.85fr)
    minmax(140px, 0.9fr)
    minmax(90px, 0.45fr)
    minmax(260px, 1.25fr)
    38px;
}

.bulk-enclosure-head,
.bulk-enclosure-row {
  grid-template-columns: minmax(220px, 1.2fr) minmax(80px, 0.35fr) minmax(92px, 0.4fr) 38px;
}

.bulk-product-shop-head,
.bulk-enclosure-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.bulk-product-shop-rows,
.bulk-enclosure-rows {
  display: grid;
  gap: 8px;
}

.form-result {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.master-list,
.editor-panel {
  display: grid;
  gap: 16px;
  min-width: 0;
  min-height: 0;
  padding: 18px;
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.item-editor {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.material-editor,
.supplier-editor,
.variable-editor {
  grid-template-rows: auto minmax(0, 1fr);
}

.item-editor,
.material-editor,
.supplier-editor,
.variable-editor {
  height: 100%;
  overflow: auto;
}

.material-editor {
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr);
}

.item-editor > .section-heading:first-of-type,
.supplier-editor > .section-heading:first-of-type,
.variable-editor > .section-heading:first-of-type {
  position: sticky;
  top: -18px;
  z-index: 3;
  margin: -18px -18px 0;
  padding: 18px 18px 12px;
  background: #f9fafb;
  border-bottom: 1px solid #e1e5ea;
}

.editor-panel.is-readonly input:not([type="hidden"]),
.editor-panel.is-readonly select,
.editor-panel.is-readonly textarea {
  color: #4d5560;
  background: #f3f5f7;
}

.editor-panel.is-readonly .file-button {
  color: #9aa1aa;
  background: #f1f3f5;
  cursor: default;
}

.variable-option-builder {
  gap: 8px;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  height: 100%;
  padding-top: 14px;
  padding-bottom: 14px;
  overflow: auto;
}

.variable-option-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
}

.variable-option-header-row .material-tabs {
  padding: 0;
}

.variable-option-header-row .material-tab {
  min-height: 34px;
}

.product-registration-panel {
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 16px;
  min-width: 0;
  min-height: 0;
}

.product-registration-dialog-panel {
  width: min(1680px, calc(100vw - 24px));
  max-width: none;
}

.product-registration-dialog-form {
  background: transparent;
}

.product-flow-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
}

.product-flow-section {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.product-flow-section:nth-child(1),
.product-flow-section:nth-child(2) {
  align-content: start;
}

.product-flow-summary {
  background: transparent;
  border-color: #d8dde3;
}

.compact-button {
  min-height: 34px;
  padding: 7px 12px;
  font-size: 13px;
}

.product-registration-code-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.product-registration-code-toolbar div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.product-registration-code-toolbar span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.product-registration-code-toolbar strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.product-component-editor {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.product-work-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-width: 0;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid #e1e5ea;
}

.product-work-summary div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.product-work-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.product-work-summary strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.product-component-head,
.product-component-row {
  display: grid;
  grid-template-columns:
    minmax(220px, 1.25fr)
    minmax(72px, 0.35fr)
    minmax(180px, 0.9fr)
    minmax(92px, 0.45fr)
    38px;
  gap: 8px;
  align-items: center;
}

.product-assembly-head,
.product-assembly-row {
  display: grid;
  grid-template-columns:
    minmax(150px, 0.7fr)
    minmax(160px, 0.8fr)
    minmax(92px, 0.45fr)
    minmax(78px, 0.35fr)
    minmax(220px, 1.1fr)
    38px;
  gap: 8px;
  align-items: center;
}

.product-enclosure-head,
.product-enclosure-row {
  display: grid;
  grid-template-columns:
    minmax(220px, 1.25fr)
    minmax(72px, 0.35fr)
    minmax(92px, 0.45fr)
    38px;
  gap: 8px;
  align-items: center;
}

.product-component-head,
.product-assembly-head,
.product-enclosure-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.product-component-rows,
.product-assembly-rows,
.product-enclosure-rows {
  display: grid;
  gap: 8px;
}

.product-component-row output {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.product-assembly-empty {
  margin: 0;
}

.product-enclosure-empty {
  margin: 0;
}

.product-work-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  justify-content: flex-end;
  background: rgba(33, 38, 45, 0.24);
}

.product-work-drawer {
  display: grid;
  grid-template-rows: auto minmax(0, auto) minmax(0, auto) auto;
  gap: 16px;
  width: min(860px, 92vw);
  height: 100%;
  padding: 24px;
  overflow: auto;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 36px rgba(27, 31, 36, 0.18);
}

.product-work-drawer-section {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  background: #fff;
  border: 1px solid #d8dde3;
  border-radius: 8px;
}

.panel-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.product-price-head,
.product-price-row {
  display: grid;
  grid-template-columns:
    minmax(140px, 0.9fr)
    minmax(150px, 1fr)
    minmax(96px, 0.5fr)
    minmax(232px, 1.2fr)
    38px;
  gap: 8px;
  align-items: center;
}

.product-price-panel.is-shop-sku-deferred .product-price-head,
.product-price-panel.is-shop-sku-deferred .product-price-row {
  grid-template-columns:
    minmax(140px, 0.9fr)
    minmax(150px, 1fr)
    minmax(96px, 0.5fr)
    minmax(232px, 1.2fr)
    38px;
}

.product-price-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.product-price-shop-sku:disabled {
  color: #7b838d;
  background: #eef1f4;
  border-color: #cfd5dc;
  cursor: not-allowed;
}

.product-price-row output {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0;
  color: #30363d;
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: 13px;
  font-weight: 700;
}

.product-preview-list {
  display: grid;
  align-content: start;
  gap: 4px;
  max-height: 220px;
  overflow: auto;
}

.product-preview-row {
  display: grid;
  grid-template-columns: minmax(140px, 0.8fr) minmax(220px, 1.4fr) minmax(72px, 0.35fr);
  gap: 12px;
  align-items: center;
  min-height: 28px;
  padding: 4px 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.product-preview-row strong {
  color: #30363d;
  font-size: 13px;
  font-weight: 600;
}

.product-preview-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.product-shop-sku-dialog-panel {
  width: min(1720px, 96vw);
}

.product-material-assignment-dialog-panel {
  width: min(1280px, 96vw);
}

.product-material-assignment-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  min-width: 0;
}

.product-material-assignment-control {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.product-material-assignment-control span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.product-material-assignment-preview {
  min-width: 0;
}

.assignment-preview-row {
  grid-template-columns: minmax(180px, 0.9fr) minmax(180px, 0.8fr) minmax(240px, 1.3fr);
}

.bulk-shop-sku-list {
  display: grid;
  gap: 8px;
  overflow: auto;
}

.bulk-shop-sku-head,
.bulk-shop-sku-row {
  display: grid;
  grid-template-columns:
    minmax(48px, 0.25fr)
    minmax(132px, 0.8fr)
    minmax(180px, 1fr)
    minmax(220px, 1.3fr)
    minmax(220px, 1.3fr)
    minmax(128px, 0.75fr)
    minmax(160px, 0.9fr)
    minmax(108px, 0.55fr)
    minmax(260px, 1.25fr);
  gap: 8px;
  align-items: center;
}

.bulk-shop-sku-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.bulk-shop-sku-row {
  padding: 8px;
  background: #f9fafb;
  border: 1px solid #d8dde3;
  border-radius: 7px;
}

.bulk-product-include {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
}

.bulk-product-include input {
  width: 18px;
  min-height: 18px;
  padding: 0;
}

.bulk-shop-sku-row strong,
.bulk-shop-sku-row span {
  min-width: 0;
  overflow: hidden;
}

.bulk-shop-sku-row strong {
  color: #30363d;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bulk-shop-sku-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.product-detail-panel {
  align-content: start;
  grid-template-rows: none;
  height: 100%;
  overflow: auto;
}

.product-detail-panel > .section-heading:first-of-type {
  position: sticky;
  top: -18px;
  z-index: 3;
  margin: -18px -18px 0;
  padding: 18px 18px 12px;
  background: #f9fafb;
  border-bottom: 1px solid #e1e5ea;
}

.product-detail-panel.is-empty {
  color: #7b838d;
}

.detail-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.detail-heading-actions .primary-button {
  min-width: 72px;
}

.product-spec-panel {
  display: grid;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid #e1e5ea;
}

.product-item-reference-button {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.product-spec-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(70px, 96px));
  justify-content: start;
  gap: 10px 12px;
}

.product-spec-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.product-spec-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.product-spec-field strong,
.product-spec-field output {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  color: #30363d;
  font-size: 13px;
  font-weight: 700;
}

.lead-time-editor {
  display: grid;
  grid-template-columns: minmax(72px, 0.55fr) minmax(132px, 1fr);
  gap: 6px;
  align-items: center;
}

.lead-time-editor input,
.lead-time-editor select {
  min-width: 0;
  font-size: 13px;
}

.product-spec-break {
  grid-column: 1;
}

.product-spec-editor {
  display: inline-grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px;
  align-items: center;
  width: 100%;
}

.product-spec-editor input {
  min-width: 0;
  width: 100%;
  padding-inline: 8px;
}

.product-spec-unit {
  color: #30363d;
  font-size: 12px;
  font-weight: 700;
}

.product-composition-panel {
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid #e1e5ea;
}

.product-composition-head,
.product-composition-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 64px minmax(140px, 0.8fr);
  gap: 8px;
  align-items: center;
}

.product-detail-component-head,
.product-detail-component-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 72px minmax(140px, 0.8fr) 34px;
  gap: 8px;
  align-items: center;
}

.product-composition-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.product-detail-component-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.product-composition-rows,
.product-supplement-list {
  display: grid;
  gap: 4px;
}

.product-composition-row,
.product-supplement-row,
.product-detail-component-row {
  min-width: 0;
  padding: 6px 8px;
  background: #fff;
  border: 1px solid #d8dde3;
  border-radius: 6px;
}

.product-detail-component-row select,
.product-detail-component-row input {
  width: 100%;
  min-height: 34px;
  font-size: 12px;
}

.product-composition-row strong,
.product-composition-row span,
.product-supplement-row strong,
.product-supplement-row span {
  min-width: 0;
  overflow: hidden;
  color: #30363d;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-composition-row span,
.product-supplement-row span {
  color: var(--muted);
  font-weight: 500;
}

.product-manufacturing-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  padding: 7px 9px;
  color: #4d5662;
  background: #eef3f6;
  border: 1px solid #d8e1e8;
  border-radius: 6px;
  font-size: 12px;
}

.product-manufacturing-breakdown span {
  color: var(--muted);
  font-weight: 700;
}

.product-manufacturing-breakdown strong {
  font-weight: 800;
}

.product-composition-supplement {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.product-composition-panel.is-editing .product-composition-supplement {
  grid-template-columns: 1fr;
}

.product-composition-supplement section {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
}

.product-supplement-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(88px, 0.6fr) minmax(64px, 0.4fr) minmax(56px, 0.32fr) minmax(120px, 0.8fr);
  gap: 8px;
  align-items: center;
}

.product-supplement-row.enclosure {
  grid-template-columns: minmax(160px, 1fr) minmax(72px, 0.45fr) minmax(64px, 0.4fr);
}

.mini-empty-text {
  margin: 0;
  padding: 6px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.product-item-reference-dialog-panel {
  width: min(1080px, 100%);
}

.product-reference-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.product-reference-summary strong {
  color: var(--ink);
  font-weight: inherit;
}

.product-reference-table-wrap {
  max-height: 260px;
}

.product-reference-table th,
.product-reference-table td {
  white-space: nowrap;
}

.product-reference-table td:last-child {
  white-space: normal;
}

.compact-empty {
  min-height: 150px;
}

.product-summary-grid {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
}

.product-summary-grid div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.product-summary-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.product-summary-grid strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.product-summary-primary strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.25;
}

.product-summary-name strong {
  color: #252a30;
  font-size: 24px;
  line-height: 1.35;
}

.product-summary-name input {
  min-height: 42px;
  font-size: 18px;
  font-weight: 700;
}

.product-summary-subtle {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding-top: 4px;
}

.product-summary-subtle span,
.product-summary-subtle strong {
  color: #6f7782;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
}

.product-summary-subtle span {
  font-weight: 600;
}

.product-selector-code-list {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
}

.product-selector-code-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.9fr) minmax(180px, 1.2fr) minmax(140px, 0.8fr);
  gap: 10px;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  background: #f7f8fa;
  border: 1px solid #d5dbe2;
  border-radius: 7px;
}

.product-selector-code-row span {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.editor-panel {
  overflow: auto;
}

.editor-panel.variable-option-builder {
  overflow: auto;
}

.editor-panel.material-editor,
.editor-panel.supplier-editor,
.editor-panel.variable-editor {
  grid-template-rows: auto minmax(0, 1fr);
  overflow: auto;
}

.editor-panel.material-editor {
  grid-template-rows: auto minmax(0, 1fr);
}

.master-list {
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.master-list .table-wrap {
  min-height: 0;
  overflow: auto;
}

.variable-option-layout > .master-list .table-wrap {
  min-height: 0;
  overflow: auto;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafb;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th,
.data-table td {
  padding: 11px 12px;
  text-align: left;
  border-bottom: 1px solid #d8dde3;
  white-space: nowrap;
}

.data-table th {
  color: #5d6570;
  background: #f2f4f6;
  font-size: 12px;
}

.data-table tbody tr {
  cursor: pointer;
}

.data-table tbody tr:hover,
.data-table tbody tr.selected {
  background: #eef2f6;
}

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

.table-action-column,
.table-action-cell {
  width: 1%;
  text-align: right;
}

.table-action-cell {
  cursor: default;
}

.state-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.state-badge.active {
  color: #26475a;
  background: #d8e3ea;
}

.state-badge.inactive {
  color: #606772;
  background: #d7dce2;
}

.product-status-badge.active {
  color: #14532d;
  background: #c9e3d1;
  border: 1px solid #8ab79b;
}

.product-status-badge.inactive {
  color: #606772;
  background: #d7dce2;
  border: 1px solid #b8c0ca;
}

.state-badge.processed-link-none {
  color: #4d5560;
  background: #d8dde3;
}

.state-badge.processed-link-variable {
  color: #51486b;
  background: #ddd6e8;
}

.data-table.product-material-reference-table {
  table-layout: fixed;
}

.data-table.product-material-reference-table th,
.data-table.product-material-reference-table td {
  white-space: normal;
}

.data-table.product-material-reference-table th:nth-child(1),
.data-table.product-material-reference-table td:nth-child(1) {
  width: 32%;
}

.data-table.product-material-reference-table th:nth-child(2),
.data-table.product-material-reference-table td:nth-child(2) {
  width: 42%;
}

.data-table.product-material-reference-table th:nth-child(3),
.data-table.product-material-reference-table td:nth-child(3) {
  width: 96px;
}

.data-table.product-material-reference-table th:nth-child(4),
.data-table.product-material-reference-table td:nth-child(4) {
  width: 84px;
}

.data-table.product-material-reference-table .material-reference-code,
.data-table.product-material-reference-table .material-reference-name {
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-all;
  white-space: normal;
}

.data-table.product-material-reference-table .material-reference-code strong,
.data-table.product-material-reference-table .material-reference-name span {
  display: -webkit-box;
  max-height: calc(12px * 1.35 * 2);
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.processed-code-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 150px;
}

.processed-toggle,
.processed-toggle-spacer,
.processed-child-marker {
  flex: 0 0 26px;
  width: 26px;
  min-height: 26px;
}

.processed-toggle {
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

.processed-child-marker::before {
  content: "";
  display: block;
  width: 14px;
  height: 1px;
  margin: 13px 0 0 8px;
  background: #aeb7c2;
}

.processed-child-row td {
  background: #fbfcfd;
}

.processed-child-row .processed-code-cell strong {
  font-weight: 700;
}

.table-empty {
  display: grid;
  place-items: center;
  min-height: 100%;
  color: var(--muted);
  background: #f5f7f9;
  border: 1px dashed #c9d0d8;
  border-radius: 8px;
}

.table-empty p {
  margin: 0;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #4d5560;
  font-size: 13px;
  font-weight: 700;
}

.switch input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.flag-field {
  display: flex;
  flex-wrap: wrap;
  align-content: start;
  align-items: center;
  gap: 8px 14px;
  min-height: 38px;
}

.flag-field > span {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.checkbox-heading-field {
  display: grid;
  align-content: start;
  gap: 6px;
}

.checkbox-heading-field > span {
  flex-basis: auto;
}

.icon-only-switch {
  align-self: start;
  min-height: 38px;
}

.icon-only-switch input {
  margin: 0;
}

.material-standard-dimensions,
.material-shipping-box-fields {
  display: contents;
}

.is-hidden {
  display: none !important;
}

.role-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.role-badges span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  color: #3f4650;
  background: #eef2f6;
  border: 1px solid #c8d0d9;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 12px;
}

.generator-sections {
  --generator-column-width: calc((100% - 60px) / 6);
  display: grid;
  gap: 18px;
}

.generator-section {
  display: grid;
  grid-template-columns: repeat(6, minmax(128px, var(--generator-column-width)));
  gap: 12px;
  align-items: end;
}

.generator-variable-section {
  grid-template-columns: repeat(6, minmax(128px, var(--generator-column-width)));
}

.generator-action-section {
  grid-template-columns: minmax(128px, var(--generator-column-width));
}

.product-code-selector-sections {
  --product-selector-field-width: calc((100% - 60px) / 6);
}

.product-code-selector-section {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.product-code-selector-section label {
  flex: 0 0 var(--product-selector-field-width);
  max-width: var(--product-selector-field-width);
}

.processed-material-pick-button {
  justify-content: center;
  width: 100%;
  min-height: 48px;
  overflow-wrap: anywhere;
}

.processed-cost-editor {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.processed-base-head,
.processed-base-row,
.processed-process-head,
.processed-process-row {
  display: grid;
  gap: 8px;
  align-items: center;
}

.processed-base-head,
.processed-base-row {
  grid-template-columns: minmax(112px, 0.75fr) minmax(180px, 1.45fr) minmax(132px, 1fr) minmax(72px, 0.45fr) 38px;
}

.processed-process-head,
.processed-process-row {
  grid-template-columns: minmax(180px, 1.25fr) minmax(132px, 0.9fr) minmax(72px, 0.45fr) minmax(180px, 1.25fr) 38px;
}

.processed-base-head,
.processed-process-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.processed-base-rows,
.processed-process-rows {
  display: grid;
  gap: 8px;
}

.processed-base-row select,
.processed-base-row input,
.processed-process-row select,
.processed-process-row input {
  min-width: 0;
}

.process-select-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  min-width: 0;
}

.process-select-control:has(select:only-child) {
  grid-template-columns: minmax(0, 1fr);
}

.process-add-button {
  padding: 8px 10px;
  white-space: nowrap;
}

.processed-cost-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding-top: 4px;
}

.processed-cost-summary div {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  background: #f5f7f9;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.processed-cost-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.processed-cost-summary strong {
  font-size: 16px;
}

.processed-cost-summary .total {
  background: #eef2f6;
  border-color: #c8d0d9;
}

.order-layout {
  display: grid;
  grid-template-rows: minmax(0, 3fr) minmax(0, 2fr);
  gap: 14px;
  height: 100%;
  min-height: 0;
}

.order-detail-panel,
.order-list-panel {
  min-width: 0;
}

.order-summary-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.order-status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
  padding: 6px 10px;
  text-align: left;
  background: #f5f7f9;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
}

.order-status-card:hover {
  background: #eef2f6;
  border-color: #c8d0d9;
}

.order-status-card.active.status-new {
  color: #5f4300;
  background: #fff4c1;
  border-color: #d8b84d;
}

.order-status-card.active.status-production {
  color: #1f5960;
  background: #c9eef1;
  border-color: #7bc7ce;
}

.order-status-card.active.status-ready {
  color: #443778;
  background: #d3ccf6;
  border-color: #988bd7;
}

.order-status-card.active.status-shipped {
  color: #334155;
  background: #d7dce2;
  border-color: #aeb7c2;
}

.order-status-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.order-status-card strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.order-status-card.active span,
.order-status-card.active strong {
  color: currentColor;
}

.order-detail-panel {
  grid-template-rows: auto auto auto minmax(0, 1fr);
  overflow: hidden;
}

.order-detail-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.order-detail-title-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.order-status-select-control {
  display: inline-flex;
  margin: 0;
}

.order-status-select {
  min-height: 28px;
  padding: 4px 30px 4px 12px;
  color: #334155;
  background-color: #eef2f6;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.order-status-select.status-new {
  color: #5f4300;
  background-color: #fff4c1;
  border-color: #d8b84d;
}

.order-status-select.status-production {
  color: #1f5960;
  background-color: #c9eef1;
  border-color: #7bc7ce;
}

.order-status-select.status-ready {
  color: #443778;
  background-color: #d3ccf6;
  border-color: #988bd7;
}

.order-status-select.status-shipped {
  color: #334155;
  background-color: #d7dce2;
  border-color: #aeb7c2;
}

.order-delete-button {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.order-customer-button,
.order-edit-button {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.order-list-panel {
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
  padding: 14px;
}

.order-list-panel .section-heading {
  align-items: end;
}

.order-import-button {
  align-self: end;
  white-space: nowrap;
}

.order-detail-export-button {
  min-height: 34px;
  padding: 6px 12px;
  white-space: nowrap;
}

.order-check-column {
  width: 42px;
  min-width: 42px;
  text-align: center;
}

.order-delete-column {
  width: 38px;
  min-width: 38px;
  text-align: center;
}

.order-row-delete-button {
  vertical-align: middle;
}

.order-export-checkbox {
  width: 16px;
  height: 16px;
  margin: 0;
  vertical-align: middle;
  accent-color: var(--accent);
  cursor: pointer;
}

.order-import-dialog-panel {
  width: min(640px, 100%);
}

.order-import-subdialog {
  z-index: 30;
}

.order-import-confirm-dialog-panel,
.order-import-error-dialog-panel {
  width: min(560px, 100%);
}

.order-import-dialog-body {
  display: grid;
  gap: 14px;
}

.order-import-dialog-body label {
  display: grid;
  gap: 6px;
}

.order-import-dialog-body label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.order-import-channel-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  padding: 9px 12px;
  color: #4f5965;
  background: #f7f9fb;
  border: 1px solid #d8dde3;
  border-radius: 8px;
  font-size: 12px;
}

.order-import-channel-summary strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.notice-box {
  display: grid;
  gap: 6px;
  padding: 12px;
  color: #4f5965;
  background: #f2f4f6;
  border: 1px solid #d8dde3;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.55;
}

.notice-box strong {
  color: var(--ink);
  font-size: 13px;
}

.notice-box p {
  margin: 0;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.order-list-panel .table-wrap {
  min-height: 0;
}

.order-list-panel .data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.shipping-management-page {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  height: 100%;
}

.shipping-page-heading {
  align-items: end;
}

.shipping-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 10px;
  min-width: min(520px, 100%);
}

.shipping-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 2px;
}

.shipping-tab {
  min-height: 34px;
  padding: 7px 12px;
  color: #4d5560;
  background: #f9fafb;
  border: 1px solid #c9d0d8;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.shipping-tab.active {
  color: #1f2933;
  background: #eaf4f1;
  border-color: #82b7ac;
}

.shipping-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  padding: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.shipping-table-wrap {
  min-height: 0;
}

.shipping-check-column {
  width: 42px;
  text-align: center;
}

.shipping-check-column input {
  width: 15px;
  height: 15px;
  margin: 0;
}

.shipping-table td {
  vertical-align: middle;
}

.shipping-table td > span,
.shipping-table td br + span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.shipping-plan-control {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-right: 8px;
  color: #30363d;
  font-size: 12px;
  font-weight: 700;
}

.shipping-plan-control input {
  width: 14px;
  height: 14px;
  margin: 0;
}

.shipping-plan-date-text {
  color: #7f1d1d;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.shipping-bulk-actions,
.shipping-issue-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.shipping-issue-button {
  color: #075985;
  background: #e0f2fe;
  border-color: #7dd3fc;
}

.shipping-issue-button.is-issued {
  color: #64748b;
  background: #e5e7eb;
  border-color: #cbd5e1;
}

.shipping-import-panel {
  display: grid;
  align-content: start;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.shipping-import-panel p {
  margin: 0;
}

.order-detail-panel.is-empty {
  color: var(--muted);
}

.order-detail-grid,
.empty-detail-grid {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow: visible;
}

.empty-detail-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.order-detail-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.order-detail-row.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.order-detail-row .master-plain-field {
  gap: 4px;
}

.order-detail-row .master-plain-field strong {
  min-height: 24px;
  font-size: 13px;
}

.order-edit-field input {
  width: 100%;
  min-height: 28px;
  padding: 5px 8px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #cfd5dc;
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
}

.order-request-field {
  grid-column: span 3;
}

.order-request-field strong {
  min-height: 24px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.order-note-field {
  grid-column: span 4;
}

.order-note-field strong {
  min-height: 24px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.order-note-field.order-edit-field input {
  min-height: 30px;
}

.order-lines-wrap {
  min-height: 0;
  max-height: none;
}

.order-lines-wrap .data-table th:first-child,
.order-lines-wrap .data-table td:first-child {
  width: 56px;
  text-align: right;
  white-space: nowrap;
}

.order-lines-wrap .data-table th:nth-child(2),
.order-lines-wrap .data-table td:nth-child(2) {
  width: 72px;
  white-space: nowrap;
}

.order-lines-wrap .data-table th:nth-child(4),
.order-lines-wrap .data-table td:nth-child(4) {
  width: 36%;
  white-space: normal;
}

.shipment-group-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 22px;
  padding: 2px 8px;
  color: #075985;
  background: #e0f2fe;
  border: 1px solid #7dd3fc;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.shipment-group-badge.is-empty {
  color: #64748b;
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.order-line-sku-cell {
  display: grid;
  gap: 3px;
}

.order-line-sku-cell strong {
  font-weight: 700;
}

.order-line-sku-cell span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.order-line-product-name {
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.35;
  font-weight: 400;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.order-lines-wrap .data-table th,
.order-lines-wrap .data-table td {
  padding-top: 8px;
  padding-bottom: 8px;
}

.order-status-badge {
  border: 1px solid #cbd5e1;
}

.order-customer-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  justify-content: flex-end;
  background: rgba(33, 38, 45, 0.24);
}

.order-customer-drawer {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  width: min(520px, 92vw);
  height: 100%;
  padding: 24px;
  overflow: auto;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 36px rgba(27, 31, 36, 0.18);
}

.order-customer-drawer-body {
  display: grid;
  align-content: start;
  gap: 14px;
}

.order-customer-drawer-body .master-plain-field strong {
  min-height: 28px;
  white-space: pre-wrap;
}

.production-schedule-page {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  height: 100%;
  min-height: 0;
}

.production-schedule-heading {
  align-items: end;
}

.production-schedule-view-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.schedule-toggle-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 6px 10px;
  color: #4f5965;
  background: #f5f7f9;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.schedule-toggle-control input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #315f78;
}

.working-calendar-page {
  display: grid;
  height: 100%;
  min-height: 0;
}

.working-calendar-panel {
  align-content: start;
  overflow: auto;
}

.working-calendar-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.calendar-month-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: start;
  gap: 8px;
}

.calendar-month-actions label {
  display: grid;
  gap: 4px;
}

.calendar-month-actions label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.working-calendar-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.working-calendar-help {
  display: grid;
  gap: 3px;
}

.working-calendar-help p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
}

.working-calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.working-calendar-legend span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.legend-working {
  color: #1f5b3b;
  background: #d8eadf;
  border-color: #9fc6ad;
}

.legend-closed {
  color: #7f1d1d;
  background: #fee2e2;
  border-color: #fecaca;
}

.legend-override {
  color: #1d4ed8;
  background: #dbeafe;
  border-color: #93c5fd;
}

.working-calendar-month {
  display: grid;
  align-content: start;
  min-height: 0;
}

.working-calendar-weekdays,
.working-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.working-calendar-weekdays span {
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.working-calendar-grid {
  grid-template-rows: repeat(6, 96px);
  overflow: hidden;
  border: 1px solid #d8dde3;
  border-radius: 8px;
}

.working-calendar-day {
  display: grid;
  align-content: start;
  gap: 5px;
  min-height: 0;
  padding: 8px;
  color: var(--ink);
  text-align: left;
  background: #ffffff;
  border: 0;
  border-right: 1px solid #d8dde3;
  border-bottom: 1px solid #d8dde3;
  cursor: pointer;
}

.working-calendar-day:nth-child(7n) {
  border-right: 0;
}

.working-calendar-day.is-outside {
  opacity: 0.48;
}

.working-calendar-day.is-closed {
  background: #fff1f2;
}

.working-calendar-day.is-working {
  background: #f0fdf4;
}

.working-calendar-day.has-override {
  box-shadow: inset 0 0 0 2px #60a5fa;
}

.calendar-day-number {
  font-size: 18px;
  font-weight: 800;
}

.manual-override-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 22px;
  padding: 2px 8px;
  color: #1d4ed8;
  background: #dbeafe;
  border: 1px solid #93c5fd;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.calendar-day-note {
  min-height: 16px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.production-schedule-board {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: auto;
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.production-schedule-head,
.production-schedule-row {
  display: grid;
  grid-template-columns: 428px var(--schedule-width);
  width: var(--schedule-board-width);
  min-width: var(--schedule-board-width);
}

.production-schedule-head {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #f2f4f6;
  border-bottom: 1px solid #d8dde3;
}

.schedule-info-head,
.schedule-info-cell {
  position: sticky;
  left: 0;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 46px 128px;
  gap: 6px;
  align-items: center;
  min-width: 0;
  padding: 10px 8px;
  background: #f9fafb;
  border-right: 1px solid #d8dde3;
}

.schedule-info-head {
  z-index: 40;
  background: #f2f4f6;
}

.schedule-info-cell {
  z-index: 20;
  isolation: isolate;
}

.schedule-info-head span {
  color: #5d6570;
  font-size: 12px;
  font-weight: 800;
}

.schedule-info-head span:nth-child(2) {
  text-align: center;
}

.production-schedule-group {
  width: var(--schedule-board-width);
  min-width: var(--schedule-board-width);
  border-bottom: 1px solid #cfd5dc;
}

.production-schedule-group:last-child {
  border-bottom: 1px solid #cfd5dc;
}

.production-schedule-group-heading {
  position: relative;
  display: grid;
  grid-template-columns: 428px var(--schedule-width);
  box-sizing: border-box;
  width: var(--schedule-board-width);
  min-width: var(--schedule-board-width);
  min-height: 48px;
  background: #eef2f6;
  border-bottom: 1px solid #d8dde3;
}

.schedule-group-info {
  position: sticky;
  left: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 46px 128px;
  gap: 6px;
  align-items: center;
  box-sizing: border-box;
  width: 428px;
  min-height: 48px;
  padding: 9px 8px;
  background: #eef2f6;
  border-right: 1px solid #d8dde3;
}

.schedule-group-timeline {
  position: relative;
  z-index: 0;
  display: grid;
  grid-template-columns: repeat(var(--schedule-columns), 56px);
  align-items: center;
  width: var(--schedule-width);
  min-width: var(--schedule-width);
  min-height: 48px;
}

.schedule-group-timeline .schedule-day-column {
  min-height: 48px;
}

.schedule-group-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.schedule-split-shipping-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  color: #4d5560;
  background: #ffffff;
  border: 1px solid #c9d0d8;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.schedule-split-shipping-button:hover,
.schedule-split-shipping-button:focus-visible,
.schedule-split-shipping-button.is-active {
  color: #1f2933;
  background: #f3f6f8;
  border-color: #9aa6b2;
}

.schedule-split-shipping-button::after {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 7px);
  z-index: 50;
  width: max-content;
  max-width: 140px;
  padding: 5px 7px;
  color: #ffffff;
  background: #1f2933;
  border-radius: 5px;
  content: "発送を分ける";
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(2px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  white-space: nowrap;
}

.schedule-split-shipping-button:hover::after,
.schedule-split-shipping-button:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.schedule-shipment-group-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  color: #075985;
  background: #e0f2fe;
  border: 1px solid #7dd3fc;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.production-schedule-group-heading strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.production-schedule-group-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.schedule-group-action {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
}

.schedule-split-shipping-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  width: 100%;
}

.schedule-split-shipping-actions .compact-button {
  min-height: 26px;
  padding: 4px 8px;
  font-size: 11px;
}

.schedule-group-shipment-label {
  justify-self: center;
  width: 2.2em;
  color: #7f1d1d;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
}

.schedule-shipment-plan-control {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
}

.schedule-shipment-plan-date {
  min-height: 28px;
  width: 124px;
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  color: #7f1d1d;
  background: #fffafa;
  font-size: 11px;
  font-weight: 800;
}

.production-schedule-row {
  position: relative;
  border-bottom: 1px solid #d8dde3;
}

.production-schedule-row:last-child {
  border-bottom: 1px solid #d8dde3;
}

.production-schedule-body {
  position: relative;
  height: 100%;
  min-height: 0;
  width: var(--schedule-board-width);
  min-width: var(--schedule-board-width);
  background:
    linear-gradient(to right, #f9fafb 0 427px, #d8dde3 427px 428px, transparent 428px),
    repeating-linear-gradient(to right, transparent 0 55px, #e1e6eb 55px 56px);
  background-position:
    0 0,
    428px 0;
}

.schedule-product-cell {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.schedule-product-cell.is-split-editing {
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: start;
}

.schedule-split-line-control {
  display: inline-grid;
  place-items: center;
  width: 22px;
  min-height: 22px;
}

.schedule-split-line-checkbox {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.schedule-product-cell strong {
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: normal;
}

.schedule-quantity-cell {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

.schedule-status-control {
  position: relative;
  z-index: 2;
  justify-self: start;
  width: max-content;
  max-width: 100%;
  min-width: 0;
}

.schedule-status-select {
  min-height: 34px;
  width: auto;
  min-width: 112px;
  max-width: 100%;
  padding: 6px 28px 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.schedule-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border: 1px solid;
  border-radius: 999px;
  font-weight: 700;
}

.order-status-badge.status-new,
.schedule-status-pill.status-new,
.schedule-status-select.status-new {
  color: #5f4300;
  background: #fff4c1;
  border-color: #d8b84d;
}

.order-status-badge.status-production,
.schedule-status-pill.status-production,
.schedule-status-select.status-production {
  color: #1f5960;
  background: #c9eef1;
  border-color: #7bc7ce;
}

.order-status-badge.status-ready,
.schedule-status-pill.status-ready,
.schedule-status-select.status-ready {
  color: #443778;
  background: #d3ccf6;
  border-color: #988bd7;
}

.order-status-badge.status-shipped,
.schedule-status-pill.status-shipped,
.schedule-status-select.status-shipped {
  color: #334155;
  background: #d7dce2;
  border-color: #aeb7c2;
}

.schedule-timeline-head,
.schedule-timeline-cell {
  position: relative;
  z-index: 0;
  display: grid;
  grid-template-columns: repeat(var(--schedule-columns), 56px);
  width: var(--schedule-width);
  min-width: var(--schedule-width);
}

.schedule-timeline-head span {
  display: grid;
  gap: 3px;
  padding: 12px 8px;
  color: #5d6570;
  border-right: 1px solid #d8dde3;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}

.schedule-timeline-head span strong {
  font-size: 12px;
  font-weight: 600;
}

.schedule-timeline-head span small {
  font-size: 10px;
  font-weight: 600;
}

.schedule-timeline-head span.is-nonworking {
  color: #7f1d1d;
  background: #fff1f2;
}

.schedule-timeline-head span.is-filler {
  background: #f9fafb;
}

.schedule-timeline-cell {
  align-items: center;
  min-height: 66px;
}

.schedule-day-column {
  z-index: 0;
  grid-row: 1;
  align-self: stretch;
  min-height: 66px;
  border-right: 1px solid #e1e6eb;
}

.schedule-day-column.is-nonworking {
  background: #fff1f2;
}

.schedule-day-column.is-filler {
  background: transparent;
}

.schedule-bar {
  z-index: 1;
  grid-row: 1;
  grid-column: var(--bar-start) / span var(--bar-span);
  height: 16px;
  margin: 0 6px;
  border-radius: 999px;
}

.schedule-bar.production {
  background: #8fb7cf;
}

.schedule-bar.group-production {
  background: #8fb7cf;
}

.schedule-bar.final-buffer {
  height: 8px;
  margin: 0 8px;
  background: #dfe5eb;
}

.schedule-manufacturing-days-bar {
  z-index: 1;
  grid-row: 1;
  grid-column: var(--bar-start) / span var(--bar-span);
  align-self: center;
  height: 10px;
  margin: 0 8px;
  background: #9aa3ad;
  border-radius: 999px;
  pointer-events: none;
}

.schedule-milestone-label.shipment-planned {
  color: #b91c1c;
}

.schedule-milestone-label {
  z-index: 2;
  grid-row: 1;
  grid-column: var(--bar-start) / span 1;
  align-self: end;
  justify-self: center;
  margin-bottom: 7px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

.schedule-milestone-label.order {
  color: #4f6f5f;
}

.schedule-milestone-label.production-end {
  color: #2f6380;
}

.schedule-milestone-label.deadline {
  color: #5d6570;
}

.stacked-cell {
  display: grid;
  gap: 4px;
}

.stacked-cell span {
  white-space: nowrap;
}

@media (max-width: 1280px) {
  .generator-section,
  .generator-variable-section {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}

.item-editor-grid,
.product-editor-grid {
  display: grid;
  grid-template-columns: 156px 1fr;
  gap: 16px;
  align-items: start;
}

.image-uploader {
  display: grid;
  gap: 10px;
}

.item-image-preview {
  display: grid;
  place-items: center;
  width: 156px;
  aspect-ratio: 1;
  overflow: hidden;
  color: var(--muted);
  background: #f9fafb;
  border: 1px dashed #c9d0d8;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}

.item-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.variable-summary {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
}

.variable-summary-code {
  color: var(--ink);
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
}

.variable-summary-names,
.variable-summary-parts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  min-width: 0;
}

.variable-summary-names span {
  color: #252a30;
  font-size: 16px;
  font-weight: 700;
}

.variable-summary-parts span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.variable-summary-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(128px, 180px);
  gap: 14px;
  align-items: end;
  padding-top: 6px;
}

.variable-summary-meta div,
.variable-summary-meta label {
  display: grid;
  gap: 5px;
}

.variable-summary-meta span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.variable-summary-meta strong {
  color: #252a30;
  font-size: 14px;
}

.master-detail-layout,
.supplier-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 16px;
  align-items: stretch;
  height: 100%;
  min-height: 0;
}

.master-detail-fields,
.supplier-detail-fields {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 14px;
  min-width: 0;
  min-height: 0;
  padding: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
}

.supplier-detail-fields {
  overflow: hidden;
}

.master-detail-fields .form-grid,
.supplier-detail-fields .form-grid {
  align-content: start;
  overflow: visible;
}

.master-detail-fields textarea,
.supplier-detail-fields textarea {
  min-height: 104px;
  max-height: 132px;
}

.master-detail-actions,
.supplier-detail-actions {
  padding-top: 0;
}

.master-used-panel,
.supplier-used-materials-panel {
  grid-template-rows: auto 1fr;
  min-height: 0;
  overflow: hidden;
}

.master-used-panel .mini-list,
.supplier-used-materials-panel .mini-list {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.material-detail-fields .form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.material-shipping-size-start,
.material-purchase-start {
  grid-column-start: 1;
}

.material-master .master-detail-layout {
  grid-template-columns: minmax(0, 2.15fr) minmax(270px, 0.85fr);
}

.material-side-column {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
  min-height: 0;
}

.processed-material-detail-fields {
  overflow: auto;
}

.processed-material-detail-body {
  display: grid;
  gap: 16px;
  align-content: start;
  grid-template-rows: auto auto;
  min-width: 0;
  min-height: max-content;
  overflow: visible;
}

.processed-material-top-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 190px);
  gap: 16px;
  align-items: start;
  min-width: 0;
  min-height: 224px;
  overflow: visible;
}

.processed-material-top-row .form-grid {
  grid-template-columns: repeat(6, minmax(82px, 1fr));
  align-content: start;
  column-gap: 16px;
  row-gap: 12px;
  min-width: 0;
  min-height: 224px;
  overflow: visible;
}

.processed-code-field {
  grid-column: 1 / 3;
}

.processed-name-field {
  grid-column: 3 / 7;
}

.processed-variable-field,
.processed-remarks-field {
  grid-column: 1 / -1;
}

.processed-stock-field {
  grid-column: 1 / 3;
}

.processed-safety-stock-field {
  grid-column: 3 / 5;
}

.processed-days-field {
  grid-column: 5 / 7;
}

.processed-material-top-row .master-plain-field {
  gap: 4px;
}

.processed-material-top-row .master-plain-field strong {
  min-height: 24px;
  line-height: 1.35;
}

.processed-material-code-editor,
.processed-material-name-editor {
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
}

.processed-material-code-editor span,
.processed-material-name-editor span,
.processed-variable-editor span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.processed-material-code-editor output {
  display: block;
  min-width: 0;
  min-height: 34px;
  padding: 7px 0;
  color: #30363d;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.processed-material-pick-button {
  justify-content: flex-start;
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.processed-variable-editor {
  grid-template-columns: minmax(120px, 0.32fr) minmax(180px, 0.68fr);
}

.processed-variable-editor span {
  grid-column: 1 / -1;
}

.processed-variable-editor #processedVariableCode:disabled {
  display: none;
}

.processed-material-image-panel {
  grid-template-rows: auto auto;
}

.processed-material-detail-body .processed-material-image-panel {
  align-self: start;
  min-width: 0;
  min-height: max-content;
  padding: 0;
  overflow: visible;
  background: transparent;
  border: 0;
}

.processed-material-image-uploader {
  justify-items: start;
  grid-template-columns: minmax(0, 1fr);
}

.processed-material-image-preview {
  width: 180px;
  max-width: 100%;
  height: 180px;
  aspect-ratio: auto;
}

.variable-detail-fields .product-editor-grid {
  align-content: start;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  color: #343a42;
  background: #f9fafb;
  border: 1px solid #c9d0d8;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.file-button.is-disabled {
  color: #9aa1aa;
  background: #f1f3f5;
  cursor: default;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.cost-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 8px;
  color: #4d5560;
  font-size: 12px;
  font-weight: 700;
}

.cost-summary span,
.cost-summary strong {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  background: #f9fafb;
  border: 1px solid #c9d0d8;
  border-radius: 999px;
}

.item-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.15fr) minmax(270px, 0.85fr);
  gap: 16px;
  min-height: 0;
}

.item-detail-main {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
}

.detail-panel {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.material-head,
.material-row,
.flow-head,
.flow-row {
  display: grid;
  gap: 8px;
  align-items: center;
}

.material-head,
.material-row {
  grid-template-columns: 1fr 1.2fr 0.65fr 0.75fr 38px;
}

.flow-head,
.flow-row {
  grid-template-columns: minmax(150px, 1.05fr) minmax(132px, 0.8fr) minmax(88px, 0.45fr) minmax(78px, 0.35fr) minmax(180px, 1.25fr) 38px;
}

.material-head,
.flow-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.material-rows,
.flow-rows,
.mini-list {
  display: grid;
  gap: 8px;
}

.material-row output {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  min-height: 38px;
  padding: 0;
  overflow: hidden;
  color: #30363d;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: 13px;
  font-weight: 700;
}

.detail-panel > .section-heading .secondary-button {
  margin-left: auto;
}

.expanded-products-panel {
  grid-template-rows: auto 1fr;
}

.expanded-product-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  min-height: 58px;
}

.expanded-product-text {
  display: grid;
  gap: 3px;
  min-width: 0;
  line-height: 1.28;
}

.expanded-product-text strong,
.expanded-product-text span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expanded-product-text strong {
  color: #30363d;
  font-size: 12px;
  font-weight: 600;
}

.expanded-product-text span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.expanded-product-row .state-badge {
  min-height: 22px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
}

.used-products-panel {
  grid-template-rows: auto 1fr;
}

.mini-list {
  align-content: start;
  overflow: auto;
}

.mini-list-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  color: var(--ink);
  text-align: left;
  background: #f9fafb;
  border: 1px solid #c9d0d8;
  border-radius: 7px;
  cursor: pointer;
}

.mini-list-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.mini-list-row.expanded-product-row {
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  min-height: 58px;
  overflow: hidden;
}

.mini-list-row.processed-child-link-row {
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
}

.mini-list-row.expanded-product-row .state-badge {
  justify-self: end;
  width: max-content;
  max-width: 116px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-list-row.used-material-row .material-category-badge {
  color: #4d5560;
  background: #eef1f4;
  border-color: #c9d0d8;
}

.mini-list-row.is-static {
  cursor: default;
}

.item-material-list .mini-list-row {
  grid-template-columns: 0.8fr 1.2fr 0.8fr auto;
}

.mini-empty {
  display: grid;
  place-items: center;
  min-height: 120px;
  color: var(--muted);
  background: #f9fafb;
  border: 1px dashed #c9d0d8;
  border-radius: 8px;
}

.mini-empty p {
  margin: 0;
}

.option-columns {
  display: grid;
  grid-template-columns: repeat(5, minmax(180px, 1fr));
  gap: 10px;
  align-items: stretch;
  min-height: 240px;
  overflow: auto;
}

.variable-option-builder .option-columns {
  height: 100%;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.option-column {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.option-column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 10px;
  border-bottom: 1px solid #d8dde3;
}

.option-column-head h5 {
  margin: 0;
  font-size: 13px;
  line-height: 1.2;
}

.option-column-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.is-readonly-row strong,
.is-readonly-row span {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #30363d;
  font-size: 13px;
  font-weight: 500;
}

.is-readonly-row strong {
  font-weight: 600;
}

.option-column-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.option-column-list {
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 0;
  padding: 5px 6px;
  overflow: auto;
}

.variable-option-builder .option-column-list {
  height: auto;
}

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

.option-requirement-toggle {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 4px 8px;
  align-items: center;
  min-height: 0;
  padding: 4px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.option-requirement-toggle input {
  width: 14px;
  min-width: 14px;
  height: 14px;
  min-height: 14px;
  margin: 0;
  padding: 0;
}

.option-requirement-toggle span {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.option-requirement-toggle small {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.option-node {
  --option-node-bg-start: #f8fcfb;
  --option-node-bg-end: #eef8f5;
  --option-node-border: #82b7ac;
  display: grid;
  grid-template-columns: minmax(44px, auto) minmax(0, 1fr);
  gap: 0;
  align-items: center;
  width: 100%;
  min-height: 30px;
  padding: 0;
  color: var(--ink);
  text-align: left;
  background: #ffffff;
  border: 1px solid var(--option-node-border);
  border-radius: 6px;
  cursor: pointer;
  overflow: hidden;
}

.option-node[data-option-color-level="1"] {
  --option-node-bg-start: #74b6a7;
  --option-node-bg-end: #5ba597;
}

.option-node[data-option-color-level="2"] {
  --option-node-bg-start: #9ed0c4;
  --option-node-bg-end: #86c2b5;
}

.option-node[data-option-color-level="3"] {
  --option-node-bg-start: #c3e3dc;
  --option-node-bg-end: #add8cf;
}

.option-node[data-option-color-level="4"] {
  --option-node-bg-start: #ddf0ec;
  --option-node-bg-end: #cae7e0;
}

.option-node[data-option-color-level="5"] {
  --option-node-bg-start: #f3fbf9;
  --option-node-bg-end: #e2f3ef;
}

.option-node:hover {
  filter: saturate(1.08) brightness(0.98);
}

.option-node.selected {
  filter: saturate(1.08) brightness(0.98);
  box-shadow: inset 0 0 0 1px var(--option-node-border);
}

.option-node span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.option-node strong {
  align-self: stretch;
  display: flex;
  align-items: center;
  min-width: 44px;
  padding: 4px 8px;
  color: var(--ink);
  background: linear-gradient(180deg, var(--option-node-bg-start), var(--option-node-bg-end));
  border-right: 1px solid var(--option-node-border);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.column-empty {
  margin: 0;
  padding: 12px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.add-option-button {
  position: sticky;
  bottom: 0;
  z-index: 1;
  min-height: 28px;
  margin: 0 6px 6px;
  padding: 4px 8px;
  color: #343a42;
  background: #f9fafb;
  border: 1px dashed #c9d0d8;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.add-option-button:hover:not(:disabled) {
  background: #f2f4f6;
}

.add-option-button:disabled {
  color: #9aa1aa;
  cursor: not-allowed;
  background: #f5f6f7;
}

.inline-create-form {
  display: grid;
  gap: 12px;
  padding-top: 2px;
}

.variable-option-builder .inline-create-form {
  gap: 8px;
  min-height: 0;
}

.inline-create-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.variable-option-builder .inline-create-panel {
  gap: 8px;
  padding: 10px;
}

.variable-option-builder .variable-option-form-grid {
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 8px;
}

.variable-option-builder .variable-option-form-grid label > span,
.variable-option-builder .inline-form-heading span {
  font-size: 11px;
}

.variable-option-builder .variable-option-form-grid input,
.variable-option-builder .variable-option-form-grid select,
.variable-option-builder .variable-option-form-grid output {
  min-height: 34px;
  font-size: 13px;
}

.variable-option-builder .form-actions {
  justify-content: flex-end;
  gap: 8px;
  padding-top: 0;
}

.variable-option-builder .form-actions button {
  min-height: 34px;
  padding: 0 14px;
  font-size: 13px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(15 23 42 / 0.32);
}

.modal-panel {
  display: grid;
  gap: 16px;
  width: min(760px, 100%);
  max-height: calc(100vh - 48px);
  padding: 18px;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 72px rgb(15 23 42 / 0.18);
}

.item-option-dialog-panel {
  width: min(1180px, 100%);
}

.variable-generator-dialog-panel {
  width: min(1240px, 100%);
}

.item-option-dialog-columns {
  min-height: 280px;
}

.inline-form-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 32px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.inline-create-panel .inline-form-heading {
  min-height: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.inline-form-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-field output {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0;
  color: #30363d;
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: 13px;
  font-weight: 700;
}

.shop-sku-panel {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid #e1e5ea;
}

.shop-sku-head,
.shop-sku-row {
  display: grid;
  grid-template-columns: 1fr 1.1fr 0.75fr minmax(260px, 1.25fr) 38px;
  gap: 8px;
  align-items: center;
}

.shop-sku-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.shop-sku-rows {
  display: grid;
  gap: 8px;
}

.shop-sku-row output {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0;
  color: #30363d;
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: 13px;
  font-weight: 700;
}

.shop-sku-row strong {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  min-width: 0;
  color: #30363d;
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.form-actions {
  padding-top: 4px;
}

@media (max-width: 900px) {
  body {
    min-width: 0;
  }

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .sidebar {
    max-height: 34vh;
    overflow: auto;
    border-right: 0;
    border-bottom: 1px solid #d2d6db;
  }

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

  .main {
    height: 100%;
    padding: 18px;
  }

  .product-layout,
  .order-layout,
  .item-layout,
  .material-layout,
  .supplier-layout,
  .variable-layout,
  .variable-option-layout,
  .bulk-settings-layout,
  .bulk-change-top-row,
  .product-editor-grid,
  .item-editor-grid,
  .item-detail-grid,
  .product-flow-grid,
  .product-summary-grid,
  .product-selector-code-row,
  .master-detail-layout,
  .supplier-detail-layout,
  .form-grid,
  .generator-section,
  .generator-variable-section,
  .generator-action-section,
  .processed-material-detail-body,
  .processed-material-top-row,
  .variable-summary-meta,
  .material-head,
  .material-row,
  .processed-base-head,
  .processed-base-row,
  .processed-process-head,
  .processed-process-row,
  .processed-cost-summary,
  .lead-time-editor,
  .product-component-head,
  .product-component-row,
  .product-assembly-head,
  .product-assembly-row,
  .product-enclosure-head,
  .product-enclosure-row,
  .product-work-summary,
  .product-composition-head,
  .product-composition-row,
  .product-composition-supplement,
  .product-supplement-row,
  .product-supplement-row.enclosure,
  .product-price-head,
  .product-price-row,
  .product-preview-row,
  .bulk-shop-sku-head,
  .bulk-shop-sku-row,
  .bulk-product-shop-head,
  .bulk-product-shop-row,
  .bulk-enclosure-head,
  .bulk-enclosure-row,
  .flow-head,
  .flow-row,
  .bulk-preview-row,
  .mini-list-row,
  .shop-sku-head,
  .shop-sku-row {
    grid-template-columns: 1fr;
  }

  .order-detail-grid,
  .empty-detail-grid,
  .order-summary-cards,
  .order-detail-row,
  .order-detail-row.compact {
    grid-template-columns: 1fr;
  }

  .order-request-field,
  .order-note-field {
    grid-column: auto;
  }

  .master-detail-layout,
  .supplier-detail-layout {
    height: auto;
    min-height: 0;
  }

  .master-detail-fields,
  .supplier-detail-fields {
    overflow: auto;
  }

  .option-columns {
    grid-template-columns: repeat(5, minmax(180px, 220px));
  }

  .list-heading-tools,
  .category-list-tools {
    display: grid;
    align-items: stretch;
  }

  .filter-control,
  .list-heading-tools .filter-control,
  .category-list-tools .filter-control {
    min-width: 0;
  }

  .variable-option-builder .variable-option-form-grid,
  .variable-option-category-actions.is-editing,
  .category-current-panel,
  .category-current-panel.is-editing,
  .category-current-panel.is-disabled {
    grid-template-columns: 1fr;
  }

  .product-layout {
    grid-template-rows: minmax(0, 3fr) minmax(0, 2fr);
    height: 100%;
    min-height: 0;
  }

  .product-detail-panel {
    height: 100%;
    min-height: 0;
  }

  .product-spec-grid {
    grid-template-columns: repeat(2, minmax(70px, 96px));
  }

  .item-layout {
    grid-template-rows: minmax(0, 3fr) minmax(0, 2fr);
    height: 100%;
    min-height: 0;
  }

  .material-layout {
    grid-template-rows: minmax(0, 3fr) minmax(0, 2fr);
    height: 100%;
    min-height: 0;
  }

  .material-editor {
    height: 100%;
  }

  .supplier-layout {
    grid-template-rows: minmax(0, 3fr) minmax(0, 2fr);
    height: 100%;
    min-height: 0;
  }

  .variable-layout,
  .variable-option-layout {
    grid-template-rows: minmax(0, 3fr) minmax(0, 2fr);
    height: 100%;
    min-height: 0;
  }

  .editor-panel {
    overflow: auto;
  }

  .master-list,
  .editor-panel.variable-option-builder,
  .variable-option-layout > .master-list {
    max-height: none;
    height: 100%;
    overflow: hidden;
  }

  .master-list .table-wrap {
    max-height: none;
  }

  .item-image-preview {
    width: 100%;
    max-width: 220px;
  }

  .processed-material-image-preview {
    max-width: 220px;
  }

  .processed-code-field,
  .processed-name-field,
  .processed-variable-field,
  .processed-stock-field,
  .processed-safety-stock-field,
  .processed-days-field,
  .processed-remarks-field {
    grid-column: 1 / -1;
  }

  .shop-sku-head,
  .material-head,
  .flow-head {
    display: none;
  }

  .icon-button {
    width: 100%;
  }
}
