:root {
  color-scheme: light;
  --bg: #f4f7ff;
  --card: #ffffffd9;
  --text: #0f172a;
  --muted: #64748b;
  --text-soft: #334155;
  --primary: #0091ea;
  --primary-2: #0076bf;
  --success: #0f9f6e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --border: #dbe4ff;
  --shadow: 0 20px 50px rgba(53, 71, 125, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at top left, #dbe9ff 0%, #eff4ff 42%, #f8fbff 100%);
  color: var(--text);
}

.bg-glow {
  position: fixed;
  z-index: 0;
  border-radius: 999px;
  filter: blur(70px);
}

.bg-glow-1 {
  width: 340px;
  height: 340px;
  left: -110px;
  top: -90px;
  background: #b7c6ff99;
}

.bg-glow-2 {
  width: 360px;
  height: 360px;
  right: -120px;
  bottom: -140px;
  background: #b8a8ff8f;
}

.page {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  padding: 44px 20px;
}

.card {
  width: min(980px, 100%);
  background: var(--card);
  border: 1px solid #ffffff8c;
  backdrop-filter: blur(6px);
  border-radius: 26px;
  padding: 32px;
  box-shadow: var(--shadow);
}

.header h1 {
  margin: 10px 0 10px;
  font-size: 32px;
  color: #0b2745;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.logo-square {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: contain;
  background: #fff;
  border: 1px solid #d9e4ff;
  padding: 6px;
}

.logo-words {
  height: 36px;
  width: auto;
  object-fit: contain;
}

.eyebrow {
  margin: 0;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.desc {
  margin: 0 0 4px;
  color: var(--muted);
}

.api-row {
  margin-top: 24px;
  display: grid;
  gap: 8px;
}

.api-row label {
  font-size: 14px;
  color: #1f4f78;
  font-weight: 600;
}

.api-row input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 15px;
  padding: 11px 14px;
  outline: none;
}

.api-row input:focus {
  border-color: #9fb4ff;
  box-shadow: 0 0 0 3px #d8e3ff;
}

.upload-line {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}

.file-tile {
  min-height: 190px;
  border-radius: 18px;
  border: 1.5px dashed #b8c8ff;
  background: linear-gradient(160deg, #f9fbff 0%, #f4f7ff 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.file-tile:hover {
  transform: translateY(-2px);
  border-color: #8ca5ff;
  box-shadow: 0 10px 25px rgba(93, 112, 191, 0.18);
}

.file-tile.drag-active {
  transform: translateY(-3px) scale(1.01);
  border-style: solid;
  border-color: #5a7cff;
  background: linear-gradient(160deg, #eef3ff 0%, #e1ebff 100%);
  box-shadow:
    0 16px 30px rgba(77, 103, 205, 0.26),
    inset 0 0 0 1px #ffffffbf;
  animation: tileGlow 1.1s ease-in-out infinite alternate;
}

.file-tile.filled {
  border-style: solid;
  border-color: #8ca5ff;
  background: linear-gradient(160deg, #eef3ff 0%, #e9efff 100%);
}

@keyframes tileGlow {
  from {
    filter: saturate(100%);
  }
  to {
    filter: saturate(122%);
  }
}

.tile-icon {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(160deg, #ffffffbf 0%, #d8e6ff8a 100%);
  border: 1px solid #c6d8ff;
  box-shadow:
    inset 0 1px 0 #ffffffd9,
    0 10px 22px rgba(109, 129, 209, 0.22);
  overflow: hidden;
}

.icon-sheen {
  position: absolute;
  left: 6px;
  top: 6px;
  width: 52px;
  height: 22px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffffd9 0%, #ffffff0d 100%);
}

.icon-page {
  position: absolute;
  left: 19px;
  top: 14px;
  width: 26px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #eef3ff 100%);
  border: 1px solid #b8ceff;
}

.icon-page::before {
  content: "";
  position: absolute;
  right: -1px;
  top: -1px;
  width: 9px;
  height: 9px;
  border-top-right-radius: 8px;
  background: #dbe8ff;
}

.icon-cloud {
  position: absolute;
  left: 17px;
  top: 22px;
  width: 30px;
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff 0%, #e9f1ff 100%);
  border: 1px solid #b8ceff;
}

.icon-cloud::before,
.icon-cloud::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: inherit;
  border: inherit;
}

.icon-cloud::before {
  width: 14px;
  height: 14px;
  left: 3px;
  top: -7px;
}

.icon-cloud::after {
  width: 16px;
  height: 16px;
  right: 4px;
  top: -8px;
}

.icon-badge {
  position: absolute;
  left: 12px;
  bottom: 8px;
  min-width: 40px;
  text-align: center;
  border-radius: 999px;
  background: linear-gradient(90deg, #0091ea, #0076bf);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 6px;
}

.epw-icon .icon-badge {
  background: linear-gradient(90deg, #0091ea, #0076bf);
}

.tile-title {
  font-size: 15px;
  font-weight: 600;
}

.tile-name {
  max-width: 220px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plus {
  font-size: 38px;
  color: #7a85ad;
  font-weight: 300;
}

.actions {
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.primary {
  border: 1px solid #0085d6;
  border-radius: 14px;
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 600;
  background:
    linear-gradient(180deg, #ffffff47 0%, #ffffff00 50%),
    linear-gradient(100deg, #00a2ff 0%, #0091ea 55%, #0076bf 100%);
  color: #fff;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 #ffffff8c,
    0 10px 24px rgba(0, 145, 234, 0.35);
  transition: all 0.24s ease;
}

.primary:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.01);
  box-shadow:
    inset 0 1px 0 #ffffffbf,
    0 14px 28px rgba(0, 145, 234, 0.42);
}

.primary.submitting {
  filter: saturate(112%);
  background:
    linear-gradient(180deg, #ffffff52 0%, #ffffff00 55%),
    linear-gradient(100deg, #19adff 0%, #0099f6 55%, #0085d6 100%);
}

.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#submitHint {
  font-size: 13px;
  color: #4f657f;
}

.status-wrap {
  margin-top: 24px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid #dfe8ff;
  background: #fbfdff;
}

.status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.status-header h2 {
  margin: 0;
  font-size: 18px;
}

#jobIdLabel {
  font-size: 12px;
  color: #3c5672;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.status-pill {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-pill.pending {
  background: #fff7dd;
  color: #9a6a05;
}

.status-pill.running {
  background: #e6efff;
  color: #2957c8;
}

.status-pill.completed {
  background: #dcfce7;
  color: #0f766e;
}

.status-pill.failed {
  background: #fee2e2;
  color: #b91c1c;
}

#statusText {
  margin: 10px 0 0;
  color: var(--text-soft);
  font-size: 14px;
}

.result-wrap {
  margin-top: 24px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid #dfe8ff;
  background: #fff;
  display: none;
}

.history-wrap {
  margin-top: 24px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid #dfe8ff;
  background: #fff;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.history-header h2 {
  margin: 0;
  font-size: 18px;
}

.ghost-btn {
  border: 1px solid #88cfff;
  border-radius: 10px;
  background: #ecf8ff;
  color: #0077c2;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

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

.history-list {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.history-item {
  border: 1px solid #dbe5ff;
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(160deg, #fafdff 0%, #f2f7ff 100%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.history-main {
  min-width: 0;
}

.history-id {
  font-size: 12px;
  color: #22476b;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-time {
  margin-top: 5px;
  font-size: 12px;
  color: var(--muted);
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-btn {
  border: 1px solid #9dd7ff;
  border-radius: 9px;
  background: #f0f9ff;
  color: #0077c2;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.history-btn.view {
  border-color: #7fc8ff;
  color: #006aa8;
  background: #e6f6ff;
}

.history-btn.delete {
  border-color: #73c3ff;
  color: #006aa8;
  background: #e3f4ff;
}

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

.result-wrap h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

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

.metric-card {
  margin: 0;
  border-radius: 12px;
  background: linear-gradient(160deg, #f8faff 0%, #eff3ff 100%);
  border: 1px solid #dbe4ff;
  padding: 14px;
}

.metric-card h3 {
  margin: 0;
  color: #2e5f8d;
  font-size: 14px;
  font-weight: 600;
}

.metric-card p {
  margin: 8px 0 0;
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}

@media (max-width: 860px) {
  .upload-line {
    grid-template-columns: 1fr;
  }

  .plus {
    justify-self: center;
  }

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

  .history-item {
    flex-direction: column;
    align-items: stretch;
  }

  .history-actions {
    justify-content: flex-end;
  }
}

@media (max-width: 520px) {
  .card {
    padding: 20px;
    border-radius: 18px;
  }

  .header h1 {
    font-size: 24px;
  }

  .brand {
    gap: 12px;
    margin-bottom: 10px;
  }

  .logo-square {
    width: 40px;
    height: 40px;
  }

  .logo-words {
    height: 28px;
    max-width: 62vw;
  }

  .tile-icon {
    width: 60px;
    height: 60px;
  }

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