:root {
  --bg: #f5efe2;
  --bg-deep: #e6ddca;
  --ink: #1f2e2b;
  --muted: #68746d;
  --card: rgba(255, 251, 243, 0.78);
  --line: rgba(37, 58, 53, 0.12);
  --accent: #0f7a68;
  --accent-soft: rgba(15, 122, 104, 0.12);
  --gold: #be7d2f;
  --gold-soft: rgba(190, 125, 47, 0.14);
  --danger: #ba4d38;
  --shadow: 0 28px 60px rgba(48, 38, 20, 0.13);
  --shadow-soft: 0 14px 28px rgba(48, 38, 20, 0.08);
  --radius: 26px;
}

* {
  box-sizing: border-box;
}

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

body {
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.65), transparent 38%),
    linear-gradient(180deg, var(--bg) 0%, #efe5d2 55%, #e5dbc8 100%);
  color: var(--ink);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

code {
  padding: 0.12rem 0.36rem;
  border-radius: 0.45rem;
  background: rgba(31, 46, 43, 0.08);
  font-family: "SFMono-Regular", "Menlo", "Monaco", monospace;
  font-size: 0.92em;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(31, 46, 43, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 46, 43, 0.04) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent);
  pointer-events: none;
}

.page-glow {
  position: fixed;
  width: 28rem;
  height: 28rem;
  border-radius: 50%;
  filter: blur(26px);
  opacity: 0.42;
  pointer-events: none;
}

.page-glow--left {
  top: -8rem;
  left: -6rem;
  background: rgba(15, 122, 104, 0.32);
}

.page-glow--right {
  top: 8rem;
  right: -8rem;
  background: rgba(190, 125, 47, 0.26);
}

.page-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  background-image:
    radial-gradient(circle at 20% 20%, #000 0.5px, transparent 0.7px),
    radial-gradient(circle at 80% 30%, #000 0.5px, transparent 0.8px),
    radial-gradient(circle at 40% 70%, #000 0.4px, transparent 0.7px);
  background-size: 22px 22px;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.hero,
.panel,
.message {
  backdrop-filter: blur(18px);
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.9fr);
  gap: 24px;
  padding: 30px;
  border-radius: 34px;
}

.hero__copy h1,
.panel h2,
.hero__aside h2,
.result-card h3 {
  font-family: "Times New Roman", "Songti SC", "STSong", serif;
  letter-spacing: 0.02em;
}

.hero__copy h1 {
  margin: 8px 0 14px;
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  line-height: 1.05;
}

.hero__lead {
  margin: 0;
  max-width: 56rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.8;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.hero__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.chip,
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.92rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.56);
  max-width: min(100%, 24rem);
}

.hero__aside {
  padding: 22px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(248, 241, 228, 0.78)),
    var(--gold-soft);
  border: 1px solid rgba(190, 125, 47, 0.16);
}

.hero__aside h2 {
  margin: 4px 0 14px;
  font-size: 1.45rem;
}

.rule-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.8;
}

.aside-note {
  margin: 14px 0 0;
  padding-top: 14px;
  border-top: 1px dashed rgba(31, 46, 43, 0.15);
  color: #7d6448;
  font-size: 0.92rem;
  line-height: 1.7;
}

.panel {
  margin-top: 22px;
  padding: 24px;
  border-radius: var(--radius);
}

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

.panel__head h2 {
  margin: 6px 0 0;
  font-size: clamp(1.7rem, 2vw, 2rem);
}

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

.cost-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.cost-status {
  display: grid;
  gap: 16px;
}

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

.result-body--cost {
  margin-top: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cost-form {
  display: grid;
  gap: 14px;
}

.upload-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 238px;
  padding: 22px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(248, 244, 236, 0.72)),
    var(--accent-soft);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.upload-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 34px rgba(31, 46, 43, 0.08);
  border-color: rgba(15, 122, 104, 0.28);
}

.upload-card strong {
  font-size: 1.22rem;
}

.upload-card__tag {
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 122, 104, 0.11);
  color: var(--accent);
  font-size: 0.82rem;
}

.upload-card__tag--alt {
  background: rgba(190, 125, 47, 0.12);
  color: var(--gold);
}

.upload-card__hint,
.submit-note,
.file-meta,
.sample-list {
  color: var(--muted);
  line-height: 1.7;
}

.upload-card input {
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  position: absolute;
  pointer-events: none;
}

.file-meta {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px dashed rgba(31, 46, 43, 0.12);
  word-break: break-all;
}

.action-band {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 2px 0;
}

.action {
  border: 0;
  border-radius: 999px;
  padding: 15px 26px;
  font-size: 0.98rem;
  font-weight: 600;
  color: #fffaf0;
  cursor: pointer;
  background:
    linear-gradient(135deg, #0d6757 0%, #148c75 52%, #1e9e8a 100%);
  box-shadow: 0 18px 30px rgba(15, 122, 104, 0.24);
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.action--ghost {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: none;
  border: 1px solid var(--line);
}

.action--ghost:hover:not(:disabled) {
  box-shadow: 0 16px 30px rgba(31, 46, 43, 0.08);
}

.action:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 22px 36px rgba(15, 122, 104, 0.28);
}

.action:disabled {
  opacity: 0.55;
  cursor: progress;
}

.panel--result {
  animation: rise-in 320ms ease;
  background:
    linear-gradient(180deg, rgba(255, 251, 243, 0.86), rgba(250, 246, 238, 0.76)),
    var(--card);
}

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

.stats-grid--result {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.stat-card,
.result-card {
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(248, 244, 236, 0.76));
  box-shadow: var(--shadow-soft);
}

.stat-card {
  min-height: 138px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-card__label {
  display: block;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.45;
  max-width: 12ch;
}

.stat-card__value {
  display: block;
  margin-top: 14px;
  font-size: clamp(1.9rem, 2.8vw, 2.9rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.stat-card__value--split {
  font-size: clamp(1.55rem, 2.4vw, 2.25rem);
  line-height: 1.05;
  word-spacing: 0.08em;
}

.result-body {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
  align-items: stretch;
}

.result-card {
  grid-column: span 4;
  min-height: 210px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.result-card--primary {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(244, 250, 247, 0.84)),
    var(--accent-soft);
}

.result-card--wide {
  grid-column: span 6;
}

.result-card--full {
  grid-column: 1 / -1;
  min-height: 0;
}

.file-name {
  margin: 0;
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.meta-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.6;
}

.preview-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-top: 22px;
  margin-bottom: 10px;
}

.preview-head h2 {
  margin: 6px 0 0;
  font-size: 1.55rem;
}

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

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.9rem;
  line-height: 1;
}

.filter-chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
  color: var(--muted);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.filter-chip:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(15, 122, 104, 0.28);
  color: var(--ink);
}

.filter-chip.is-active {
  background: rgba(15, 122, 104, 0.12);
  border-color: rgba(15, 122, 104, 0.26);
  color: var(--accent);
}

.filter-chip:disabled {
  opacity: 0.56;
  cursor: default;
}

.preview-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
  text-align: right;
}

.preview-table-wrap {
  overflow: auto;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
}

.preview-table {
  width: 100%;
  min-width: 1320px;
  border-collapse: collapse;
}

.preview-table th,
.preview-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(31, 46, 43, 0.09);
  text-align: left;
  white-space: nowrap;
  font-size: 0.95rem;
}

.preview-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(239, 246, 243, 0.98);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
}

.preview-table th:nth-child(5),
.preview-table th:nth-child(6),
.preview-table th:nth-child(7),
.preview-table th:nth-child(8),
.preview-table th:nth-child(9),
.preview-table th:nth-child(10) {
  text-align: right;
}

.preview-table tbody tr:nth-child(even) td {
  background: rgba(249, 246, 240, 0.55);
}

.preview-table td:nth-child(2),
.preview-table td:nth-child(3),
.preview-table td:nth-child(11) {
  white-space: normal;
  overflow-wrap: anywhere;
}

.preview-row--danger td:first-child {
  box-shadow: inset 4px 0 0 rgba(186, 77, 56, 0.9);
}

.preview-row--warning td:first-child,
.preview-row--caution td:first-child,
.preview-row--pending td:first-child {
  box-shadow: inset 4px 0 0 rgba(190, 125, 47, 0.9);
}

.preview-row--success td:first-child {
  box-shadow: inset 4px 0 0 rgba(15, 122, 104, 0.9);
}

.cell-number {
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cell-number--row {
  text-align: left;
}

.cell-id,
.cell-sku,
.cell-status {
  line-height: 1.55;
}

.cell-status {
  color: var(--muted);
}

.badge-cell {
  white-space: nowrap;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1;
  border: 1px solid transparent;
}

.badge-pill--danger {
  background: rgba(186, 77, 56, 0.08);
  border-color: rgba(186, 77, 56, 0.14);
  color: var(--danger);
}

.badge-pill--warning,
.badge-pill--caution {
  background: rgba(190, 125, 47, 0.08);
  border-color: rgba(190, 125, 47, 0.16);
  color: #8b5d20;
}

.badge-pill--pending {
  background: rgba(87, 102, 95, 0.1);
  border-color: rgba(87, 102, 95, 0.14);
  color: #5d6761;
}

.badge-pill--success {
  background: rgba(15, 122, 104, 0.1);
  border-color: rgba(15, 122, 104, 0.16);
  color: var(--accent);
}

.badge-pill--neutral {
  background: rgba(31, 46, 43, 0.06);
  border-color: rgba(31, 46, 43, 0.1);
  color: var(--ink);
}

.metric-cell {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.metric-cell--danger {
  color: var(--danger);
}

.metric-cell--warning {
  color: #8b5d20;
}

.metric-cell--success {
  color: var(--accent);
}

.sort-button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.sort-button:hover:not(:disabled) {
  color: var(--accent);
}

.sort-button:disabled {
  cursor: default;
  opacity: 0.6;
}

.sort-button.is-active {
  color: var(--accent);
}

.sort-button__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 999px;
  background: rgba(15, 122, 104, 0.08);
  font-size: 0.78rem;
  line-height: 1;
}

.preview-placeholder {
  color: var(--muted);
  text-align: center !important;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: auto;
}

.result-card h3 {
  margin: 0;
  font-size: 1.22rem;
  line-height: 1.35;
}

.sample-list {
  margin: 0;
  color: var(--muted);
}

.sample-list--tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-content: flex-start;
}

.sample-list--tokens.is-empty {
  display: block;
  line-height: 1.7;
}

.sample-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(15, 122, 104, 0.08);
  border: 1px solid rgba(15, 122, 104, 0.14);
  color: var(--ink);
  line-height: 1.55;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.message {
  margin-top: 22px;
  padding: 18px 20px;
  border-radius: 20px;
  line-height: 1.7;
}

.message.is-error {
  border-color: rgba(186, 77, 56, 0.18);
  background: rgba(255, 245, 242, 0.86);
  color: var(--danger);
}

.message.is-success {
  border-color: rgba(15, 122, 104, 0.18);
  background: rgba(244, 252, 249, 0.9);
  color: var(--accent);
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  .stats-grid--result {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .result-card,
  .result-card--wide {
    grid-column: span 6;
  }
}

@media (max-width: 900px) {
  .hero,
  .cost-layout,
  .upload-grid,
  .result-body {
    grid-template-columns: 1fr;
  }

  .action-band,
  .button-row,
  .panel__head,
  .preview-head,
  .preview-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .preview-hint {
    text-align: left;
  }

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

  .result-card,
  .result-card--wide,
  .result-card--full {
    grid-column: auto;
    min-height: 0;
  }

  .action {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100vw - 20px, 100%);
    padding-top: 18px;
  }

  .panel {
    padding: 18px;
  }

  .upload-card {
    min-height: 0;
    padding: 18px;
  }

  .stats-grid--result {
    grid-template-columns: 1fr;
  }

  .stat-card {
    min-height: 0;
  }

  .status {
    max-width: 100%;
  }
}
