:root {
  --primary: #0056d2;
  --primary-dark: #0044a5;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --surface: #fff;
  --bg: #f1f5f9;
  --ok: #059669;
  --ok-bg: #ecfdf5;
  --err: #dc2626;
  --err-bg: #fef2f2;
  --warn-bg: #fffbeb;
  --info-bg: #f0f9ff;
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}

img { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-decoration: none; }

button, input, select, textarea { font: inherit; color: inherit; }

/* iOS font-size fix: ≥16px prevents auto-zoom */
input, select, textarea {
  font-size: 16px;
}

.container { width: min(700px, calc(100% - 32px)); margin-inline: auto; }

.page-main { padding: 32px 0 48px; }

[x-cloak] { display: none !important; }

/* Card */
.wizard-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* Brand */
.wizard-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand-link { display: block; line-height: 0; }

.brand-logo {
  height: 44px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
}

.link-login {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  padding: 8px 16px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  white-space: nowrap;
  transition: background 0.15s;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}

.link-login:active { background: #eff6ff; }

/* Title block */
.wizard-head { padding: 20px 24px 0; }

.wizard-head h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.wizard-head .subtitle {
  margin-top: 4px;
  font-size: 14px;
  color: var(--muted);
}

/* Progress */
.wizard-progress { padding: 16px 24px 0; }

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

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.progress-label {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.progress-label span:last-child { color: var(--primary); }
.progress-sep { margin: 0 6px; color: #cbd5e1; font-weight: 400; }

/* Body */
.wizard-body { padding: 20px 24px 100px; }

.step-desc {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.55;
}

.form-section { margin-bottom: 20px; }

.form-section > h3 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #94a3b8;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #f1f5f9;
}

.form-panel {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}

.form-panel + .form-panel { margin-top: 12px; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

.field:last-child { margin-bottom: 0; }

.field > label {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  background: var(--surface);
  font-size: 16px;
  min-height: 46px;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s;
}

.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.field textarea { min-height: 90px; resize: vertical; }

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 86, 210, 0.12);
}

.field-hint { font-size: 12px; color: #94a3b8; }

/* Checkbox / radio rows */
.check-field {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 500;
  margin: 12px 0 20px;
  cursor: pointer;
  min-height: 44px;
}

.check-field input[type="checkbox"] {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--primary);
}

.radio-list { display: grid; gap: 8px; }

.radio-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
  font-size: 15px;
  min-height: 48px;
  transition: border-color 0.15s, background 0.15s;
}

.radio-item:has(input:checked) {
  border-color: var(--primary);
  background: #eff6ff;
}

.radio-item input[type="radio"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--primary);
  margin-top: 2px;
}

.radio-item span { line-height: 1.4; }

/* Checkbox items (sectors, diseases) */
.check-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
  font-size: 15px;
  min-height: 48px;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 8px;
}

.check-item:last-child { margin-bottom: 0; }

.check-item:has(input:checked) {
  border-color: var(--primary);
  background: #eff6ff;
}

.check-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--primary);
  margin-top: 2px;
}

.check-item-body strong { display: block; font-size: 14px; font-weight: 600; color: var(--text); }
.check-item-body small { font-size: 12px; color: var(--muted); margin-top: 2px; display: block; }

/* Upload section */
.upload-notice {
  background: var(--warn-bg);
  border: 1px solid #fde68a;
  border-radius: 9px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.6;
  color: #92400e;
  margin-bottom: 16px;
}

.upload-list { display: grid; gap: 10px; }

.upload-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  background: #fafafa;
  transition: border-color 0.15s, background 0.15s;
}

.upload-item.done { border-color: #86efac; background: var(--ok-bg); }
.upload-item.uploading { border-color: #93c5fd; background: #eff6ff; }

.upload-item-info { flex: 1; min-width: 0; }

.upload-item-info strong { font-size: 14px; display: block; font-weight: 600; }
.upload-item-info .doc-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 99px;
  margin-bottom: 3px;
}
.doc-badge.required { background: #fee2e2; color: #b91c1c; }
.doc-badge.optional { background: #f1f5f9; color: #64748b; }

.upload-item-info .doc-hint { font-size: 12px; color: var(--muted); }
.upload-item-info .doc-done { font-size: 12px; color: var(--ok); font-weight: 600; }
.upload-item-info .doc-uploading { font-size: 12px; color: #2563eb; }

.upload-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

.btn-upload {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  border: 1.5px solid #cbd5e1;
  border-radius: 7px;
  background: var(--surface);
  cursor: pointer;
  min-height: 40px;
  white-space: nowrap;
  transition: border-color 0.15s;
}

.btn-upload input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 16px;
  width: 100%;
  height: 100%;
}

.btn-view {
  display: inline-flex;
  align-items: center;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  cursor: pointer;
  min-height: 40px;
  text-decoration: none;
}

/* Upload spinner */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #93c5fd;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

/* Alerts */
.alert {
  padding: 12px 14px;
  border-radius: 9px;
  font-size: 14px;
  margin-bottom: 14px;
  line-height: 1.5;
}

.alert-error { background: var(--err-bg); color: var(--err); border: 1px solid #fecaca; }
.alert-ok { background: var(--ok-bg); color: #047857; border: 1px solid #a7f3d0; }
.alert-info { background: var(--info-bg); color: #0369a1; border: 1px solid #bae6fd; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border-radius: 9px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  min-height: 48px;
  touch-action: manipulation;
  transition: opacity 0.15s, background 0.15s;
}

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

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active:not(:disabled) { background: var(--primary-dark); }

.btn-secondary { background: #f1f5f9; color: #475569; border: 1px solid var(--border); }
.btn-secondary:active { background: #e2e8f0; }

/* Actions bar */
.wizard-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.wizard-actions .btn { flex: 1; }

/* Experience block */
.exp-block {
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
  position: relative;
}

.exp-block-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 14px;
}

.btn-remove-exp {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #fee2e2;
  color: #b91c1c;
  border: none;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  min-height: 32px;
}

.btn-add-exp {
  width: 100%;
  padding: 13px;
  background: #eff6ff;
  color: var(--primary);
  border: 1.5px dashed var(--primary);
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 8px;
  min-height: 48px;
  touch-action: manipulation;
}

/* Success */
.success-box {
  text-align: center;
  padding: 40px 16px;
}

.success-box h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.success-box p {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 24px;
}

/* Section divider */
.section-divider {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin: 20px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1.5px solid #dbeafe;
}

/* Conditional info box */
.info-box {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 9px;
  padding: 12px 14px;
  font-size: 13px;
  color: #0369a1;
  margin-bottom: 14px;
}

/* ── MOBILE ── */
@media (max-width: 640px) {
  .page-main { padding: 0 0 88px; }

  .wizard-card { border-radius: 0; border-left: none; border-right: none; border-top: none; }

  .wizard-brand,
  .wizard-head,
  .wizard-progress { padding-left: 16px; padding-right: 16px; }

  .wizard-body { padding: 16px 16px 100px; }

  .wizard-brand { padding-top: 14px; padding-bottom: 14px; }
  .brand-logo { height: 38px; }
  .link-login { padding: 7px 12px; font-size: 13px; }

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

  .upload-item { flex-direction: column; align-items: stretch; gap: 10px; }
  .upload-actions { justify-content: flex-start; }

  /* Fixed bottom bar on mobile */
  .wizard-actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    background: rgba(255,255,255,0.97);
    border-top: 1px solid var(--border);
    z-index: 50;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
}

@media (min-width: 641px) {
  .wizard-card { margin-top: 8px; margin-bottom: 32px; }
}
