:root {
  color-scheme: light;
  --ink: #16212b;
  --muted: #66717b;
  --subtle: #8c969e;
  --line: #dfe5e8;
  --line-strong: #cdd6db;
  --surface: #ffffff;
  --canvas: #f4f7f8;
  --accent: #087f8c;
  --accent-dark: #076571;
  --accent-soft: #e5f4f4;
  --warning: #a35d18;
  --warning-soft: #fff4e6;
  --danger: #b33f3f;
  --shadow: 0 14px 40px rgba(26, 44, 56, 0.07);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--canvas);
  font-size: 14px;
  line-height: 1.5;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

.app-shell {
  width: min(1380px, calc(100% - 48px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0 20px;
}

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

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid #acd9da;
  border-radius: 9px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.eyebrow,
.section-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin: 1px 0 0;
  font-size: clamp(21px, 2.1vw, 28px);
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  margin: 4px 0 0;
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: 0;
}

.topbar-note {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2e9a75;
  box-shadow: 0 0 0 4px #e1f2eb;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.82fr) minmax(520px, 1.18fr);
  gap: 20px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.input-panel {
  padding: 25px;
}

.result-panel {
  min-width: 0;
  overflow: hidden;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 25px;
}

.panel-heading--result {
  align-items: center;
  padding: 25px 25px 0;
  margin-bottom: 20px;
}

.format-chip {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid #c9e6e6;
  border-radius: 5px;
  color: var(--accent-dark);
  background: #f3fbfb;
  font-size: 11px;
  white-space: nowrap;
}

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

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

.field-grid--details {
  margin-top: 18px;
}

.color-file-field,
.size-field {
  grid-column: 1 / -1;
}

.field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
}

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

.field-hint {
  min-height: 18px;
  color: var(--subtle);
  font-size: 11px;
  line-height: 1.45;
}

code {
  padding: 1px 4px;
  border-radius: 3px;
  color: #48606b;
  background: #f0f3f4;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 0.92em;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--ink);
  background: #fcfdfd;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

input {
  height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 144px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.65;
}

.file-picker {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #fcfdfd;
}

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

.file-picker-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 32px;
  gap: 5px;
  padding: 0 10px;
  border: 1px solid #b8dfe0;
  border-radius: 4px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.file-picker-button:hover {
  border-color: #8ecbcd;
  background: #d9eeee;
}

.file-input:focus-visible + .file-picker-button {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(8, 127, 140, 0.14);
}

.file-picker-count {
  min-width: 0;
  overflow: hidden;
  color: var(--subtle);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 5px;
  max-height: 224px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.file-list:empty {
  display: none;
}

.file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  min-height: 58px;
  padding: 8px 10px;
  border: 1px solid #e5eaec;
  border-radius: 4px;
  color: var(--muted);
  background: #fafcfc;
  font-size: 11px;
}

.file-entry {
  display: grid;
  align-items: start;
  flex: 1 1 auto;
  gap: 3px;
  min-width: 0;
}

.file-name {
  flex: none;
  min-width: 0;
  width: 100%;
  overflow: hidden;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-stem {
  min-width: 0;
  overflow: hidden;
  color: var(--accent-dark);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-file-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #8a969b;
  background: transparent;
  font-size: 18px;
  line-height: 1;
}

.remove-file-button:hover {
  border-color: #edc5c5;
  color: var(--danger);
  background: #fff5f5;
}

.remove-file-button:focus-visible {
  outline: 0;
  border-color: #dba0a0;
  box-shadow: 0 0 0 3px rgba(179, 63, 63, 0.12);
}

.size-field {
  gap: 10px;
}

.size-field-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.size-summary {
  overflow: hidden;
  color: var(--accent-dark);
  font-size: 11px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.size-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 37px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--muted);
  background: #fcfdfd;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.size-option:hover {
  border-color: #9ecfd1;
  color: var(--accent-dark);
}

.size-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  border: 0;
  opacity: 0;
  clip: rect(0, 0, 0, 0);
}

.size-option input:focus-visible + span {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(8, 127, 140, 0.14);
}

.size-option input:checked + span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 3px;
  color: var(--accent-dark);
  background: var(--accent-soft);
}

input::placeholder,
textarea::placeholder {
  color: #a8b1b6;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(8, 127, 140, 0.12);
}

.form-message {
  min-height: 20px;
  margin-top: 16px;
  color: var(--danger);
  font-size: 12px;
}

.form-message.is-warning {
  color: var(--warning);
}

.form-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 5px;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.button {
  min-height: 40px;
  gap: 8px;
  padding: 0 15px;
  font-size: 13px;
  font-weight: 700;
}

.button:active,
.icon-button:active {
  transform: translateY(1px);
}

.button--primary {
  color: #fff;
  background: var(--accent);
}

.button--primary:hover {
  background: var(--accent-dark);
}

.button--quiet {
  border-color: var(--line);
  color: var(--muted);
  background: #fff;
}

.button--quiet:hover {
  border-color: var(--line-strong);
  color: var(--ink);
  background: #f7f9f9;
}

.button-icon {
  font-size: 15px;
  line-height: 1;
}

.shortcut-hint {
  margin-left: 4px;
  color: var(--subtle);
  font-size: 11px;
}

.result-actions {
  display: flex;
  gap: 7px;
}

.icon-button {
  width: 34px;
  height: 34px;
  border-color: var(--line);
  color: var(--muted);
  background: #fff;
  font-size: 18px;
  line-height: 1;
}

.icon-button:hover:not(:disabled) {
  border-color: #b5dfe0;
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.icon-button:disabled {
  color: #c0c8cc;
  background: #fafbfb;
}

.result-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin: 0 25px 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.result-count {
  display: flex;
  align-items: baseline;
  gap: 7px;
  color: var(--muted);
  white-space: nowrap;
}

.result-count strong {
  color: var(--accent-dark);
  font-size: 25px;
  line-height: 1;
}

.result-count span {
  font-size: 12px;
}

.result-detail {
  overflow: hidden;
  color: var(--subtle);
  font-size: 11px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-wrap {
  max-height: 580px;
  overflow: auto;
}

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

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--subtle);
  background: #fbfcfc;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

td {
  color: var(--muted);
  font-size: 12px;
}

th:first-child,
td:first-child {
  padding-right: 7px;
}

.index-col {
  width: 54px;
}

th:nth-child(2) {
  width: 43%;
}

th:nth-child(3) {
  width: 26%;
}

.sku-cell {
  color: var(--ink);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.empty-row td {
  height: 300px;
  border-bottom: 0;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 9px;
  color: var(--subtle);
  text-align: center;
}

.empty-state p {
  margin: 0;
  font-size: 12px;
}

.empty-glyph {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px dashed var(--line-strong);
  border-radius: 50%;
  color: #a9b4b8;
  font-size: 20px;
}

.footer-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 20px 0 0;
  color: var(--subtle);
  font-size: 11px;
}

.footer-separator {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #bdc7ca;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 5;
  max-width: min(360px, calc(100vw - 48px));
  padding: 10px 14px;
  border: 1px solid #b7dedd;
  border-radius: 5px;
  color: #075c65;
  background: #effafa;
  box-shadow: 0 8px 24px rgba(20, 63, 69, 0.14);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 930px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .result-panel {
    min-height: 360px;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 24px, 560px);
    padding-top: 17px;
  }

  .topbar {
    align-items: flex-start;
    padding-bottom: 17px;
  }

  .topbar-note {
    padding-top: 4px;
    font-size: 11px;
  }

  .input-panel {
    padding: 18px;
  }

  .panel-heading,
  .panel-heading--result {
    margin-bottom: 19px;
  }

  .panel-heading--result {
    padding: 18px 18px 0;
  }

  .format-chip {
    display: none;
  }

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

  .field-grid--details {
    margin-top: 15px;
  }

  .file-picker {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .file-picker-count {
    align-self: center;
    max-width: 100%;
  }

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

  .result-summary {
    margin-right: 18px;
    margin-left: 18px;
  }

  th,
  td {
    padding-right: 18px;
    padding-left: 18px;
  }

  th:nth-child(2) {
    width: 47%;
  }

  th:nth-child(3) {
    width: 25%;
  }

  .shortcut-hint {
    width: 100%;
    margin-left: 0;
  }

  .footer-note {
    flex-wrap: wrap;
    gap: 6px 10px;
    padding-bottom: 8px;
  }
}
