:root {
  color-scheme: light;
  --ink: #16324f;
  --muted: #60758d;
  --paper: #f2f6f8;
  --surface: #ffffff;
  --line: #d7e2ea;
  --navy: #163a5f;
  --navy-strong: #0e2a45;
  --blue-soft: #dcecf8;
  --blue: #2d6f9f;
  --green: #1f7a5a;
  --green-soft: #e5f4ed;
  --danger: #a33f3f;
  --danger-soft: #faeceb;
  --shadow: 0 18px 50px rgba(22, 50, 79, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 12% 0%, rgba(170, 210, 230, 0.3), transparent 31rem),
    linear-gradient(180deg, #f8fbfc 0, var(--paper) 22rem, #f7f9fa 100%);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
  line-height: 1.6;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.site-header,
main,
footer {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 20px;
}

.login-card {
  width: min(100%, 460px);
  padding: 38px;
}

.login-brand-mark {
  margin-bottom: 24px;
}

.login-title {
  margin: 0;
  font-size: clamp(30px, 6vw, 42px);
  line-height: 1.16;
  letter-spacing: -0.035em;
}

.login-copy {
  margin: 14px 0 26px;
  color: var(--muted);
  font-size: 14px;
}

.login-field {
  display: grid;
  gap: 7px;
  margin-bottom: 15px;
  font-size: 13px;
  font-weight: 700;
}

.login-field input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 1px solid #b8cad6;
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
}

.login-field input:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(45, 111, 159, 0.14);
}

.login-button {
  width: 100%;
  margin-top: 6px;
}

.login-message {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 12px;
}

.logout-button {
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid #b8cad6;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.logout-button:hover {
  border-color: var(--blue);
  color: var(--navy);
}

.site-header {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--navy);
  color: #fff;
  font-size: 18px;
}

.privacy-badge {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.header-link {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.header-link:hover {
  color: var(--navy);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 48px;
  align-items: end;
  padding: 58px 0 36px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(34px, 6vw, 62px);
  line-height: 1.12;
  letter-spacing: -0.045em;
}

.hero-text {
  max-width: 720px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 17px;
}

.workflow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.workflow div:not(.flow-line) {
  display: flex;
  align-items: center;
  gap: 7px;
}

.workflow span {
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  border: 1px solid #a8c5d8;
  border-radius: 50%;
  background: var(--surface);
  color: var(--blue);
  font-weight: 700;
}

.flow-line {
  width: 30px;
  height: 1px;
  background: #b9ccd8;
}

.card {
  background: var(--surface);
  border: 1px solid rgba(159, 179, 200, 0.55);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.workspace {
  padding: 30px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.section-heading h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.format-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.dropzone {
  min-height: 220px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 28px;
  border: 1.5px dashed #8eb0c7;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(220, 236, 248, 0.38), rgba(255, 255, 255, 0.65));
  text-align: center;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.dropzone:hover,
.dropzone.is-dragging {
  border-color: var(--blue);
  background: #edf7fd;
  transform: translateY(-1px);
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
}

.drop-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-size: 30px;
  font-weight: 300;
  line-height: 1;
}

.drop-title {
  margin-top: 4px;
  font-size: 17px;
  font-weight: 700;
}

.drop-help {
  color: var(--muted);
  font-size: 13px;
}

.controls {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-top: 20px;
}

.field {
  display: grid;
  gap: 7px;
  width: min(100%, 420px);
  font-size: 13px;
  font-weight: 700;
}

select {
  width: 100%;
  height: 44px;
  padding: 0 38px 0 13px;
  border: 1px solid #b8cad6;
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
}

.btn {
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 700;
}

.btn-primary {
  background: var(--navy);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--navy-strong);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.file-summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f4f8fa;
  color: var(--muted);
  font-size: 13px;
}

.file-name {
  color: var(--ink);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.status {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.status[data-tone="working"] {
  color: var(--blue);
}

.status[data-tone="success"] {
  color: var(--green);
}

.status[data-tone="error"] {
  color: var(--danger);
}

.results {
  margin-top: 40px;
}

.results-heading {
  margin-bottom: 18px;
}

.download-button {
  min-width: 160px;
}

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

.metric {
  min-height: 108px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  font-size: 32px;
  line-height: 1;
}

.result-note {
  margin: 14px 0 22px;
  color: var(--muted);
  font-size: 13px;
}

.history-section {
  margin-top: 56px;
  scroll-margin-top: 20px;
}

.sales-stats-section {
  margin-top: 56px;
  scroll-margin-top: 20px;
}

.sales-toolbar {
  display: flex;
  align-items: end;
  gap: 14px;
  margin-bottom: 14px;
}

.compact-field {
  display: grid;
  gap: 6px;
  width: min(100%, 250px);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.compact-field select,
.compact-field input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #b8cad6;
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
}

.sales-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.sales-summary > div {
  min-width: 145px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 14px;
  border-radius: 10px;
  background: #eaf2f8;
  color: var(--muted);
  font-size: 12px;
}

.sales-summary strong {
  color: var(--ink);
  font-size: 20px;
}

.sales-table {
  min-width: 900px;
}

.sales-table th:not(:first-child):not(:nth-child(2)),
.sales-table td:not(:first-child):not(:nth-child(2)) {
  text-align: center;
}

.sales-empty-cell {
  padding: 38px 16px;
  color: var(--muted);
  text-align: center !important;
}

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

.history-panel {
  min-width: 0;
  padding: 22px;
  border-radius: 16px;
  box-shadow: none;
}

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

.history-panel h3 {
  margin: 0;
  font-size: 18px;
}

.history-panel p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.history-count {
  min-width: 34px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
}

.history-list {
  display: grid;
  gap: 10px;
  max-height: 390px;
  overflow-y: auto;
  padding-right: 4px;
}

.history-empty {
  display: grid;
  min-height: 106px;
  place-items: center;
  border: 1px dashed #c5d4de;
  border-radius: 10px;
  background: #f8fbfc;
}

.history-item {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fbfcfd;
}

.history-item-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.history-file-name {
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.history-time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
}

.history-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

.history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 11px;
}

.btn-small {
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid #b8cad6;
  border-radius: 8px;
  background: var(--surface);
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
}

.btn-small:hover {
  border-color: var(--blue);
  background: #f2f8fb;
}

.history-status {
  min-height: 22px;
  margin: 12px 2px 0;
  color: var(--muted);
  font-size: 12px;
}

.history-status[data-tone="error"] {
  color: var(--danger);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 13px;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #edf3f7;
  color: var(--ink);
  font-size: 12px;
}

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

.thumb {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f1f4f6;
  object-fit: cover;
}

.variant-name {
  font-weight: 700;
}

.size-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.size-pill {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--navy);
  white-space: nowrap;
}

.guide {
  margin-top: 56px;
}

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

.guide-grid article {
  padding: 20px;
  border-top: 2px solid #a8c5d8;
  background: rgba(255, 255, 255, 0.58);
}

.guide-grid article > span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.guide-grid h3 {
  margin: 10px 0 7px;
  font-size: 16px;
}

.guide-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: 54px;
  padding: 24px 0 34px;
  border-top: 1px solid #d8e2e8;
  color: var(--muted);
  font-size: 12px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 28px;
    padding-top: 38px;
  }

  .workflow {
    flex-wrap: wrap;
  }

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

  .history-grid {
    grid-template-columns: 1fr;
  }

  .sales-toolbar {
    flex-wrap: wrap;
  }
}

@media (max-width: 600px) {
  .site-header,
  main,
  footer {
    width: min(100% - 24px, 1120px);
  }

  .site-header {
    height: 66px;
  }

  .privacy-badge {
    display: none;
  }

  .header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
  }

  .hero {
    padding: 32px 0 24px;
  }

  h1 {
    font-size: 38px;
  }

  .hero-text {
    font-size: 15px;
  }

  .workspace {
    padding: 20px;
  }

  .section-heading,
  .controls,
  footer {
    align-items: stretch;
    flex-direction: column;
  }

  .format-note {
    text-align: left;
  }

  .dropzone {
    min-height: 190px;
    padding: 20px;
  }

  .field,
  .btn {
    width: 100%;
  }

  .sales-toolbar,
  .compact-field {
    width: 100%;
  }

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

  .history-panel {
    padding: 16px;
  }

  .login-card {
    padding: 28px 22px;
  }

  .metric {
    min-height: 96px;
    padding: 14px;
  }

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

  .file-summary {
    flex-direction: column;
    gap: 4px;
  }
}
