:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background: #f5f7f8;
  color: #1f2933;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

body.is-loading {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid #c9d3dc;
  background: #fff;
  color: #1f2933;
  border-radius: 6px;
  padding: 7px 12px;
  cursor: pointer;
}

button:hover {
  border-color: #1976a2;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.primary {
  background: #1976a2;
  color: #fff;
  border-color: #1976a2;
  min-width: 112px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px 28px;
  background: #ffffff;
  border-bottom: 1px solid #d9e1e7;
}

.app-header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.app-header p {
  margin: 6px 0 0;
  color: #647380;
  font-size: 14px;
}

main {
  max-width: 1360px;
  margin: 0 auto;
  padding: 18px 24px 40px;
}

.section {
  margin-top: 16px;
  padding: 18px;
  background: #fff;
  border: 1px solid #dce4ea;
  border-radius: 8px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.section-note {
  color: #647380;
  font-size: 14px;
}

h2,
h3 {
  margin: 0;
  font-weight: 700;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 16px;
  margin-bottom: 10px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  border: 1px solid #d8e0e6;
  padding: 8px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  background: #edf3f6;
  font-weight: 700;
}

td input {
  width: 100%;
  min-width: 90px;
  border: 1px solid #c9d3dc;
  border-radius: 4px;
  padding: 7px 8px;
}

.action-col {
  width: 88px;
}

.params-grid,
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}

.params-grid label {
  display: grid;
  gap: 6px;
  font-weight: 700;
  color: #344450;
}

.params-grid input {
  border: 1px solid #c9d3dc;
  border-radius: 6px;
  padding: 9px 10px;
}

.params-grid select {
  border: 1px solid #c9d3dc;
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
}

.strategy-panel {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #d8e0e6;
}

.strategy-grid {
  margin-top: 10px;
}

.checkbox-label {
  align-content: end;
  grid-template-columns: auto 1fr;
  display: grid;
  gap: 8px;
}

.checkbox-label input {
  width: auto;
  min-width: 0;
}

.field-help {
  margin: 10px 0 0;
  color: #647380;
  font-size: 13px;
}

.size-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 42px;
  align-items: center;
}

.size-chip {
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff;
}

.size-chip.is-selected {
  background: #1976a2;
  border-color: #1976a2;
  color: #fff;
}

.size-chip:disabled {
  background: #eef2f5;
  color: #8a97a3;
}

.summary-card {
  border: 1px solid #d8e0e6;
  border-radius: 8px;
  padding: 12px;
  background: #f8fafb;
}

.summary-card span {
  display: block;
  color: #647380;
  font-size: 13px;
  margin-bottom: 6px;
}

.summary-card strong {
  font-size: 20px;
}

.result-block {
  margin-top: 18px;
}

.result-title-inline {
  display: inline-block;
  margin-right: 12px;
}

.result-actions {
  display: inline-flex;
  gap: 8px;
  margin-bottom: 10px;
  vertical-align: middle;
}

.result-block.is-collapsed .table-wrap {
  display: none;
}

.color-group {
  border: 1px solid #d8e0e6;
  border-radius: 8px;
  padding: 14px;
  margin-top: 14px;
  background: #fbfcfd;
}

.color-group-header,
.subsection-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.color-group-header h3,
.subsection-title h4 {
  margin: 0;
}

.params-grid.compact {
  margin-bottom: 14px;
}

.color-name-row {
  max-width: 360px;
  margin-bottom: 14px;
}

.color-name-row label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.color-name-row input {
  border: 1px solid #c9d3dc;
  border-radius: 6px;
  padding: 9px 10px;
}

.message {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid #e2b75d;
  background: #fff8e6;
  color: #724c00;
}

.warnings {
  margin: 0;
  padding-left: 18px;
}

.warnings li {
  margin: 6px 0;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: rgba(20, 32, 42, 0.42);
}

.loading-overlay[hidden] {
  display: none;
}

.loading-panel {
  width: min(420px, calc(100vw - 32px));
  border-radius: 8px;
  background: #fff;
  border: 1px solid #d8e0e6;
  box-shadow: 0 18px 50px rgba(20, 32, 42, 0.22);
  padding: 22px;
}

.loading-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.loading-subtitle {
  color: #647380;
  margin-bottom: 16px;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: #dce7ec;
}

.progress-bar {
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: #1976a2;
  animation: indeterminate 1.1s ease-in-out infinite;
}

@keyframes indeterminate {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(260%);
  }
}

.empty {
  color: #7a8792;
}

@media (max-width: 760px) {
  .app-header {
    align-items: stretch;
    flex-direction: column;
    padding: 16px;
  }

  main {
    padding: 12px;
  }

  .params-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }
}
