:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-border: #cbd5e1;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger-bg: #fee2e2;
  --danger-text: #991b1b;
  --warning-bg: #fef3c7;
  --warning-text: #92400e;
  --success-bg: #dcfce7;
  --success-text: #166534;
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, sans-serif;
  background:
    radial-gradient(circle at top, rgba(59, 130, 246, 0.12), transparent 45%),
    var(--bg);
  color: var(--text);
}

.page {
  max-width: 56rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 2rem;
}

.header h1 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  font-weight: 700;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.upload-form { margin-top: 1.25rem; }

.drop-zone {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border: 2px dashed var(--panel-border);
  border-radius: 0.75rem;
  background: var(--panel);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.drop-zone:hover,
.drop-zone:focus-visible,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: #f8fbff;
  outline: none;
}

.drop-zone.has-file {
  border-style: solid;
  border-color: var(--accent);
}

.file-input-native {
  position: absolute;
  width: 0.1px;
  height: 0.1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
}

.drop-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.5rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}

.drop-zone-text { flex: 1; min-width: 0; }

.drop-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
}

.selected-file {
  margin: 0.25rem 0 0;
  color: var(--success-text);
  font-size: 0.85rem;
  font-weight: 500;
  word-break: break-all;
}

.btn-submit {
  margin-top: 1rem;
  border: 0;
  border-radius: 0.65rem;
  padding: 0.7rem 1.1rem;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn-submit:hover { background: var(--accent-hover); }

.btn-submit:disabled {
  opacity: 0.6;
  cursor: wait;
}

.status {
  margin: 1rem 0 0;
  color: var(--muted);
}

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

.queue { margin-top: 1rem; }

.job {
  margin-top: 0.75rem;
  padding: 0.9rem 1rem 1rem;
  border: 1px solid var(--panel-border);
  border-radius: 0.75rem;
  background: var(--panel);
  cursor: pointer;
}

.job.is-open { border-color: var(--accent); }

.job-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}

.job-title { min-width: 0; }

.job-name {
  margin: 0;
  font-size: 1rem;
}

.job-step {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.job-actions {
  display: flex;
  flex-shrink: 0;
  gap: 0.3rem;
}

.btn-download,
.btn-delete {
  border: 1px solid var(--panel-border);
  border-radius: 0.4rem;
  padding: 0.15rem 0.45rem;
  background: #fff;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
}

.btn-download { color: var(--accent); }

.btn-delete { color: var(--danger-text); }

.bar {
  height: 0.45rem;
  margin-top: 0.7rem;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--accent);
}

.job-detail { cursor: default; }

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 0.35rem;
  margin-top: 0.85rem;
}

.thumb {
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 0.25rem;
  background: #fff;
  cursor: zoom-in;
  overflow: hidden;
}

.thumb img {
  display: block;
  width: 100%;
  height: auto;
}

.waiting {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  grid-column: 1 / -1;
}

.preview-pop {
  position: fixed;
  z-index: 20;
  margin: 0;
  padding: 0.45rem;
  border: 1px solid var(--panel-border);
  border-radius: 0.55rem;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
  pointer-events: none;
}

.preview-caption {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.preview-img {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
}
