:root {
  color-scheme: light;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  --bg: #f3f5f8;
  --panel: #ffffff;
  --head: #f5f7fa;
  --text: #1f2329;
  --muted: #7a8494;
  --line: #e5e8ef;
  --line-strong: #d8dde8;
  --primary: #2148f3;
  --primary-dark: #1839c7;
  --primary-soft: #eef2ff;
  --danger: #e34d59;
  --danger-dark: #c93542;
  --danger-soft: #fff1f2;
  --success: #52c41a;
  --warning: #faad14;
  --sidebar: #ffffff;
  --sidebar-active: #eaf2ff;
  --sidebar-hover: #f5f7fb;
  --sidebar-text: #344054;
  --sidebar-muted: #667085;
  --sidebar-width: 212px;
  --menu-item-height: 40px;
  --menu-item-radius: 6px;
  --btn-height: 34px;
  --btn-height-small: 28px;
  --btn-radius: 3px;
  --panel-radius: 6px;
  --table-row-hover: #f7faff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

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

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--btn-height);
  min-width: 64px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  padding: 0 14px;
  border-radius: var(--btn-radius);
  cursor: pointer;
  white-space: nowrap;
  line-height: 1;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
  user-select: none;
}

button:hover:not(:disabled) {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:focus-visible {
  outline: 2px solid rgb(33 72 243 / 18%);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

button.secondary {
  background: #fff;
  color: #3c4658;
  border-color: var(--line-strong);
}

button.secondary:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}

button.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

button.danger:hover:not(:disabled) {
  background: var(--danger-dark);
  border-color: var(--danger-dark);
}

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

button.secondary.danger:hover:not(:disabled) {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger-dark);
}

button.small {
  height: var(--btn-height-small);
  min-width: 52px;
  padding: 0 10px;
  font-size: 12px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
  outline: none;
}

input,
select {
  height: 34px;
}

input[type="color"] {
  width: 46px;
  min-width: 46px;
  padding: 2px;
  cursor: pointer;
}

textarea {
  min-height: 72px;
  padding-top: 8px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
}

label {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  color: #4e5969;
  font-size: 13px;
}

label.compact {
  grid-template-columns: minmax(0, 1fr);
}

.hidden {
  display: none !important;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 24px;
  display: grid;
  gap: 16px;
  box-shadow: 0 16px 40px rgb(31 35 41 / 8%);
}

.auth-brand {
  display: grid;
  gap: 4px;
}

.auth-brand strong {
  font-size: 24px;
}

.auth-brand span,
.muted {
  color: var(--muted);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auth-tab {
  background: #fff;
  border-color: var(--primary);
  color: var(--primary);
}

.auth-tab.active {
  background: var(--primary);
  color: #fff;
}

.auth-form {
  display: none;
  gap: 12px;
}

.auth-form.active {
  display: grid;
}

.auth-form label {
  grid-template-columns: 70px minmax(0, 1fr);
}

.captcha-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px auto;
  gap: 8px;
}

.captcha-image-button {
  min-width: 110px;
  padding: 0;
  overflow: hidden;
  background: #fff;
  border-color: var(--line-strong);
}

.captcha-image-button:hover:not(:disabled) {
  background: #fff;
  border-color: var(--primary);
}

.captcha-image-button img {
  display: block;
  width: 100%;
  height: 32px;
  object-fit: contain;
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  overflow: hidden;
}

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: grid;
  align-content: start;
  gap: 2px;
  padding: 12px 10px;
  overflow-y: auto;
}

.brand {
  height: 42px;
  display: flex;
  align-items: center;
  padding: 0 10px 12px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.nav,
.sub-nav-item {
  position: relative;
  justify-content: flex-start;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--sidebar-text);
  height: var(--menu-item-height);
  width: 100%;
  padding: 0 12px;
  text-align: left;
  border-radius: var(--menu-item-radius);
  font-size: 14px;
  font-weight: 400;
}

.nav:hover,
.sub-nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--primary);
  border-color: transparent;
}

.nav.active,
.sub-nav-item.active {
  background: var(--sidebar-active);
  color: var(--primary);
  border-color: transparent;
  font-weight: 500;
}

.nav.active::before,
.sub-nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 3px;
  height: 22px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
}

.group-title {
  margin-top: 6px;
  color: var(--sidebar-muted);
  font-weight: 600;
}

.group-title::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.16s ease;
}

.group-title.active,
.group-title:hover,
.group-title.active:hover {
  background: var(--sidebar-active);
  color: var(--primary);
  font-weight: 600;
}

.group-title.active::before {
  display: none;
}

.nav-group {
  display: grid;
  gap: 2px;
  margin: 0 0 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.nav-group.collapsed .group-title::after {
  transform: rotate(-45deg) translateY(1px);
}

.nav-group.collapsed .sub-nav-item {
  display: none;
}

.sub-nav-item {
  height: 38px;
  padding-left: 34px;
  font-size: 13px;
}

.sub-nav-item::after {
  content: "";
  position: absolute;
  left: 18px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #c8ced9;
}

.sub-nav-item:hover::after,
.sub-nav-item.active::after {
  background: var(--primary);
}

.sidebar button.nav:hover:not(:disabled),
.sidebar button.sub-nav-item:hover:not(:disabled) {
  background: var(--sidebar-hover);
  color: var(--primary);
  border-color: transparent;
}

.sidebar button.nav.active,
.sidebar button.nav.active:hover:not(:disabled),
.sidebar button.sub-nav-item.active,
.sidebar button.sub-nav-item.active:hover:not(:disabled) {
  background: var(--sidebar-active);
  color: var(--primary);
  border-color: transparent;
}

.sidebar button.group-title.active,
.sidebar button.group-title:hover:not(:disabled),
.sidebar button.group-title.active:hover:not(:disabled) {
  background: var(--sidebar-active);
  color: var(--primary);
}

.main {
  min-width: 0;
  min-height: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 16px 28px;
  overflow: hidden;
}

.topbar {
  flex: 0 0 52px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#viewTitle {
  font-size: 17px;
}

#userBadge {
  color: var(--muted);
  margin-left: 12px;
}

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

.message {
  padding: 10px 12px;
  border: 1px solid #ffe4a3;
  background: #fff7e6;
  margin-bottom: 12px;
}

.message.error {
  border-color: #ffc2c7;
  background: #fff1f2;
  color: var(--danger);
}

.view {
  display: none;
}

.view.active {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: auto;
}

#goods-list.view.active {
  flex: 1 1 auto;
  overflow: hidden;
}

.page-head {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
}

.page-head h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.page-head h2,
.view h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.filters,
.toolbar,
.batch-row,
.inline-form {
  display: flex;
  align-items: center;
  gap: 10px 12px;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
  padding: 14px 16px;
  box-shadow: 0 1px 2px rgb(15 23 42 / 3%);
}

.toolbar.right {
  justify-content: flex-end;
}

.filters label {
  grid-template-columns: max-content 168px;
  color: var(--sidebar-muted);
}

.product-filters label {
  grid-template-columns: max-content 176px;
}

.range-sep {
  color: var(--muted);
}

.tab-line {
  min-height: 44px;
  display: flex;
  align-items: end;
  gap: 26px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
  padding: 0 16px;
}

.text-tab {
  min-width: 0;
  border: 0;
  background: transparent;
  color: #273043;
  height: 42px;
  padding: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
}

.text-tab:hover,
.text-tab.active {
  background: transparent;
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-line button.text-tab:hover:not(:disabled),
.tab-line button.text-tab.active,
.tab-line button.text-tab.active:hover:not(:disabled) {
  background: transparent;
  color: var(--primary);
  border-color: transparent;
  border-bottom-color: var(--primary);
}

.category-panel {
  display: none !important;
}

.category-panel.active {
  display: block !important;
}

.category-panel.setting-form.active {
  display: grid !important;
}

.batch-row {
  color: var(--sidebar-muted);
  font-size: 13px;
  min-height: 44px;
}

.table-wrap {
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
  box-shadow: 0 1px 2px rgb(15 23 42 / 3%);
}

#goods-list .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--panel);
  min-width: 980px;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  text-align: left;
  vertical-align: middle;
}

.admin-table th {
  background: #f8fafc;
  color: #475467;
  font-weight: 600;
  font-size: 13px;
}

.admin-table tbody tr:hover td {
  background: var(--table-row-hover);
}

.admin-table tbody tr.clickable-row {
  cursor: pointer;
}

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

.admin-table input[type="checkbox"] {
  width: auto;
  height: auto;
}

.right-cell {
  text-align: right !important;
}

.row-actions {
  display: inline-flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px 12px;
  flex-wrap: wrap;
}

.link-btn {
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  height: 22px;
  padding: 0 2px;
  font-size: 13px;
}

.link-btn:hover:not(:disabled) {
  background: transparent;
  border-color: transparent;
  text-decoration: underline;
}

.danger-link {
  color: var(--danger);
}

.danger-link:hover:not(:disabled) {
  color: var(--danger-dark);
}

.product-cell {
  display: grid;
  grid-template-columns: 58px minmax(220px, 1fr);
  gap: 10px;
  align-items: center;
}

.thumb {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #f0f2f5;
}

.thumb.placeholder,
.logo-placeholder {
  display: inline-grid;
  place-items: center;
  color: #8792a2;
  background: #edf1f6;
}

.product-title {
  display: grid;
  gap: 4px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 3px;
  font-size: 12px;
  line-height: 1;
  border: 1px solid transparent;
}

.tag.green {
  background: #f0ffe9;
  border-color: #c9f2b8;
  color: var(--success);
}

.tag.red {
  background: #fff1f2;
  border-color: #ffc2c7;
  color: var(--danger);
}

.tag.gray {
  background: #f2f3f5;
  border-color: #e5e6eb;
  color: #667085;
}

.label-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 4px;
  background: var(--primary);
  color: #fff;
}

.message-timeline {
  display: grid;
  gap: 12px;
}

.message-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 12px 14px;
}

.message-item.admin {
  border-color: #c7d7fe;
  background: #f8fbff;
}

.message-item.system {
  border-color: #dde3ea;
  background: #f8fafc;
}

.message-item.internal {
  border-style: dashed;
  background: #fffaf0;
}

.message-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.message-meta strong {
  color: #1f2937;
  font-size: 13px;
}

.message-content {
  color: #273043;
  line-height: 1.6;
  white-space: pre-wrap;
}

.message-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.message-images img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f0f2f5;
}

.refund-workspace {
  display: grid;
  gap: 14px;
}

.refund-conversation {
  max-height: 320px;
  overflow: auto;
  padding-right: 4px;
}

.refund-reply-panel {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--panel-radius);
  background: #fff;
  box-shadow: 0 -8px 24px rgb(15 23 42 / 6%);
}

.inline-switch {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.inline-switch input {
  width: auto;
  height: auto;
}

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

.rich-toolbar button {
  min-width: 34px;
  font-weight: 600;
}

.rich-editor {
  min-height: 116px;
  max-height: 220px;
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  line-height: 1.7;
  outline: none;
}

.rich-editor:focus {
  border-color: var(--primary);
}

.rich-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
}

.goods-detail-rich {
  display: grid;
  gap: 10px;
}

.goods-detail-editor {
  min-height: 260px;
}

.goods-detail-editor img,
.message-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 8px 0;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.goods-detail-editor h2,
.goods-detail-editor h3 {
  margin: 12px 0 8px;
}

.reply-image-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.reply-image-item {
  width: 96px;
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.reply-image-item img {
  width: 82px;
  height: 82px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.logo-placeholder {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.sort-input {
  width: 96px;
}

.pager {
  display: flex;
  justify-content: flex-end;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
  padding: 10px 16px;
  color: var(--muted);
}

.editor-form,
.setting-form {
  display: grid;
  gap: 14px;
}

.form-section,
.setting-form,
.chart-band {
  background: var(--panel);
  padding: 16px;
  display: grid;
  gap: 14px;
}

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

.form-grid label,
.form-section > label,
.setting-form label {
  grid-template-columns: 110px minmax(0, 1fr);
}

.form-grid label:has(.image-upload-btn),
.form-section > label:has(.image-upload-btn),
.setting-form label:has(.image-upload-btn) {
  grid-template-columns: 110px minmax(0, 1fr) auto;
}

.color-field {
  grid-template-columns: 110px 46px max-content !important;
}

.color-value {
  align-self: center;
  color: var(--muted);
  font-size: 13px;
}

.color-swatches {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 110px;
}

.color-swatches button {
  width: 24px;
  min-width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--swatch);
  box-shadow: 0 0 0 1px var(--line-strong);
}

.color-swatches button.active {
  box-shadow: 0 0 0 2px var(--primary);
}

.color-swatches button:hover:not(:disabled) {
  background: var(--swatch);
  border-color: #fff;
}

.image-upload-btn {
  height: 30px;
  align-self: center;
  white-space: nowrap;
}

.carousel-manager {
  display: grid;
  gap: 10px;
}

.carousel-manager > label {
  grid-template-columns: 110px minmax(0, 1fr);
}

.carousel-toolbar {
  display: flex;
  gap: 8px;
  padding-left: 110px;
}

.carousel-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
  padding-left: 110px;
  min-height: 34px;
}

.carousel-item {
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  gap: 6px;
  padding: 6px;
}

.carousel-thumb {
  width: 100%;
  min-width: 0;
  height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.carousel-thumb:hover {
  background: transparent;
}

.carousel-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.carousel-item-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 12px;
}

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

.check-grid,
.attribute-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.check-grid label,
.inline-checks label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
}

.check-grid label {
  border: 1px solid var(--line);
  padding: 8px 10px;
}

.check-grid input,
.inline-checks input {
  width: auto;
  height: auto;
}

.inline-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.sku-table .admin-table {
  min-width: 1460px;
}

.sku-table input,
.sku-table select {
  min-width: 86px;
  padding: 0 8px;
}

.sku-table input[data-field="spec_text"],
.sku-table input[data-field="barcode"],
.sku-table input[data-field="sku_image"] {
  min-width: 140px;
}

.sku-table .image-upload-btn {
  margin-left: 6px;
}

.admin-dialog {
  width: min(720px, calc(100vw - 40px));
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 18px;
}

.admin-dialog::backdrop {
  background: rgb(15 23 42 / 35%);
}

.admin-dialog form {
  display: grid;
  gap: 16px;
}

.dialog-head {
  position: sticky;
  top: -18px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
  gap: 16px;
  margin: -18px -18px 0;
  padding: 14px 16px 10px 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.admin-dialog h2 {
  margin: 0;
  font-size: 17px;
}

.dialog-close {
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #667085;
  font-size: 22px;
  line-height: 1;
}

.dialog-close:hover:not(:disabled) {
  background: #f2f4f7;
  border-color: transparent;
  color: var(--text);
}

.wide-dialog {
  width: min(1120px, calc(100vw - 48px));
}

.dialog-body {
  display: grid;
  gap: 14px;
  max-height: 72vh;
  overflow: auto;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.detail-grid > div {
  display: grid;
  gap: 4px;
  padding: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
}

.order-goods-line {
  display: grid;
  gap: 2px;
}

.order-goods-line + .order-goods-line {
  margin-top: 6px;
}

.order-goods-line small {
  color: var(--muted);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  background: var(--panel);
  padding: 18px;
}

.metric {
  display: grid;
  gap: 8px;
  min-height: 74px;
}

.metric span {
  color: #4e5969;
}

.metric strong {
  font-size: 26px;
  font-weight: 500;
}

.line-chart {
  height: 260px;
  position: relative;
  background:
    linear-gradient(to bottom, transparent 24%, var(--line) 25%, transparent 26%),
    linear-gradient(to bottom, transparent 49%, var(--line) 50%, transparent 51%),
    linear-gradient(to bottom, transparent 74%, var(--line) 75%, transparent 76%);
}

.line-chart::before {
  content: "";
  position: absolute;
  inset: 30px 40px 42px;
  border-left: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.line-chart svg {
  position: absolute;
  inset: 30px 40px 42px;
  width: calc(100% - 80px);
  height: calc(100% - 72px);
  overflow: visible;
}

.setting-panel {
  display: none;
  gap: 14px;
}

.setting-panel.active {
  display: grid;
}

.code-block {
  margin: 0;
  padding: 14px;
  min-height: 160px;
  background: #111827;
  color: #dbeafe;
  overflow: auto;
}

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

.detail-section:last-child {
  margin-bottom: 0;
}

.detail-section h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.detail-kv-table,
.detail-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
}

.detail-kv-table th,
.detail-kv-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  vertical-align: top;
  font-size: 13px;
}

.detail-kv-table th {
  width: 132px;
  background: var(--bg-soft);
  color: var(--muted);
  font-weight: 500;
  text-align: left;
}

.detail-kv-table tr:last-child th,
.detail-kv-table tr:last-child td {
  border-bottom: 0;
}

.detail-table-wrap {
  border: 0;
  box-shadow: none;
}

.detail-table th,
.detail-table td {
  font-size: 13px;
  padding: 10px 12px;
}

.ship-form {
  display: grid;
  gap: 14px;
}

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

.ship-summary > div,
.ship-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--panel-radius);
}

.ship-summary > div {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
}

.ship-summary span,
.ship-item-main span,
.ship-item-main small,
.ship-item-count small {
  color: var(--muted);
}

.ship-summary strong {
  font-size: 15px;
}

.ship-panel {
  display: grid;
  overflow: hidden;
}

.ship-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
}

.ship-panel-head h3 {
  margin: 0;
  font-size: 14px;
}

.ship-check-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.ship-check-all input,
.ship-item input {
  width: auto;
  min-width: 0;
  height: auto;
}

.ship-receiver {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 14px;
}

.ship-receiver p {
  flex-basis: 100%;
  margin: 0;
  color: var(--muted);
}

.ship-items {
  display: grid;
}

.ship-item {
  display: grid;
  grid-template-columns: 18px 54px minmax(220px, 1fr) minmax(88px, auto);
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.ship-item:last-child {
  border-bottom: 0;
}

.ship-item-image {
  width: 54px;
  height: 54px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  overflow: hidden;
}

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

.ship-item-main {
  display: grid;
  gap: 4px;
}

.ship-item-count {
  display: grid;
  gap: 4px;
  text-align: right;
}

.ship-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 12px;
  padding: 14px;
}

.ship-fields label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

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

.ship-actions {
  position: sticky;
  bottom: -18px;
  z-index: 3;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 0 -18px -18px;
  padding: 12px 18px;
  background: #fff;
  border-top: 1px solid var(--line);
}

.changed-row td {
  background: #fff7ed;
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .sidebar {
    grid-auto-flow: column;
    overflow-x: auto;
    align-items: center;
    padding: 8px;
  }

  .nav-group {
    grid-auto-flow: column;
    display: grid;
    border-bottom: 0;
    padding-bottom: 0;
    margin-bottom: 0;
  }

  .sub-nav-item {
    padding-left: 18px;
  }

  .sub-nav-item::after,
  .nav.active::before,
  .sub-nav-item.active::before {
    display: none;
  }

  .main {
    display: block;
    overflow: visible;
    padding: 0 10px 20px;
  }

  .view,
  #goods-list.view.active {
    height: auto;
    overflow: visible;
  }

  .page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .filters label,
  .product-filters label,
  .inline-form label,
  .form-grid label,
  .form-section > label,
  .setting-form label {
    grid-template-columns: 1fr;
  }

  .filters button,
  .toolbar button,
  .batch-row button,
  .inline-form button {
    width: 100%;
  }

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

  .captcha-row {
    grid-template-columns: 1fr 110px;
  }

  .captcha-row .secondary {
    grid-column: 1 / -1;
  }
}
