﻿:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #667085;
  --primary: #1677ff;
  --primary-dark: #0958d9;
  --success: #159947;
  --warning: #b7791f;
  --danger: #c92a2a;
  --border: #d9e2ef;
  --shadow: 0 18px 45px rgba(20, 31, 53, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at top left, #e7f0ff, transparent 32rem), var(--bg);
  color: var(--text);
}

.page-shell {
  width: min(960px, calc(100% - 32px));
  margin: 28px auto;
  display: grid;
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 28px;
}

.compact-hero h1 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 5vw, 3.25rem);
  letter-spacing: -0.04em;
  line-height: 1.08;
}

.hero-subtitle {
  margin-top: 8px;
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.hero-subtitle p { margin: 0; }

.hero-text,
.status-message,
.helper-text,
.support-card p {
  color: var(--muted);
  line-height: 1.65;
}

.hero-text,
.support-card p { margin: 0; }

h2 {
  margin: 0 0 16px;
  font-size: 1.35rem;
}

.upload-form {
  display: grid;
  gap: 16px;
}

.file-picker {
  border: 2px dashed #b8c7dd;
  border-radius: 16px;
  padding: 18px 20px;
  display: grid;
  gap: 4px;
  cursor: pointer;
  background: #fbfdff;
}

.file-picker:focus-within {
  outline: 3px solid rgba(22, 119, 255, 0.2);
}

.file-picker-title {
  font-size: 1rem;
  font-weight: 800;
}

.file-picker-name {
  color: var(--muted);
}

.file-picker input {
  margin-top: 6px;
}

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

label span,
.label-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 800;
}

select,
button {
  border-radius: 12px;
  border: 1px solid var(--border);
  min-height: 44px;
  padding: 0 12px;
  font: inherit;
}

select { width: 100%; background: #fff; }

select:focus,
button:focus,
a:focus {
  outline: 3px solid rgba(22, 119, 255, 0.22);
  outline-offset: 2px;
}

.effect-field { position: relative; }
.help-wrap { position: relative; display: inline-flex; margin: 0; }

.help-link {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 800;
  cursor: help;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.effect-popover {
  position: absolute;
  z-index: 30;
  left: 0;
  top: 26px;
  width: min(430px, 86vw);
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 20px 50px rgba(20, 31, 53, 0.16);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
}

.help-wrap:hover .effect-popover,
.help-wrap:focus-within .effect-popover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.effect-popover strong { font-size: 1rem; }
.effect-popover span { display: block; margin: 0; color: var(--muted); line-height: 1.55; font-weight: 400; }
.effect-popover b { color: var(--text); }

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

.primary-button {
  width: auto;
  min-width: 160px;
  border: 0;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  padding: 0 24px;
}

.primary-button:hover { background: var(--primary-dark); }
.primary-button:disabled { background: #c0cad8; cursor: not-allowed; }

.helper-text {
  margin: 0;
  flex: 1;
  min-width: 240px;
}

.inline-status {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.compact-status-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 800;
  background: #edf2f7;
  color: var(--muted);
}

.status-pill.queued,
.status-pill.running { background: #fff7e6; color: var(--warning); }
.status-pill.succeeded { background: #e8fff1; color: var(--success); }
.status-pill.failed,
.status-pill.expired { background: #fff0f0; color: var(--danger); }

.status-message { margin: 0; }

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: #edf2f7;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #36cfc9);
  transition: width 240ms ease;
}

.download-link {
  width: fit-content;
  display: inline-flex;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--success);
  color: #fff;
  text-decoration: none;
  font-weight: 800;
}

.hidden { display: none; }

.support-card { padding-top: 20px; padding-bottom: 20px; }
.support-card h2 { font-size: 1.1rem; margin-bottom: 8px; }

@media (max-width: 760px) {
  .page-shell { margin: 18px auto; }
  .card { padding: 20px; }
  .field-grid { grid-template-columns: 1fr; }
  .action-row { align-items: stretch; }
  .primary-button { width: 100%; }
  .compact-status-header { align-items: flex-start; flex-direction: column; }
  .effect-popover { left: auto; right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

.file-picker input::file-selector-button {
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  padding: 8px 12px;
  margin-right: 10px;
  cursor: pointer;
}

.file-picker input::file-selector-button:hover {
  background: var(--primary-dark);
}

.file-picker input:disabled::file-selector-button,
.file-picker.is-disabled input::file-selector-button {
  background: #c0cad8;
  cursor: not-allowed;
}

.file-picker.is-disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.job-list {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.job-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfdff;
}

.job-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.job-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-message {
  color: var(--muted);
  font-size: 0.92rem;
}

.job-pill {
  border-radius: 999px;
  padding: 5px 10px;
  font-weight: 800;
  font-size: 0.9rem;
  background: #edf2f7;
  color: var(--muted);
}

.job-pill.queued,
.job-pill.running { background: #fff7e6; color: var(--warning); }
.job-pill.succeeded { background: #e8fff1; color: var(--success); }
.job-pill.failed,
.job-pill.expired { background: #fff0f0; color: var(--danger); }

.job-download {
  border-radius: 10px;
  padding: 7px 10px;
  background: var(--success);
  color: #fff;
  text-decoration: none;
  font-weight: 800;
}

@media (max-width: 760px) {
  .job-item { grid-template-columns: 1fr; align-items: start; }
  .job-download { width: fit-content; }
}
