:root {
  color-scheme: light;
  --page: #f4f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fbff;
  --ink: #132238;
  --muted: #64748b;
  --line: #dbe5ef;
  --blue: #2563eb;
  --blue-deep: #1d4ed8;
  --blue-soft: #eaf1ff;
  --teal: #0f766e;
  --teal-soft: #e2f7f3;
  --orange: #f97316;
  --orange-soft: #fff1e8;
  --danger: #b91c1c;
  --shadow: 0 18px 45px rgba(21, 34, 51, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 72px;
  padding: 0 clamp(22px, 6vw, 120px);
  display: flex;
  align-items: center;
  gap: 28px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 900;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  font-size: 16px;
}

.topnav {
  margin-left: auto;
  display: flex;
  gap: 24px;
}

.topnav a {
  color: #344256;
  text-decoration: none;
  font-size: 15px;
  font-weight: 800;
}

.health-badge {
  min-width: 104px;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--teal);
  background: var(--teal-soft);
  text-align: center;
  font-size: 13px;
  font-weight: 900;
}

.health-badge.error {
  color: var(--danger);
  background: #fee2e2;
}

main {
  width: min(1800px, 100%);
  margin: 0 auto;
}

.hero {
  min-height: 360px;
  padding: 54px clamp(22px, 6vw, 120px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 34px;
  align-items: center;
  color: #fff;
  background:
    linear-gradient(120deg, rgba(37, 99, 235, 0.96), rgba(14, 83, 196, 0.94) 52%, rgba(15, 118, 110, 0.9)),
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.26), transparent 34%);
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  opacity: 0.88;
}

.hero h1 {
  margin: 0;
  font-size: clamp(34px, 4vw, 58px);
  line-height: 1.12;
  font-weight: 900;
}

.subtitle {
  max-width: 760px;
  margin: 20px 0 0;
  font-size: 22px;
  line-height: 1.65;
  opacity: 0.92;
}

.upload-console {
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  color: #46576d;
  font-size: 14px;
  font-weight: 900;
}

input[type="file"],
input[type="text"] {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

input[type="file"] {
  padding: 10px;
}

input[type="text"] {
  padding: 0 12px;
}

.key-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 9px;
}

.icon-button {
  display: grid;
  place-items: center;
  min-height: 46px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 22px;
  font-weight: 900;
}

.primary-button,
.secondary-button,
.mini-button {
  border-radius: 8px;
  font-weight: 900;
}

.primary-button {
  width: 100%;
  min-height: 48px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
}

.secondary-button {
  min-height: 44px;
  padding: 0 16px;
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid #c9d9ff;
}

.mini-button {
  min-height: 32px;
  padding: 0 12px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 13px;
}

.status {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.status.error {
  color: var(--danger);
}

.process-strip {
  width: min(1320px, calc(100% - 44px));
  margin: -32px auto 24px;
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.process-step {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel-soft);
  font-weight: 900;
}

.process-step span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #fff;
  background: #94a3b8;
  font-size: 13px;
}

.process-step.active {
  color: var(--blue);
  background: var(--blue-soft);
}

.process-step.active span {
  background: var(--blue);
}

.image-section,
.dashboard-grid {
  width: min(1320px, calc(100% - 44px));
  margin: 0 auto 26px;
}

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

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

.image-card {
  margin: 0;
  overflow: hidden;
}

.image-card.featured {
  border-color: #b9ccff;
}

.image-card-head {
  min-height: 52px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

figcaption {
  font-size: 17px;
  font-weight: 900;
}

.state-pill {
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--teal);
  background: var(--teal-soft);
  font-size: 12px;
  font-weight: 900;
}

.image-slot {
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
  display: grid;
  place-items: center;
  background: #f6f9fd;
}

.image-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.image-slot img:not([src]) {
  display: none;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  padding-bottom: 38px;
}

.analysis-card {
  padding: 18px;
}

.ocr-card {
  grid-column: 1 / -1;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.section-title h2 {
  margin: 0;
  font-size: 19px;
}

.section-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 900;
}

.section-icon.blue {
  color: var(--blue);
  background: var(--blue-soft);
}

.section-icon.teal {
  color: var(--teal);
  background: var(--teal-soft);
}

.section-icon.orange {
  color: var(--orange);
  background: var(--orange-soft);
}

.section-icon.slate {
  color: #475569;
  background: #eef2f7;
}

.metric-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 13px 18px;
  margin: 0;
}

.metric-list dt {
  color: #55677f;
  font-weight: 700;
}

.metric-list dd {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.export-actions {
  display: grid;
  gap: 12px;
}

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

.ocr-box {
  min-height: 118px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.ocr-box h4 {
  margin: 0 0 8px;
  font-size: 15px;
}

.ocr-box p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}

.preview-dialog {
  width: min(92vw, 980px);
  padding: 54px 18px 18px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.32);
}

.preview-dialog::backdrop {
  background: rgba(15, 23, 42, 0.58);
}

.preview-dialog img {
  display: block;
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
  background: #f8fafc;
}

.close-button {
  position: absolute;
  top: 14px;
  right: 14px;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  color: #fff;
  background: #1f2937;
  font-weight: 900;
}

@media (max-width: 1080px) {
  .hero,
  .image-section,
  .dashboard-grid,
  .process-strip {
    grid-template-columns: 1fr;
  }

  .ocr-card {
    grid-column: auto;
  }

  .topnav {
    display: none;
  }
}

@media (max-width: 720px) {
  .topbar {
    height: auto;
    padding: 14px;
    align-items: flex-start;
    flex-direction: column;
  }

  .hero {
    padding: 32px 16px 52px;
  }

  .hero h1 {
    font-size: 32px;
  }

  .subtitle {
    font-size: 17px;
  }

  .process-strip,
  .image-section,
  .dashboard-grid {
    width: calc(100% - 24px);
  }
}
