:root {
  color-scheme: light;
  font-family:
    Inter,
    "PingFang SC",
    "Microsoft YaHei",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: #f5f2eb;
  color: #27231f;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  min-width: 0;
  background: #f5f2eb;
}

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

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(34, 32, 29, 0.78);
}

.login-screen.hidden {
  display: none;
}

.login-panel {
  display: grid;
  width: 360px;
  gap: 16px;
  padding: 24px;
  border: 1px solid #e0d7c8;
  border-radius: 8px;
  background: #fffaf3;
  box-shadow: 0 18px 50px rgba(34, 32, 29, 0.24);
}

.login-panel .brand {
  margin-bottom: 4px;
  color: #27231f;
}

.login-panel .brand span:not(.brand-mark) {
  color: #746c60;
}

.login-panel label {
  display: grid;
  gap: 6px;
  color: #746c60;
  font-size: 12px;
  font-weight: 700;
}

.login-panel input {
  height: 40px;
  padding: 0 10px;
  border: 1px solid #d9d0c0;
  border-radius: 8px;
  background: #ffffff;
  color: #27231f;
  outline: 0;
}

#login-message {
  min-height: 18px;
  color: #b3413c;
  font-size: 13px;
}

.shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-height: 0;
  overflow: auto;
  padding: 24px 18px;
  background: #22201d;
  color: #fffaf0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: #fffaf0;
  box-shadow: 0 0 0 1px rgba(247, 200, 95, 0.42);
  overflow: hidden;
}

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

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 2px;
  color: #cfc7b5;
  font-size: 12px;
}

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

.nav-item {
  width: 100%;
  padding: 11px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #d8d0bf;
  text-align: left;
  cursor: pointer;
}

.nav-item.active {
  background: #fffaf0;
  color: #22201d;
  font-weight: 700;
}

.nav-item:disabled {
  cursor: default;
  opacity: 0.45;
}

.workspace {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
  min-height: 0;
  height: 100dvh;
  overflow: hidden;
  padding: 24px 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-width: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.2;
}

#sync-status {
  margin-top: 6px;
  color: #746c60;
  font-size: 13px;
}

#sync-status[data-tone="ok"] {
  color: #2f7a4f;
}

#sync-status[data-tone="error"] {
  color: #b3413c;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.api-base {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 10px;
  border: 1px solid #d9d0c0;
  border-radius: 8px;
  background: #fffaf3;
  min-width: 0;
}

.api-base span {
  color: #746c60;
  font-size: 12px;
  font-weight: 700;
}

.api-base input {
  width: 220px;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #27231f;
}

.primary-action {
  height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  background: #2f6f62;
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

.secondary-action {
  height: 40px;
  padding: 0 14px;
  border: 1px solid #d9d0c0;
  border-radius: 8px;
  background: #fffaf3;
  color: #4d463d;
  font-weight: 700;
  cursor: pointer;
}

.secondary-action.danger {
  border-color: #d9b8b4;
  background: #fff4f1;
  color: #9a3c34;
}

.compact-action {
  height: 38px;
  padding: 0 14px;
  white-space: nowrap;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(132px, 1fr));
  gap: 12px;
}

.metric {
  padding: 16px;
  border: 1px solid #e0d7c8;
  border-radius: 8px;
  background: #fffaf3;
}

.metric span {
  display: block;
  color: #746c60;
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
  line-height: 1;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 38vw);
  gap: 16px;
  height: 100%;
  min-height: 0;
}

.content-grid.hidden {
  display: none;
}

.list-pane,
.detail-pane {
  min-height: 0;
  border: 1px solid #e0d7c8;
  border-radius: 8px;
  background: #fffaf3;
  overflow: hidden;
}

.list-pane {
  display: flex;
  flex-direction: column;
}

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid #e8dfd0;
}

.recommend-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 48px;
  padding: 10px 14px;
  border-bottom: 1px solid #e8dfd0;
  background: #fffdf8;
}

.recommend-summary-head {
  display: grid;
  gap: 3px;
  min-width: 160px;
}

.recommend-summary-head strong {
  color: #27231f;
  font-size: 13px;
}

.recommend-summary-head span,
.recommend-empty {
  color: #746c60;
  font-size: 12px;
}

.recommend-summary-list {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
}

.recommend-chip {
  max-width: 180px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid #ead7a6;
  border-radius: 999px;
  background: #fff7de;
  color: #6e4811;
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  flex: none;
}

.recommend-chip.active {
  border-color: #c49a34;
  background: #f1c75f;
  color: #2d2619;
}

.bulk-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 52px;
  padding: 10px 14px;
  border-bottom: 1px solid #e8dfd0;
  background: #fffdf8;
}

.bulk-bar span,
.check-action {
  color: #746c60;
  font-size: 12px;
  font-weight: 700;
}

.check-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.check-col {
  width: 44px;
  min-width: 44px;
  text-align: center;
}

.check-col input {
  width: 16px;
  height: 16px;
}

.search-box {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid #d9d0c0;
  border-radius: 8px;
  background: #ffffff;
  min-width: 220px;
}

.search-box span {
  color: #877e70;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
}

select {
  height: 38px;
  padding: 0 32px 0 10px;
  border: 1px solid #d9d0c0;
  border-radius: 8px;
  background: #ffffff;
  color: #27231f;
}

.segments {
  display: inline-grid;
  grid-template-columns: repeat(4, 58px);
  padding: 3px;
  border: 1px solid #d9d0c0;
  border-radius: 8px;
  background: #ffffff;
}

.segment {
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #655d52;
  cursor: pointer;
}

.segment.active {
  background: #f1c75f;
  color: #2d2619;
  font-weight: 700;
}

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

#operations-panel {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid #eee4d6;
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fffaf3;
  color: #746c60;
  font-size: 12px;
  font-weight: 700;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.selected {
  background: #f8efd9;
}

.product-cell {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 300px;
}

.product-cell img {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  background: #eadfcf;
}

.product-cell strong,
.product-cell span {
  display: block;
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-cell strong {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: #f9ebc7;
  color: #8a5a13;
  font-size: 12px;
  font-weight: 700;
  flex: none;
}

.product-cell span {
  margin-top: 4px;
  color: #746c60;
  font-size: 12px;
}

.order-cell {
  display: grid;
  gap: 4px;
  min-width: 220px;
}

.order-cell.compact {
  min-width: 130px;
}

.order-cell strong,
.order-cell span {
  display: block;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-cell span,
.muted {
  color: #746c60;
  font-size: 12px;
}

.money-cell {
  font-weight: 800;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge-live {
  background: #dff0df;
  color: #21633f;
}

.badge-paused {
  background: #f2ded9;
  color: #9a3c34;
}

.badge-warn {
  background: #f9ebc7;
  color: #8a5a13;
}

.badge-info {
  background: #dcebe8;
  color: #265c63;
}

.empty-row,
.empty-detail {
  padding: 48px 20px;
  color: #877e70;
  text-align: center;
}

.detail-pane {
  min-height: 0;
  height: 100%;
  overflow: auto;
}

.detail-hero {
  position: relative;
  height: 230px;
  background: #eadfcf;
}

.detail-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-hero .badge {
  position: absolute;
  right: 14px;
  bottom: 14px;
}

.detail-body {
  padding: 18px;
}

.order-detail-head {
  display: grid;
  gap: 8px;
  padding: 18px;
  border-bottom: 1px solid #eadfcf;
  background: #f8efd9;
}

.order-detail-head span {
  color: #746c60;
  font-size: 12px;
  font-weight: 700;
}

.order-detail-head h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 21px;
  line-height: 1.2;
}

.order-detail-head .badge {
  justify-self: start;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.detail-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: #2f6f62;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.detail-action.danger {
  background: #b3413c;
}

.detail-action.secondary {
  background: #5f6c77;
}

.detail-action:disabled,
.detail-action.is-busy {
  cursor: progress;
  opacity: 0.72;
}

.detail-body h2 {
  font-size: 20px;
  line-height: 1.25;
}

.detail-body p {
  margin-top: 8px;
  color: #746c60;
  line-height: 1.55;
}

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

.detail-form-head h2,
.form-section-head h3 {
  margin: 0;
}

.form-section-head h3 {
  font-size: 16px;
  line-height: 1.25;
}

.form-section-head p {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.45;
}

.product-editor {
  padding: 0;
  background: #fffaf3;
}

.product-editor-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid #eadfcf;
  background: #fffaf3;
}

.product-editor-head img {
  width: 76px;
  aspect-ratio: 1;
  border: 1px solid #eadfcf;
  border-radius: 8px;
  object-fit: cover;
  background: #eadfcf;
}

.product-editor-head .detail-form-head {
  margin-bottom: 0;
}

.product-editor-head h2 {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.product-editor-head p {
  display: -webkit-box;
  margin-top: 8px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.product-editor-section {
  padding: 18px;
  border-bottom: 1px solid #eadfcf;
}

.product-form {
  display: grid;
  gap: 0;
}

.product-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.product-form label,
.sku-editor-row label {
  display: grid;
  gap: 5px;
}

.product-form .span-2,
.product-form-grid .span-2 {
  grid-column: 1 / -1;
}

.product-form-grid > label:not(.span-2) {
  grid-column: span 2;
}

.product-main-image {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid #eadfcf;
  border-radius: 8px;
  background: #fffdf8;
}

.product-main-image img {
  width: 112px;
  aspect-ratio: 1;
  border: 1px solid #eadfcf;
  border-radius: 8px;
  object-fit: cover;
  background: #eadfcf;
}

.product-main-image-fields {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.image-uploader {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid #eadfcf;
  border-radius: 8px;
  background: #fffdf8;
}

.image-uploader img {
  width: 96px;
  aspect-ratio: 1;
  border-radius: 8px;
  object-fit: cover;
  background: #eadfcf;
}

.upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.product-form-grid > .upload-row {
  margin-top: 0;
  padding: 2px 0;
}

.file-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-action {
  display: inline-flex;
  align-items: center;
}

.upload-action input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-button span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  background: #5f6c77;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.upload-note {
  color: #877e70;
  font-size: 12px;
}

.detail-image-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0;
}

.detail-image-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  padding: 10px;
  border: 1px solid #eadfcf;
  border-radius: 8px;
  background: #fffdf8;
}

.detail-image-row img {
  width: 84px;
  aspect-ratio: 1;
  border-radius: 8px;
  object-fit: cover;
  background: #eadfcf;
}

.detail-image-fields {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.detail-image-row input {
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid #d9d0c0;
  border-radius: 8px;
  background: #ffffff;
  color: #27231f;
}

.inline-add {
  margin-top: 2px;
}

.product-form em,
.sku-editor-row em {
  color: #746c60;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.product-form input,
.product-form select,
.product-form textarea,
.sku-editor-row input,
.sku-editor-row select {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #d9d0c0;
  border-radius: 8px;
  background: #fffdf8;
  color: #27231f;
}

.product-form textarea {
  min-height: 82px;
  resize: vertical;
}

.product-form label:focus-within em,
.sku-editor-row label:focus-within em {
  color: #2f6f62;
}

.sku-editor-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.sku-editor-row {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid #eadfcf;
  border-radius: 8px;
  background: #fffdf8;
}

.sku-editor-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.sku-editor-row-head strong {
  overflow: hidden;
  color: #27231f;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sku-editor-fields {
  display: grid;
  grid-template-columns:
    minmax(80px, 0.9fr) minmax(90px, 1fr) minmax(78px, 0.8fr)
    minmax(126px, 1.35fr);
  gap: 10px;
}

.sku-editor-fields label {
  min-width: 0;
}

.product-editor-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  justify-content: flex-end;
  margin-top: 0;
  padding: 12px 16px;
  border-top: 1px solid #eadfcf;
  background: rgba(255, 250, 243, 0.96);
  box-shadow: 0 -10px 24px rgba(39, 35, 31, 0.08);
}

.product-editor-actions .detail-action {
  min-width: 112px;
}

.sku-editor-row.is-deleted {
  display: none;
}

dl {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

dl div {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 10px;
}

dt {
  color: #877e70;
  font-size: 12px;
}

dd {
  margin: 0;
  line-height: 1.45;
}

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

.sku-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px 104px;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid #eadfcf;
  border-radius: 8px;
  background: #fffdf8;
}

.sku-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sku-row em {
  color: #746c60;
  font-size: 12px;
  font-style: normal;
  text-align: right;
}

.sku-row label {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}

.sku-row input {
  width: 100%;
  height: 30px;
  padding: 0 6px;
  border: 1px solid #d9d0c0;
  border-radius: 8px;
  background: #ffffff;
  text-align: right;
}

.order-items {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.order-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 72px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #eadfcf;
  border-radius: 8px;
  background: #fffdf8;
}

.order-item img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: #eadfcf;
}

.order-item strong,
.order-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-item span {
  margin-top: 4px;
  color: #746c60;
  font-size: 12px;
}

.order-item em {
  font-style: normal;
  font-weight: 800;
  text-align: right;
}

.review-image-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.review-image-list a {
  display: block;
  border: 1px solid #eadfcf;
  border-radius: 8px;
  overflow: hidden;
  background: #fffdf8;
}

.review-image-list img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.compact-empty {
  grid-column: 1 / -1;
  padding: 24px 12px;
}

.amount-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #eadfcf;
}

.amount-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #746c60;
}

.amount-list strong {
  color: #27231f;
}

.amount-list .total {
  color: #27231f;
  font-size: 18px;
  font-weight: 800;
}

.settings-stack {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.settings-block h2 {
  margin: 0 0 12px;
  font-size: 16px;
}

.settings-hint {
  margin: -4px 0 12px;
  color: #746c60;
  font-size: 12px;
  line-height: 1.45;
}

.ops-card-list {
  display: grid;
  gap: 10px;
}

.ops-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px 10px;
  align-items: center;
  width: 100%;
  padding: 10px;
  border: 1px solid #eadfcf;
  border-radius: 8px;
  background: #fffdf8;
  color: #27231f;
  text-align: left;
  cursor: pointer;
}

.ops-card.has-media {
  grid-template-columns: 58px minmax(0, 1fr);
}

.ops-card.selected,
.ops-card:hover {
  border-color: #d1b564;
  background: #f8efd9;
}

.ops-card img {
  grid-row: span 2;
  width: 58px;
  aspect-ratio: 1.45;
  border-radius: 8px;
  object-fit: cover;
  background: #eadfcf;
}

.ops-card strong,
.ops-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ops-card span {
  color: #746c60;
  font-size: 12px;
}

.operation-preview-image {
  display: block;
  width: 100%;
  aspect-ratio: 2.4;
  margin-bottom: 14px;
  border: 1px solid #eadfcf;
  border-radius: 8px;
  object-fit: cover;
  background: #eadfcf;
}

.notice-preview {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #eadfcf;
  border-radius: 8px;
  background: #fffdf8;
}

.notice-preview span {
  color: #746c60;
  line-height: 1.45;
}

.operation-form,
.after-sale-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 1180px) {
  .workspace {
    padding: 20px;
  }

  .metrics {
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  }

  .content-grid {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 34vw);
  }

  .detail-image-list,
  .review-image-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  html,
  body {
    height: auto;
    overflow: auto;
  }

  .shell {
    display: block;
    min-height: 100dvh;
    height: auto;
    overflow: visible;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid rgba(255, 250, 240, 0.12);
  }

  .sidebar .brand {
    padding: 0 2px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
    min-width: 72px;
    padding: 9px 14px;
    text-align: center;
    white-space: nowrap;
  }

  .workspace {
    display: grid;
    grid-template-rows: auto auto auto;
    height: auto;
    min-height: 0;
    overflow: visible;
    padding: 16px;
  }

  .topbar {
    display: grid;
    gap: 12px;
  }

  h1 {
    font-size: 22px;
  }

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

  .api-base {
    width: 100%;
  }

  .api-base input {
    width: 100%;
  }

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

  .metric {
    padding: 12px;
  }

  .metric strong {
    font-size: 24px;
  }

  .content-grid {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    overflow: visible;
  }

  .list-pane,
  .detail-pane {
    min-height: 0;
    overflow: visible;
  }

  .table-wrap,
  #operations-panel,
  .detail-pane {
    max-height: none;
    overflow: auto;
  }

  .table-wrap {
    flex: none;
  }

  .detail-pane {
    height: auto;
  }

  .toolbar,
  .bulk-bar,
  .recommend-summary {
    align-items: stretch;
  }

  .toolbar > *,
  .bulk-bar > .compact-action {
    flex: 1 1 auto;
  }

  .search-box {
    flex-basis: 100%;
    min-width: 0;
  }

  select,
  .compact-action,
  .primary-action,
  .secondary-action {
    min-width: max-content;
  }

  .recommend-summary {
    display: grid;
    gap: 8px;
  }

  .recommend-summary-head {
    min-width: 0;
  }

  .product-form-grid,
  .operation-form,
  .after-sale-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .product-form-grid > label:not(.span-2),
  .product-form .span-2,
  .product-form-grid .span-2 {
    grid-column: 1 / -1;
  }

  .product-editor-head,
  .product-main-image,
  .image-uploader,
  .detail-image-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .product-editor-head img,
  .product-main-image img,
  .image-uploader img,
  .detail-image-row img {
    width: min(100%, 180px);
  }

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

@media (max-width: 560px) {
  .login-panel {
    width: min(360px, calc(100vw - 32px));
    padding: 20px;
  }

  .workspace {
    gap: 12px;
    padding: 12px;
  }

  .topbar-actions > button,
  .toolbar > button,
  .bulk-bar > button {
    flex: 1 1 140px;
  }

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

  table {
    min-width: 620px;
  }

  .product-cell {
    min-width: 240px;
  }

  .order-cell {
    min-width: 180px;
  }

  .order-item,
  .sku-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .order-item em,
  .sku-row em {
    text-align: left;
  }

  dl div {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
  }

  .sku-editor-fields {
    grid-template-columns: minmax(0, 1fr);
  }
}

.history-block {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.history-block h3 {
  margin: 0;
  font-size: 15px;
}

.history-row {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 10px;
  border: 1px solid #eadfcf;
  border-radius: 8px;
  background: #fffdf8;
  color: #27231f;
  text-align: left;
  cursor: pointer;
}

.history-row.static {
  cursor: default;
}

.history-row span {
  color: #746c60;
  font-size: 12px;
  line-height: 1.4;
}

.settings-block input,
.settings-block select {
  width: 100%;
  min-width: 96px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid #d9d0c0;
  border-radius: 8px;
  background: #ffffff;
}

.settings-block textarea {
  min-height: 72px;
}
