:root {
  --bg: #f4efe8;
  --surface: rgba(255, 255, 255, 0.88);
  --ink: #152033;
  --subtle: #6c7688;
  --line: rgba(21, 32, 51, 0.08);
  --brand: #0f766e;
  --brand-strong: #115e59;
  --accent: #d97706;
  --danger: #b42318;
  --shadow: 0 18px 40px rgba(39, 49, 66, 0.08);
  --radius: 20px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.16), transparent 24%),
    radial-gradient(circle at left bottom, rgba(217, 119, 6, 0.12), transparent 28%),
    linear-gradient(180deg, #fbf6ef 0%, #f1ece6 100%);
}

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

button {
  cursor: pointer;
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  background: var(--brand);
  color: #fff;
  transition: transform 0.16s ease, opacity 0.16s ease, background 0.16s ease;
}

button:hover {
  transform: translateY(-1px);
}

button.secondary {
  background: #eef3f2;
  color: var(--brand-strong);
}

button.warn {
  background: var(--accent);
}

button.danger {
  background: var(--danger);
}

button.ghost {
  background: transparent;
  color: var(--brand);
  border: 1px solid rgba(15, 118, 110, 0.25);
}

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

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(21, 32, 51, 0.12);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

.login-shell,
.app-shell {
  min-height: 100vh;
}

.login-shell {
  display: grid;
  place-items: center;
  padding: 32px;
}

.login-card {
  width: min(460px, 100%);
  padding: 30px;
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.1);
  color: var(--brand-strong);
  font-size: 13px;
}

.login-card h1,
.section-title h2 {
  margin: 18px 0 10px;
  font-size: 30px;
  line-height: 1.1;
}

.muted {
  color: var(--subtle);
}

.tip-box {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: #f7faf9;
  border: 1px solid rgba(15, 118, 110, 0.12);
}

.field-grid {
  display: grid;
  gap: 14px;
}

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

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

.field label {
  font-size: 13px;
  color: var(--subtle);
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  padding: 18px;
}

.sidebar,
.page-panel,
.card,
.detail-card,
.table-card {
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.sidebar {
  border-radius: 28px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand-card {
  padding: 18px;
  border-radius: 22px;
  color: #fff;
  background: linear-gradient(135deg, #115e59 0%, #0f766e 55%, #d97706 100%);
}

.brand-card h1 {
  margin: 10px 0 6px;
  font-size: 26px;
}

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

.nav-item {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-radius: 16px;
  background: transparent;
  color: var(--ink);
}

.nav-item.active {
  background: rgba(15, 118, 110, 0.11);
  color: var(--brand-strong);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.page-panel {
  border-radius: 28px;
  padding: 22px;
  overflow: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.page-grid {
  display: grid;
  gap: 18px;
}

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

.card,
.detail-card,
.table-card {
  border-radius: 24px;
  padding: 18px;
}

.metric-card {
  position: relative;
  overflow: hidden;
}

.metric-card::after {
  content: "";
  position: absolute;
  inset: auto -32px -36px auto;
  width: 120px;
  height: 120px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.08);
}

.metric-label {
  font-size: 13px;
  color: var(--subtle);
}

.metric-value {
  margin-top: 10px;
  font-size: 34px;
  font-weight: 700;
}

.grid-two {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 18px;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}

th {
  color: var(--subtle);
  font-weight: 600;
}

tr[data-clickable="true"] {
  cursor: pointer;
}

tr[data-clickable="true"]:hover {
  background: rgba(15, 118, 110, 0.05);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.1);
  color: var(--brand-strong);
  font-size: 12px;
}

.status-chip.warn {
  background: rgba(217, 119, 6, 0.12);
  color: #8a5600;
}

.status-chip.danger {
  background: rgba(180, 35, 24, 0.12);
  color: var(--danger);
}

.split-panel {
  display: grid;
  grid-template-columns: 1.15fr 0.9fr;
  gap: 18px;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.chart {
  display: flex;
  gap: 10px;
  align-items: end;
  min-height: 200px;
  padding-top: 10px;
}

.bar-wrap {
  flex: 1;
  display: grid;
  gap: 8px;
  justify-items: center;
}

.bar {
  width: 100%;
  max-width: 34px;
  border-radius: 999px 999px 10px 10px;
  background: linear-gradient(180deg, #0f766e 0%, #14b8a6 100%);
  min-height: 10px;
}

.bar.alt {
  background: linear-gradient(180deg, #d97706 0%, #f59e0b 100%);
}

.bar-label {
  font-size: 12px;
  color: var(--subtle);
}

.stack {
  display: grid;
  gap: 10px;
}

.stack.tight {
  gap: 6px;
}

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

.empty-state {
  padding: 30px 18px;
  text-align: center;
  color: var(--subtle);
}

.flash {
  padding: 14px 16px;
  border-radius: 16px;
  margin-bottom: 14px;
  background: rgba(15, 118, 110, 0.1);
  color: var(--brand-strong);
}

.flash.error {
  background: rgba(180, 35, 24, 0.12);
  color: var(--danger);
}

.page-block {
  margin-top: 18px;
}

.product-workspace {
  align-items: start;
}

.product-editor-card {
  max-height: calc(100vh - 120px);
  overflow: auto;
}

.import-card,
.editor-section {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(247, 250, 249, 0.72);
}

.field-tip {
  font-size: 12px;
  color: var(--subtle);
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.image-chip {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 14px;
  text-decoration: none;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
}

.image-chip img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  background: #f1f5f9;
}

.image-chip span {
  font-size: 12px;
  color: var(--subtle);
  word-break: break-all;
}

.source-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  margin-top: 14px;
}

.source-card div {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
}

.source-card strong {
  font-size: 12px;
  color: var(--subtle);
}

.editor-table {
  min-width: 1180px;
}

.editor-table input,
.editor-table select,
.editor-table textarea {
  min-width: 110px;
  padding: 10px 12px;
}

.editor-table textarea {
  min-height: 74px;
}

.table-actions {
  white-space: nowrap;
}

.field-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.product-list-panel {
  display: grid;
  align-content: start;
}

.product-list-stack {
  display: grid;
  gap: 14px;
}

.product-list-item {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  cursor: pointer;
}

.product-list-item.active {
  border-color: rgba(15, 118, 110, 0.35);
  box-shadow: 0 10px 30px rgba(15, 118, 110, 0.08);
}

.product-list-main {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.product-list-thumb {
  width: 76px;
  height: 76px;
  border-radius: 16px;
  overflow: hidden;
  background: #f4f7f6;
  border: 1px solid var(--line);
}

.product-list-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-list-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--subtle);
}

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

.image-editor-list,
.property-editor-grid,
.sku-editor-grid {
  display: grid;
  gap: 14px;
}

.image-editor-item,
.property-editor-item,
.sku-editor-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.92);
}

.image-editor-item {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.image-editor-preview,
.sku-editor-preview {
  width: 120px;
  height: 120px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f4f7f6;
}

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

.image-editor-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--subtle);
  font-size: 13px;
}

.image-editor-body {
  display: grid;
  gap: 10px;
  align-content: start;
}

.property-editor-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.sku-editor-card {
  display: grid;
  gap: 14px;
}

.sku-editor-header {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 14px;
}

.sku-editor-fields {
  display: grid;
  gap: 12px;
}

@media (max-width: 1200px) {
  .app-shell,
  .split-panel,
  .grid-two {
    grid-template-columns: 1fr;
  }

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

  .source-card {
    grid-template-columns: 1fr;
  }

  .field-grid.three,
  .field-grid.four,
  .property-editor-item {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 10px;
  }

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

  .page-panel,
  .sidebar {
    border-radius: 22px;
    padding: 16px;
  }

  .product-list-main,
  .image-editor-item,
  .sku-editor-header {
    grid-template-columns: 1fr;
  }

  .image-editor-preview,
  .sku-editor-preview,
  .product-list-thumb {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }
}
