*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f0f2f5;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  color: #1a1a1a;
  line-height: 1.5;
}

main {
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.10);
  padding: 2rem 2rem 1.75rem;
  width: 100%;
  max-width: 460px;
}

/* ── Header ──────────────────────────────────────────────────────────────────── */

header {
  text-align: center;
  margin-bottom: 1.75rem;
}

h1 {
  font-size: 1.375rem;
  font-weight: 700;
  color: #111827;
  letter-spacing: -0.01em;
}

.subtitle {
  font-size: 0.875rem;
  color: #6b7280;
  margin-top: 0.375rem;
}

/* ── Form fields ─────────────────────────────────────────────────────────────── */

.field {
  margin-bottom: 1rem;
}

label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.375rem;
}

input[type="password"],
input[type="text"],
select {
  width: 100%;
  padding: 0.5625rem 0.75rem;
  border: 1.5px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.9375rem;
  color: #111827;
  background: #ffffff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* ── File drop zone ──────────────────────────────────────────────────────────── */

.file-zone {
  position: relative;
  border: 1.5px dashed #d1d5db;
  border-radius: 6px;
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.file-zone:hover,
.file-zone.drag-over {
  border-color: #2563eb;
  background: #eff6ff;
}

.file-zone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

#file-hint {
  font-size: 0.875rem;
  color: #9ca3af;
  pointer-events: none;
}

#file-hint.has-file {
  color: #111827;
  font-weight: 500;
}

/* ── Buttons ─────────────────────────────────────────────────────────────────── */

button {
  display: block;
  width: 100%;
  padding: 0.625rem 1rem;
  border: none;
  border-radius: 6px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

#upload-btn {
  background: #1d4ed8;
  color: #ffffff;
  margin-top: 0.625rem;
}

#upload-btn:hover:not(:disabled) {
  background: #1e40af;
}

#upload-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.secondary {
  background: transparent;
  border: 1.5px solid #d1d5db;
  color: #374151;
  font-weight: 500;
  margin-top: 0.75rem;
}

button.secondary:hover {
  background: #f9fafb;
}

/* ── Progress bar ────────────────────────────────────────────────────────────── */

.progress {
  margin-top: 1rem;
  height: 5px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: #1d4ed8;
  border-radius: 3px;
  transition: width 0.2s ease;
}

/* ── Error message ───────────────────────────────────────────────────────────── */

.error-msg {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: #dc2626;
  text-align: center;
}

/* ── Result panel ────────────────────────────────────────────────────────────── */

#result-panel {
  text-align: center;
}

.success-mark {
  width: 48px;
  height: 48px;
  background: #dcfce7;
  border-radius: 50%;
  margin: 0 auto 1rem;
  position: relative;
}

/* Checkmark drawn with CSS */
.success-mark::after {
  content: "";
  position: absolute;
  left: 14px;
  top: 8px;
  width: 10px;
  height: 18px;
  border: 2.5px solid #16a34a;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

#result-panel h2 {
  font-size: 1.125rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 0.25rem;
}

.expiry-note {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 1rem;
}

.copy-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.copy-row input {
  flex: 1;
  font-size: 0.8125rem;
  background: #f9fafb;
  color: #374151;
  min-width: 0;
}

#copy-btn {
  width: auto;
  padding: 0.5rem 1.125rem;
  background: #1d4ed8;
  color: #ffffff;
  font-size: 0.875rem;
  flex-shrink: 0;
}

#copy-btn:hover {
  background: #1e40af;
}

.copy-feedback {
  font-size: 0.8125rem;
  color: #16a34a;
  font-weight: 500;
  min-height: 1.25rem;
  margin-bottom: 0.25rem;
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  main {
    padding: 1.5rem 1.25rem;
    border-radius: 0;
    min-height: 100vh;
    box-shadow: none;
  }

  body {
    align-items: flex-start;
    padding: 0;
  }
}
