:root {
  --bg-top: #f2e9dc;
  --bg-bottom: #dbe7f5;
  --panel: rgba(255, 252, 247, 0.84);
  --panel-border: rgba(113, 86, 58, 0.14);
  --text-main: #1f2a33;
  --text-muted: #5d6c75;
  --accent: #b95c2e;
  --accent-strong: #924118;
  --accent-soft: rgba(185, 92, 46, 0.14);
  --success: #1f7a5c;
  --shadow: 0 24px 80px rgba(43, 38, 32, 0.14);
  --radius-xl: 28px;
  --radius-lg: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.88), transparent 34%),
    radial-gradient(circle at right center, rgba(185, 92, 46, 0.12), transparent 32%),
    linear-gradient(145deg, var(--bg-top), var(--bg-bottom));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.22) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), transparent 72%);
}

.shell {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.hero {
  padding: 28px 8px 24px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-strong);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  font-weight: 700;
}

.hero h1 {
  margin: 0;
  max-width: 10ch;
  font-family: "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  font-size: clamp(2.7rem, 7vw, 5.4rem);
  line-height: 0.96;
  letter-spacing: -0.05em;
}

.hero-copy {
  margin: 20px 0 0;
  max-width: 640px;
  color: var(--text-muted);
  font-size: 1.03rem;
  line-height: 1.75;
}

.panel {
  backdrop-filter: blur(18px);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 28px;
  animation: rise-in 420ms ease-out;
}

.module-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 20px;
}

.module-nav-button {
  background: rgba(255, 255, 255, 0.76);
  color: var(--text-main);
  border: 1px solid rgba(40, 48, 56, 0.1);
  box-shadow: none;
}

.module-nav-button.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 14px 26px rgba(146, 65, 24, 0.18);
}

.module-panel + .module-panel {
  margin-top: 28px;
}

.module-spotlight {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
  padding: 20px 22px;
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(255, 246, 236, 0.72)),
    rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(40, 48, 56, 0.08);
}

.module-kicker {
  margin: 0;
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.module-spotlight h2 {
  margin: 0;
  font-size: 1.48rem;
}

.module-copy {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.7;
}

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

.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 190px;
  border: 1.5px dashed rgba(146, 65, 24, 0.34);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 248, 240, 0.95)),
    var(--accent-soft);
  cursor: pointer;
  text-align: center;
  padding: 24px;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.dropzone:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 18px 40px rgba(146, 65, 24, 0.1);
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-title {
  display: block;
  font-size: 1.2rem;
  font-weight: 700;
}

.drop-subtitle {
  display: block;
  margin-top: 10px;
  color: var(--text-muted);
  line-height: 1.6;
}

.file-meta {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(31, 122, 92, 0.08);
  color: var(--success);
  font-weight: 600;
}

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

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

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

.field span {
  font-size: 0.95rem;
  font-weight: 700;
}

.field select,
.field input {
  appearance: none;
  border: 1px solid rgba(40, 48, 56, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.95);
  padding: 13px 14px;
  font: inherit;
  color: inherit;
}

.field select:disabled,
.field input:disabled {
  opacity: 0.55;
}

.field-note {
  align-content: start;
}

.dst-status {
  min-height: 52px;
  padding: 13px 14px;
  border: 1px solid rgba(40, 48, 56, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text-main);
  line-height: 1.45;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, box-shadow 160ms ease;
  box-shadow: 0 16px 30px rgba(146, 65, 24, 0.18);
}

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

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.tip {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.6;
}

.status {
  margin-top: 22px;
  padding: 16px 18px;
  border-radius: 16px;
  background: rgba(31, 42, 51, 0.06);
  color: var(--text-main);
  line-height: 1.7;
  min-height: 58px;
}

.status.error {
  background: rgba(180, 43, 43, 0.1);
  color: #8b1e1e;
}

.status.success {
  background: rgba(31, 122, 92, 0.1);
  color: var(--success);
}

.analysis {
  margin-top: 26px;
  padding-top: 6px;
}

.analysis-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.analysis-head h2 {
  margin: 0;
  font-size: 1.35rem;
}

.analysis-copy,
.analysis-now {
  margin: 8px 0 0;
  color: var(--text-muted);
  line-height: 1.6;
}

.analysis-now {
  min-width: 220px;
  text-align: right;
  font-weight: 700;
  color: var(--accent-strong);
}

.analysis-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.analysis-card {
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(40, 48, 56, 0.08);
}

.analysis-label {
  display: block;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.analysis-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.7rem;
  line-height: 1;
}

.analysis-mode-note {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(146, 65, 24, 0.08);
  color: var(--accent-strong);
  font-size: 0.95rem;
  font-weight: 600;
}

.order-mode-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.order-mode-button.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 20px rgba(146, 65, 24, 0.16);
}

.analysis-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.analysis-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}

.analysis-filter-label {
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.analysis-thresholds {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.analysis-custom-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.analysis-status-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.analysis-inline-field {
  min-width: 180px;
}

.analysis-inline-field span {
  font-size: 0.88rem;
}

.analysis-custom-input {
  width: 110px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(40, 48, 56, 0.14);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-main);
  font: inherit;
}

.threshold-button {
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-main);
  border: 1px solid rgba(40, 48, 56, 0.12);
  box-shadow: none;
}

.threshold-button.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 20px rgba(146, 65, 24, 0.16);
}

.threshold-button-secondary {
  background: rgba(245, 241, 236, 0.96);
}

.analysis-threshold-summary {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 0.93rem;
  font-weight: 600;
}

.analysis-table-wrap {
  margin-top: 18px;
  max-height: 560px;
  overflow-x: auto;
  overflow-y: auto;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(40, 48, 56, 0.08);
}

.analysis-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.analysis-table th,
.analysis-table td {
  padding: 13px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(40, 48, 56, 0.08);
  font-size: 0.95rem;
}

.analysis-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 0.88rem;
  color: var(--text-muted);
  background: rgba(245, 241, 236, 0.94);
}

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

.matcher {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid rgba(40, 48, 56, 0.08);
}

.matcher-head h2,
.matcher-config-head h3 {
  margin: 0;
  font-size: 1.28rem;
}

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

.dropzone-compact {
  min-height: 156px;
}

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

.matcher-config {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(40, 48, 56, 0.08);
}

.matcher-config-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.template-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.match-pairs {
  display: grid;
  gap: 12px;
}

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

.match-pair-empty {
  padding: 16px;
  border-radius: 14px;
  color: var(--text-muted);
  background: rgba(31, 42, 51, 0.05);
}

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

.append-column-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(40, 48, 56, 0.08);
}

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

.checkbox-field {
  align-content: center;
}

.checkbox-field span {
  margin-bottom: 6px;
}

.checkbox-field input,
.append-column-item input {
  width: 18px;
  height: 18px;
}

.match-preview-table td,
.match-preview-table th {
  vertical-align: top;
}

.chain-matcher {
  margin-top: 32px;
}

.chain-steps {
  display: grid;
  gap: 16px;
}

.chain-step-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(40, 48, 56, 0.08);
}

.chain-step-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chain-step-title {
  margin: 0;
  font-size: 1.05rem;
}

.secondary-button,
.match-pair-remove {
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-main);
  border: 1px solid rgba(40, 48, 56, 0.14);
  box-shadow: none;
}

.secondary-button:hover:not(:disabled),
.match-pair-remove:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(31, 42, 51, 0.08);
}

.risk-overdue {
  color: #8b1e1e;
  font-weight: 700;
}

.risk-soon {
  color: var(--accent-strong);
  font-weight: 700;
}

.hidden {
  display: none;
}

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

@media (max-width: 840px) {
  .shell {
    width: min(100% - 22px, 1040px);
    padding-top: 28px;
  }

  .hero h1 {
    max-width: none;
  }

  .panel {
    padding: 18px;
  }

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

  .grid-two,
  .matcher-upload-grid,
  .match-pair-row,
  .template-row,
  .advanced-grid {
    grid-template-columns: 1fr;
  }

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

  .module-nav {
    gap: 10px;
  }

  .module-nav-button {
    width: 100%;
  }

  .analysis-head {
    flex-direction: column;
  }

  .analysis-now {
    min-width: auto;
    text-align: left;
  }

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