/* ══════════════════════════════════════════
   style.css — ExamFit
   Aesthetic: Refined utility with bold ink accents
   Font: Syne (display) + DM Sans (body)
══════════════════════════════════════════ */

/* ── Custom Properties ─────────────────── */
:root {
  --bg:          #F7F6F2;
  --bg-2:        #EEECE6;
  --surface:     #FFFFFF;
  --surface-2:   #F2F0EB;
  --border:      #DEDAD1;
  --ink:         #1A1814;
  --ink-2:       #5A5750;
  --ink-3:       #8A8680;
  --accent:      #D4451A;
  --accent-2:    #F0622E;
  --accent-glow: rgba(212, 69, 26, 0.15);
  --green:       #2D7A4F;
  --yellow:      #C89A2A;
  --radius:      12px;
  --radius-lg:   20px;
  --shadow:      0 2px 12px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md:   0 8px 32px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.06);
  --font-head:   'Syne', sans-serif;
  --font-body:   'DM Sans', sans-serif;
  --transition:  0.22s ease;
}

[data-theme="dark"] {
  --bg:          #111009;
  --bg-2:        #1A1916;
  --surface:     #211F1B;
  --surface-2:   #2A2824;
  --border:      #3A3830;
  --ink:         #F0EDE6;
  --ink-2:       #AAA79F;
  --ink-3:       #706D65;
  --accent:      #E85D30;
  --accent-2:    #FF7040;
  --accent-glow: rgba(232, 93, 48, 0.18);
  --shadow:      0 2px 12px rgba(0,0,0,0.30), 0 1px 3px rgba(0,0,0,0.20);
  --shadow-md:   0 8px 32px rgba(0,0,0,0.40), 0 2px 8px rgba(0,0,0,0.25);
}

/* ── Reset ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
  transition: background var(--transition), color var(--transition);
}
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
input, select { font-family: inherit; }

/* ── Container ─────────────────────────── */
.container {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Utility ───────────────────────────── */
.hidden { display: none !important; }

/* ══════════════════════════════════════════
   HEADER
══════════════════════════════════════════ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  backdrop-filter: blur(12px);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex; align-items: center; gap: 8px;
}
.logo-icon {
  font-size: 22px; color: var(--accent);
}
.logo-text {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--ink);
}

/* Dark toggle */
.dark-toggle {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 6px 14px;
  display: flex; gap: 6px; align-items: center;
  font-size: 14px;
  transition: background var(--transition), border var(--transition);
}
.dark-toggle:hover { background: var(--border); }
.toggle-icon { transition: opacity 0.2s; }
[data-theme="dark"] .sun  { opacity: 0.35; }
[data-theme="dark"] .moon { opacity: 1; }
[data-theme="light"] .sun  { opacity: 1; }
[data-theme="light"] .moon { opacity: 0.35; }

/* ══════════════════════════════════════════
   HERO
══════════════════════════════════════════ */
.hero {
  position: relative;
  overflow: hidden;
  padding: 72px 0 60px;
  text-align: center;
}
.hero-bg-shape {
  position: absolute;
  top: -120px; right: -200px;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
}
.hero-content { position: relative; z-index: 1; }

.badge {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 5px 16px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  margin-bottom: 24px;
}

.hero h1 {
  font-family: var(--font-head);
  font-size: clamp(36px, 6vw, 68px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -2px;
  color: var(--ink);
  margin-bottom: 20px;
}
.hero-highlight {
  color: var(--accent);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: clamp(15px, 2.5vw, 18px);
  color: var(--ink-2);
  max-width: 560px;
  margin: 0 auto 40px;
  font-weight: 300;
}

/* Step pills */
.step-pills {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.pill {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 18px;
  border-radius: 99px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  transition: all var(--transition);
}
.pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 16px var(--accent-glow);
}
.pill.complete {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--green);
}
.pill-num {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 11px;
  width: 20px; height: 20px;
  background: rgba(255,255,255,0.25);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.pill.active .pill-num { background: rgba(255,255,255,0.3); }
.pill-arrow { color: var(--ink-3); font-size: 18px; }

/* ══════════════════════════════════════════
   APP MAIN
══════════════════════════════════════════ */
.app-main { padding-bottom: 80px; }

.step-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.step-title {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 24px;
  display: flex; align-items: center; gap: 12px;
}
.step-num {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 1px;
}

/* ── Exam Grid ──────────────────────────── */
.exam-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.exam-card {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px;
  padding: 20px 12px;
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.exam-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--exam-color, var(--accent));
  transform: scaleX(0);
  transition: transform var(--transition);
  transform-origin: left;
}
.exam-card:hover::before,
.exam-card.selected::before { transform: scaleX(1); }
.exam-card:hover {
  border-color: var(--exam-color, var(--accent));
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.exam-card.selected {
  border-color: var(--exam-color, var(--accent));
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--exam-color, var(--accent)) 20%, transparent);
}
.exam-icon { font-size: 28px; line-height: 1; }
.exam-name {
  font-family: var(--font-head);
  font-size: 16px; font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.3px;
}
.exam-label {
  font-size: 10px;
  color: var(--ink-3);
  text-align: center;
  line-height: 1.3;
}

/* ── Doc Type ───────────────────────────── */
.sub-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 12px;
}
.doc-type-grid {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-bottom: 20px;
}
.doc-btn {
  padding: 10px 22px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 99px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  transition: all var(--transition);
}
.doc-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.doc-btn.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 16px var(--accent-glow);
}

/* ── Custom inputs ──────────────────────── */
.text-btn {
  background: none; border: none;
  font-size: 13px;
  color: var(--ink-3);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0;
  margin-top: 4px;
}
.text-btn:hover { color: var(--accent); }

.custom-inputs { margin-top: 24px; }
.custom-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.custom-grid label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 12px; font-weight: 600;
  color: var(--ink-2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.custom-grid input,
.custom-grid select {
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 15px;
  transition: border var(--transition);
}
.custom-grid input:focus,
.custom-grid select:focus {
  outline: none;
  border-color: var(--accent);
}

/* ── Req Card ───────────────────────────── */
.req-card {
  margin-top: 24px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.req-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.req-badge {
  font-family: var(--font-head);
  font-size: 14px; font-weight: 700;
  background: var(--accent);
  color: #fff;
  padding: 4px 12px;
  border-radius: 99px;
}
.req-change {
  font-size: 13px;
  color: var(--ink-3);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.req-change:hover { color: var(--accent); }
.req-stats {
  display: flex; flex-wrap: wrap; gap: 16px;
  align-items: flex-start;
}
.req-stat {
  display: flex; flex-direction: column;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  min-width: 100px;
}
.req-stat-val {
  font-family: var(--font-head);
  font-size: 20px; font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--ink);
}
.req-stat-lbl {
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.req-tip {
  width: 100%;
  margin-top: 8px;
  font-size: 13px;
  color: var(--ink-2);
  background: var(--surface);
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left: 3px solid var(--yellow);
}

/* ══════════════════════════════════════════
   DROP ZONE
══════════════════════════════════════════ */
.drop-zone {
  border: 2.5px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 60px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--surface-2);
}
.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-glow);
}
.drop-zone.drag-over { transform: scale(1.01); }
.drop-icon {
  font-size: 48px;
  margin-bottom: 16px;
  transition: transform 0.2s;
}
.drop-zone:hover .drop-icon { transform: scale(1.1); }
.drop-title {
  font-family: var(--font-head);
  font-size: 20px; font-weight: 700;
  margin-bottom: 8px;
}
.drop-sub {
  font-size: 14px;
  color: var(--ink-3);
  margin-bottom: 24px;
}

/* ── Error Box ──────────────────────────── */
.error-box {
  margin-top: 16px;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  background: #FEF2F0;
  border: 1.5px solid #F5C6BB;
  border-radius: var(--radius);
  color: #B33A1F;
  font-size: 14px;
  font-weight: 500;
}
[data-theme="dark"] .error-box {
  background: rgba(200, 60, 30, 0.12);
  border-color: rgba(200, 60, 30, 0.3);
  color: #FF8060;
}
.error-icon { font-size: 18px; }

/* ══════════════════════════════════════════
   PROGRESS
══════════════════════════════════════════ */
.progress-wrap {
  margin-bottom: 28px;
}
.progress-label {
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 10px;
  font-weight: 500;
}
.progress-track {
  height: 8px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 99px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ══════════════════════════════════════════
   PREVIEW GRID
══════════════════════════════════════════ */
.preview-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: start;
  margin-bottom: 28px;
}
.preview-arrow {
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  color: var(--ink-3);
  padding-top: 60px;
}
.preview-card {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.preview-card:hover { box-shadow: var(--shadow-md); }
.preview-card.result { border-color: var(--accent); }
.preview-tag {
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.preview-tag.before {
  background: var(--border);
  color: var(--ink-2);
}
.preview-tag.after {
  background: var(--accent);
  color: #fff;
}
.preview-img-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  min-height: 160px;
  background: repeating-conic-gradient(var(--bg-2) 0% 25%, transparent 0% 50%) 0 0 / 20px 20px;
}
.preview-img-wrap img {
  max-height: 220px;
  max-width: 100%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: var(--shadow);
}
.preview-meta {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--ink-2);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.over-limit  { color: #B33A1F !important; }
.ok-limit    { color: var(--green) !important; }
.warn-badge  { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 4px; background: #FEF2F0; color: #B33A1F; font-size: 11px; font-weight: 600; }
.ok-badge    { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 4px; background: #EAF7F0; color: var(--green); font-size: 11px; font-weight: 600; }
[data-theme="dark"] .warn-badge { background: rgba(200,60,30,0.15); }
[data-theme="dark"] .ok-badge   { background: rgba(45,122,79,0.15); }

/* ══════════════════════════════════════════
   ACTION ROW
══════════════════════════════════════════ */
.action-row {
  display: flex; gap: 14px; align-items: center;
  flex-wrap: wrap;
}
.btn-primary,
.btn-download,
.btn-outline,
.btn-ghost {
  padding: 14px 28px;
  border-radius: var(--radius);
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 700;
  border: none;
  transition: all var(--transition);
  letter-spacing: -0.2px;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-primary:hover { background: var(--accent-2); transform: translateY(-1px); }

.btn-download {
  background: var(--ink);
  color: var(--bg);
  box-shadow: var(--shadow-md);
  font-size: 17px;
  padding: 16px 36px;
}
.btn-download:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(0,0,0,0.18); }

.btn-outline {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--ink-2);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-ghost {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  color: var(--ink-2);
}
.btn-ghost:hover { background: var(--border); }

/* ══════════════════════════════════════════
   INFO SECTION
══════════════════════════════════════════ */
.info-section {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  padding: 64px 0;
}
.info-title {
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 32px;
  color: var(--ink);
}
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.info-block {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-top: 3px solid var(--exam-color, var(--accent));
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.info-block-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.info-table th {
  padding: 8px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.info-table td {
  padding: 10px 16px;
  color: var(--ink-2);
  border-bottom: 1px solid var(--border);
}
.info-table tr:last-child td { border-bottom: none; }
.info-table tr:hover td { background: var(--surface-2); }

/* ══════════════════════════════════════════
   FOOTER
══════════════════════════════════════════ */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 24px 0;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-note {
  font-size: 13px;
  color: var(--ink-3);
}

/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */
@media (max-width: 768px) {
  .hero { padding: 48px 0 40px; }
  .step-section { padding: 24px 18px; }

  .exam-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
  }
  .exam-card { padding: 16px 8px; }
  .exam-icon { font-size: 24px; }
  .exam-name { font-size: 14px; }

  .preview-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .preview-arrow {
    padding-top: 0;
    transform: rotate(90deg);
    justify-content: center;
  }

  .action-row { flex-direction: column; }
  .btn-download { width: 100%; text-align: center; }
  .btn-ghost    { width: 100%; text-align: center; }

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

  .footer-inner { flex-direction: column; text-align: center; }
  .step-pills { gap: 6px; }
  .pill { font-size: 12px; padding: 7px 14px; }
  .pill-arrow { font-size: 14px; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 32px; letter-spacing: -1px; }
  .custom-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Scroll reveal animation ── */
.step-section {
  animation: none;
}
.step-section:not(.hidden) {
  animation: slideUp 0.4s ease both;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════
   FIX 4 — ACCESSIBILITY: Focus styles & sr-only
══════════════════════════════════════════ */

/* Visually hidden but accessible to screen readers */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Visible focus rings for keyboard users */
:focus-visible {
  outline: 2.5px solid var(--accent) !important;
  outline-offset: 3px !important;
  border-radius: var(--radius) !important;
}

/* Exam/doc buttons — enhanced focus */
.exam-card:focus-visible,
.doc-btn:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 3px;
  box-shadow: 0 0 0 5px var(--accent-glow);
}

/* Drop zone focus */
.drop-zone:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 4px;
  border-color: var(--accent);
}

/* ══════════════════════════════════════════
   MODAL BASE
══════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeOverlay 0.2s ease;
}
@keyframes fadeOverlay {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.modal-overlay.hidden { display: none !important; }

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUpModal 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes slideUpModal {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-box--sm  { max-width: 440px; }
.modal-box--crop { max-width: 820px; }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.modal-header h3 {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--ink);
}
.modal-sub {
  font-size: 13px;
  color: var(--ink-3);
  margin-top: 4px;
}
.modal-close {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  color: var(--ink-2);
  flex-shrink: 0;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--border); color: var(--ink); }

.modal-body-text {
  padding: 20px 24px;
  font-size: 15px;
  color: var(--ink-2);
  line-height: 1.6;
}
.modal-body-text code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 13px;
  color: var(--accent);
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}

/* ══════════════════════════════════════════
   FIX 6 — CROP TOOL
══════════════════════════════════════════ */
.crop-workspace {
  position: relative;
  overflow: hidden;
  background: #0a0a0a;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  flex: 1;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#cropCanvas {
  display: block;
  max-width: 100%;
}

.crop-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.crop-box {
  position: absolute;
  border: 2px solid #fff;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.50);
  cursor: move;
  pointer-events: all;
  box-sizing: border-box;
}

/* Rule-of-thirds grid lines */
.crop-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.crop-lines div:nth-child(1) {
  position: absolute;
  left: 33.33%; top: 0; bottom: 0;
  width: 1px;
  background: rgba(255,255,255,0.25);
}
.crop-lines div:nth-child(2) {
  position: absolute;
  left: 66.66%; top: 0; bottom: 0;
  width: 1px;
  background: rgba(255,255,255,0.25);
}
.crop-lines div:nth-child(3) {
  position: absolute;
  top: 33.33%; left: 0; right: 0;
  height: 1px;
  background: rgba(255,255,255,0.25);
}
.crop-lines div:nth-child(4) {
  position: absolute;
  top: 66.66%; left: 0; right: 0;
  height: 1px;
  background: rgba(255,255,255,0.25);
}

/* Corner handles */
.crop-handle {
  position: absolute;
  width: 14px; height: 14px;
  background: #fff;
  border: 2px solid var(--accent);
  border-radius: 2px;
  pointer-events: all;
}
.crop-handle.nw { top: -7px;  left: -7px;  cursor: nw-resize; }
.crop-handle.ne { top: -7px;  right: -7px; cursor: ne-resize; }
.crop-handle.sw { bottom: -7px; left: -7px;  cursor: sw-resize; }
.crop-handle.se { bottom: -7px; right: -7px; cursor: se-resize; }

.crop-info {
  font-size: 13px;
  color: var(--ink-3);
  font-family: var(--font-head);
  font-weight: 600;
}

/* ══════════════════════════════════════════
   FIX 7 — NAME INPUT MODAL
══════════════════════════════════════════ */
.name-input-wrap {
  padding: 4px 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.name-input-wrap input {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 16px;
  font-family: var(--font-body);
  transition: border var(--transition);
}
.name-input-wrap input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.name-preview {
  font-size: 13px;
  color: var(--ink-3);
  font-family: monospace;
  background: var(--surface-2);
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  min-height: 36px;
}

/* ══════════════════════════════════════════
   RESPONSIVE — Modals
══════════════════════════════════════════ */
@media (max-width: 768px) {
  .modal-header { padding: 16px 18px 12px; }
  .modal-body-text { padding: 16px 18px; }
  .modal-footer { padding: 12px 18px; }
  .name-input-wrap { padding: 4px 18px 16px; }
  .modal-actions { width: 100%; }
  .modal-actions .btn-ghost,
  .modal-actions .btn-primary { flex: 1; text-align: center; }
  .crop-handle { width: 18px; height: 18px; }
}

/* ══════════════════════════════════════════
   HEADER CONTROLS (Issue 5 — lang toggle)
══════════════════════════════════════════ */
.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-toggle {
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-2);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.lang-toggle:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ══════════════════════════════════════════
   ISSUE 2 — Crop Loading Overlay
══════════════════════════════════════════ */
.crop-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border-radius: var(--radius-lg);
  color: #fff;
  font-size: 0.95rem;
  z-index: 10;
}
.crop-spinner {
  width: 40px; height: 40px;
  border: 4px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════
   ISSUE 4 — History Section
══════════════════════════════════════════ */
.history-section {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  padding: 48px 0 32px;
}
.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}
.history-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition);
}
.history-item:hover { box-shadow: var(--shadow-md); }
.history-thumb-wrap {
  width: 48px; height: 48px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.history-thumb {
  width: 100%; height: 100%;
  object-fit: cover;
}
.history-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.history-exam {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--accent);
}
.history-doc {
  font-size: 0.82rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-size {
  font-size: 0.76rem;
  color: var(--ink-3);
}
.history-dl {
  flex-shrink: 0;
  padding: 6px 14px;
  font-size: 1rem;
  text-decoration: none;
  border-radius: var(--radius);
}
@media (max-width: 480px) {
  .history-item { flex-wrap: wrap; }
  .history-info { min-width: calc(100% - 70px); }
}

/* ══════════════════════════════════════════
   TOOL TABS NAVIGATION
══════════════════════════════════════════ */
.tool-tabs {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 57px;
  z-index: 90;
}
.tabs-inner {
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tabs-inner::-webkit-scrollbar { display: none; }
.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 22px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-3);
  white-space: nowrap;
  transition: all var(--transition);
  cursor: pointer;
  letter-spacing: -0.1px;
}
.tab-btn:hover {
  color: var(--ink);
  background: var(--surface-2);
}
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: transparent;
}
.tab-icon { font-size: 16px; }

/* Tab Panels */
.tab-panel {
  padding-top: 36px;
}

/* ══════════════════════════════════════════
   TOOL HEADER (used in Remove BG, PDF, ZIP tabs)
══════════════════════════════════════════ */
.tool-header {
  margin-bottom: 28px;
}
.tool-header .step-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.tool-desc {
  font-size: 15px;
  color: var(--ink-2);
  font-weight: 300;
  max-width: 600px;
}
.tab-icon-lg { font-size: 26px; }

/* ══════════════════════════════════════════
   TOOL CARD (shared container for options)
══════════════════════════════════════════ */
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

/* ══════════════════════════════════════════
   REMOVE BG STYLES
══════════════════════════════════════════ */
.api-key-row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.api-key-info {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.api-key-info strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.api-key-note {
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.5;
}
.api-key-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 220px;
}
.api-key-input-wrap input {
  flex: 1;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 14px;
  transition: border var(--transition);
  font-family: monospace;
}
.api-key-input-wrap input:focus {
  outline: none;
  border-color: var(--accent);
}
.btn-sm {
  padding: 8px 14px !important;
  font-size: 14px !important;
}

/* Checkerboard bg for transparency preview */
.checkerboard {
  background-image:
    repeating-conic-gradient(#c0c0c0 0% 25%, #fff 0% 50%) !important;
  background-size: 16px 16px !important;
}
[data-theme="dark"] .checkerboard {
  background-image:
    repeating-conic-gradient(#333 0% 25%, #1a1a1a 0% 50%) !important;
}

.rb-result { margin-top: 20px; }
.rb-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
  align-items: center;
}
.rb-white-result {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

/* ══════════════════════════════════════════
   PDF CONVERTER STYLES
══════════════════════════════════════════ */
.pdf-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
}
.pdf-opt-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.pdf-opt-label select {
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 14px;
  transition: border var(--transition);
}
.pdf-opt-label select:focus {
  outline: none;
  border-color: var(--accent);
}

.pdf-file-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 20px 0;
}
.pdf-file-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition);
}
.pdf-file-item:hover { box-shadow: var(--shadow-md); }
.pdf-thumb {
  width: 48px; height: 48px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  flex-shrink: 0;
}
.pdf-file-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.pdf-file-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pdf-file-size {
  font-size: 12px;
  color: var(--ink-3);
}
.pdf-remove-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  color: var(--ink-3);
  flex-shrink: 0;
  transition: all var(--transition);
}
.pdf-remove-btn:hover { background: #FEF2F0; color: #B33A1F; border-color: #F5C6BB; }

.pdf-action-row {
  display: flex;
  gap: 14px;
  margin-top: 20px;
  flex-wrap: wrap;
  align-items: center;
}

/* ══════════════════════════════════════════
   ZIP / EXAM DOCUMENTS STYLES
══════════════════════════════════════════ */
.zip-exam-label {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
  color: var(--ink-2);
}
.zip-exam-label strong {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.zip-exam-label select {
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 15px;
  max-width: 320px;
  transition: border var(--transition);
}
.zip-exam-label select:focus {
  outline: none;
  border-color: var(--accent);
}

.zip-doc-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 20px 0;
}
.zip-doc-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition);
}
.zip-doc-row:hover { box-shadow: var(--shadow-md); }
.zip-doc-info {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.zip-doc-label {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}
.zip-doc-spec {
  font-size: 13px;
  color: var(--ink-3);
  font-family: monospace;
}
.zip-doc-tip {
  font-size: 12px;
  color: var(--ink-2);
  margin-top: 4px;
  background: var(--surface-2);
  padding: 6px 10px;
  border-radius: 6px;
  border-left: 2px solid var(--yellow);
}
.zip-doc-upload {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.zip-upload-btn {
  font-size: 13px !important;
  padding: 9px 16px !important;
  white-space: nowrap;
}
.zip-file-chosen {
  font-size: 13px;
  color: var(--ink-3);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.zip-status {
  font-size: 16px;
  font-weight: 700;
  min-width: 20px;
}

.zip-note {
  font-size: 13px;
  color: var(--ink-3);
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  line-height: 1.6;
}
.zip-note code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12px;
  color: var(--accent);
}

/* error-box in new tools: plain text (no flex with icon) */
#rbErrorBox,
#pdfErrorBox,
#zipErrorBox {
  display: block;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  background: #FEF2F0;
  border: 1.5px solid #F5C6BB;
  color: #B33A1F;
  margin-top: 12px;
}
[data-theme="dark"] #rbErrorBox,
[data-theme="dark"] #pdfErrorBox,
[data-theme="dark"] #zipErrorBox {
  background: rgba(200, 60, 30, 0.12);
  border-color: rgba(200, 60, 30, 0.3);
  color: #FF8060;
}


/* ══════════════════════════════════════════
   ZIP DOCUMENTS — Enhanced UI
══════════════════════════════════════════ */

/* Progress Counter */
.zip-progress-counter {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.zip-counter-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.zip-counter-text span {
  font-family: monospace;
  color: var(--accent);
  font-weight: 700;
}
.zip-counter-bar {
  width: 100%;
  height: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}
.zip-counter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.3s ease;
  border-radius: 4px;
}

/* Document Grid Layout */
.zip-doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
  margin: 24px 0;
}

/* Document Card */
.zip-doc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.zip-doc-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}
.zip-doc-card.has-file {
  border-color: var(--green);
}

/* Card Header with doc name & status */
.zip-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.zip-doc-name {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.zip-doc-title {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.zip-doc-spec {
  font-size: 12px;
  color: var(--ink-3);
  font-family: monospace;
  line-height: 1.4;
}

/* Status Badge */
.zip-status-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}
.zip-status-badge.missing {
  background: var(--surface-2);
  color: var(--ink-3);
}
.zip-status-badge.uploaded {
  background: rgba(45, 122, 79, 0.12);
  color: var(--green);
}
.zip-status-badge.processed {
  background: rgba(45, 122, 79, 0.12);
  color: var(--green);
}

/* Preview Area */
.zip-preview-area {
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.zip-preview-area.empty {
  color: var(--ink-3);
  font-size: 13px;
  text-align: center;
  padding: 16px;
}
.zip-preview-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* File Info */
.zip-file-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-3);
}
.zip-file-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.zip-file-name {
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}
.zip-file-size {
  font-family: monospace;
  color: var(--ink-2);
}

/* Action Buttons */
.zip-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.zip-upload-btn,
.zip-replace-btn {
  flex: 1;
  min-width: 120px;
  padding: 10px 14px !important;
  font-size: 13px !important;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
}
.zip-upload-btn {
  background: var(--accent-glow);
  color: var(--accent);
  border: 1.5px solid var(--accent);
}
.zip-upload-btn:hover {
  background: var(--accent);
  color: white;
}
.zip-replace-btn {
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1.5px solid var(--border);
}
.zip-replace-btn:hover {
  background: var(--border);
  color: var(--ink);
}
.zip-remove-btn {
  background: transparent;
  color: var(--ink-3);
  border: 1.5px solid var(--border);
  padding: 10px 12px !important;
  font-size: 12px !important;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition);
}
.zip-remove-btn:hover {
  background: rgba(200, 60, 30, 0.08);
  border-color: #E85D30;
  color: #E85D30;
}

/* Tips */
.zip-doc-tip {
  font-size: 12px;
  color: var(--ink-2);
  background: var(--surface-2);
  padding: 8px 12px;
  border-radius: 6px;
  border-left: 2px solid var(--yellow);
  line-height: 1.4;
}

/* Action Row */
.zip-action-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 20px;
  flex-wrap: wrap;
}
.zip-action-row .btn-download,
.zip-action-row .btn-ghost {
  flex: 1;
  min-width: 140px;
}

/* Updated Note */
.zip-note {
  font-size: 13px;
  color: var(--ink-3);
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  line-height: 1.6;
}
.zip-note strong {
  color: var(--ink);
  font-weight: 700;
}
.zip-note code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 12px;
  color: var(--accent);
}

/* ══════════════════════════════════════════
   RESPONSIVE — ZIP
══════════════════════════════════════════ */
@media (max-width: 768px) {
  .zip-doc-grid {
    grid-template-columns: 1fr;
  }
  .zip-action-row {
    flex-direction: column;
  }
  .zip-action-row .btn-download,
  .zip-action-row .btn-ghost {
    width: 100%;
  }
  .zip-card-actions {
    flex-direction: column;
  }
  .zip-upload-btn,
  .zip-replace-btn {
    min-width: unset;
  }
}

/* ══════════════════════════════════════════
   RESPONSIVE — New Tabs & Features
══════════════════════════════════════════ */
@media (max-width: 768px) {
  .tool-tabs { top: 53px; }
  .tab-btn { padding: 13px 14px; font-size: 13px; gap: 6px; }
  .tool-card { padding: 18px; }
  .api-key-row { flex-direction: column; }
  .api-key-input-wrap { width: 100%; }
  .pdf-options-grid { grid-template-columns: 1fr 1fr; }
  .zip-doc-row { gap: 14px; }
  .zip-doc-upload { width: 100%; }
  .rb-actions { flex-direction: column; }
  .rb-actions .btn-primary,
  .rb-actions .btn-outline { width: 100%; text-align: center; }
  .pdf-action-row { flex-direction: column; }
  .pdf-action-row .btn-download,
  .pdf-action-row .btn-ghost { width: 100%; text-align: center; }
}

@media (max-width: 480px) {
  .tab-btn { font-size: 12px; padding: 11px 10px; gap: 4px; }
  .tab-icon { font-size: 14px; }
  .pdf-options-grid { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════
   NEW SECTIONS — ExamFit v3.0
══════════════════════════════════════════ */

/* ── Header Nav ─────────────────────────── */
.header-nav {
  display: flex; gap: 24px; align-items: center;
}
.header-nav-link {
  font-size: 14px; font-weight: 500;
  color: var(--ink-2); text-decoration: none;
  transition: color var(--transition);
}
.header-nav-link:hover { color: var(--accent); }
@media (max-width: 640px) { .header-nav { display: none; } }

/* ── Hero CTA ───────────────────────────── */
.hero-cta-row {
  display: flex; align-items: center; gap: 16px;
  justify-content: center; flex-wrap: wrap;
  margin-top: 28px;
}
.hero-cta {
  display: inline-block; text-decoration: none;
  padding: 14px 32px; font-size: 16px; font-weight: 700;
  border-radius: 99px; background: var(--accent); color: #fff;
  transition: background var(--transition), transform 0.15s;
  box-shadow: 0 4px 16px var(--accent-glow);
}
.hero-cta:hover { background: var(--accent-2); transform: translateY(-2px); }
.hero-sub-note {
  font-size: 13px; color: var(--ink-3);
}
.hero-stats {
  display: flex; justify-content: center; gap: 40px;
  margin-top: 40px; flex-wrap: wrap;
}
.hero-stat {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.hero-stat-num {
  font-family: var(--font-head); font-size: 28px; font-weight: 800;
  color: var(--accent);
}
.hero-stat-lbl {
  font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em;
}

/* ── How It Works ───────────────────────── */
.how-section {
  padding: 72px 0;
  background: var(--bg-2);
}
.section-title {
  font-family: var(--font-head); font-size: clamp(22px, 4vw, 32px);
  font-weight: 800; text-align: center; color: var(--ink);
  margin-bottom: 8px;
}
.section-sub {
  text-align: center; color: var(--ink-2); font-size: 15px;
  margin-bottom: 48px;
}
.how-steps {
  display: flex; align-items: flex-start; gap: 16px;
  flex-wrap: wrap; justify-content: center;
}
.how-step {
  flex: 1; min-width: 200px; max-width: 280px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 32px 20px;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.how-step:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.how-step-num {
  font-family: var(--font-head); font-size: 48px; font-weight: 800;
  color: var(--accent); opacity: 0.15; line-height: 1;
  margin-bottom: -12px;
}
.how-step-icon { font-size: 36px; margin-bottom: 16px; }
.how-step-title {
  font-family: var(--font-head); font-size: 17px; font-weight: 700;
  color: var(--ink); margin-bottom: 8px;
}
.how-step-desc { font-size: 14px; color: var(--ink-2); line-height: 1.6; }
.how-arrow {
  font-size: 28px; color: var(--ink-3); padding-top: 80px;
  flex-shrink: 0;
}
@media (max-width: 640px) { .how-arrow { display: none; } }

/* ── Features ───────────────────────────── */
.features-section {
  padding: 72px 0;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}
.feature-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px 24px;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.feature-card:hover {
  transform: translateY(-3px); box-shadow: var(--shadow-md);
  border-color: var(--accent-glow);
}
.feature-card--future { opacity: 0.6; }
.feature-icon { font-size: 28px; margin-bottom: 12px; }
.feature-card h3 {
  font-family: var(--font-head); font-size: 15px; font-weight: 700;
  color: var(--ink); margin-bottom: 8px;
}
.feature-card p { font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.coming-soon {
  font-size: 10px; background: var(--bg-2); color: var(--ink-3);
  border-radius: 99px; padding: 2px 8px; vertical-align: middle;
  margin-left: 6px; text-transform: uppercase; letter-spacing: 0.05em;
}

/* ── Requirement Cards in Info Grid ─────── */
.req-doc-cards {
  display: flex; flex-direction: column; gap: 10px;
  margin-top: 12px;
}
.req-doc-card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
}
.req-doc-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.req-doc-label { font-weight: 600; font-size: 14px; color: var(--ink); }
.req-badge-sm {
  font-size: 10px; border-radius: 99px; padding: 2px 8px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
}
.req-badge-sm.required { background: rgba(212,69,26,0.12); color: var(--accent); }
.req-badge-sm.optional { background: var(--bg-2); color: var(--ink-3); }
.req-doc-stats {
  display: flex; gap: 12px; font-size: 12px; color: var(--ink-2);
  margin-bottom: 8px; flex-wrap: wrap;
}
.req-use-btn {
  font-size: 12px; background: var(--accent); color: #fff;
  border: none; border-radius: var(--radius); padding: 5px 12px;
  cursor: pointer; font-weight: 600;
  transition: background var(--transition);
}
.req-use-btn:hover { background: var(--accent-2); }

/* ── Guidelines in Req Card ─────────────── */
.req-guidelines {
  margin-top: 16px; padding: 14px;
  background: var(--bg-2); border-radius: var(--radius);
  border-left: 3px solid var(--accent);
}
.req-guidelines-title {
  font-weight: 700; font-size: 13px; color: var(--ink);
  margin-bottom: 8px;
}
.req-guidelines-list {
  list-style: none; display: flex; flex-direction: column; gap: 4px;
}
.req-guidelines-list li {
  font-size: 12px; color: var(--ink-2); padding-left: 12px;
  position: relative;
}
.req-guidelines-list li::before {
  content: '•'; position: absolute; left: 0; color: var(--accent);
}

/* ── Remove BG Suggestion (Bug 3) ────────── */
.removebg-suggestion {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; flex-wrap: wrap;
  padding: 14px 20px; margin-top: 16px;
  background: var(--bg-2); border-radius: var(--radius);
  border: 1px dashed var(--border); font-size: 14px; color: var(--ink-2);
}
.removebg-suggest-btn {
  font-size: 13px; padding: 7px 16px;
}

/* ── Clear History Button ────────────────── */
.clear-history-btn {
  display: block; margin: 16px auto 0;
  font-size: 13px; color: var(--ink-3);
}
.clear-history-btn:hover { color: var(--accent); }

/* ── Doc type button sub text ────────────── */
.doc-btn small {
  display: block; font-size: 11px; color: var(--ink-3);
  font-weight: 400; margin-top: 2px;
}

/* ── FAQ Section ─────────────────────────── */
.faq-section {
  padding: 72px 0;
  background: var(--bg-2);
}
.faq-list {
  max-width: 720px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 8px;
}
.faq-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  transition: border-color 0.2s;
}
.faq-item.open { border-color: var(--accent); }
.faq-question {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 18px 22px;
  background: none; border: none; text-align: left;
  font-family: var(--font-body); font-size: 15px; font-weight: 600;
  color: var(--ink); cursor: pointer;
  transition: color 0.2s;
}
.faq-item.open .faq-question { color: var(--accent); }
.faq-arrow {
  flex-shrink: 0; font-size: 18px; transition: transform 0.3s;
}
.faq-item.open .faq-arrow { transform: rotate(180deg); }
.faq-answer {
  max-height: 0; overflow: hidden;
  transition: max-height 0.4s ease, padding 0.3s;
  padding: 0 22px;
}
.faq-item.open .faq-answer {
  max-height: 300px;
  padding: 0 22px 18px;
}
.faq-answer p {
  font-size: 14px; color: var(--ink-2); line-height: 1.7;
}

/* ── Privacy Section ─────────────────────── */
.privacy-section {
  padding: 48px 0;
}
.privacy-card {
  display: flex; align-items: flex-start; gap: 28px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 36px;
  box-shadow: var(--shadow);
}
.privacy-icon { font-size: 48px; flex-shrink: 0; }
.privacy-content h2 {
  font-family: var(--font-head); font-size: 22px; font-weight: 800;
  color: var(--ink); margin-bottom: 10px;
}
.privacy-content p {
  font-size: 14px; color: var(--ink-2); line-height: 1.7;
  margin-bottom: 16px;
}
.privacy-list {
  list-style: none; display: flex; flex-direction: column; gap: 6px;
}
.privacy-list li {
  font-size: 13px; color: var(--ink-2);
}
@media (max-width: 640px) {
  .privacy-card { flex-direction: column; gap: 16px; padding: 24px; }
}

/* ── Footer Updates ──────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 40px 0 24px;
}
.footer-inner {
  display: flex; flex-direction: column; align-items: center;
  gap: 20px; text-align: center;
}
.footer-brand {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.footer-tagline {
  font-size: 13px; color: var(--ink-3);
}
.footer-links {
  display: flex; gap: 24px; flex-wrap: wrap; justify-content: center;
}
.footer-link {
  font-size: 13px; color: var(--ink-2); text-decoration: none;
  transition: color var(--transition);
}
.footer-link:hover { color: var(--accent); }
.footer-note {
  font-size: 12px; color: var(--ink-3); max-width: 480px; line-height: 1.6;
}

/* ── Scroll to top button ────────────────── */
.scroll-top-btn {
  position: fixed; bottom: 24px; right: 24px; z-index: 200;
  width: 44px; height: 44px;
  background: var(--accent); color: #fff;
  border: none; border-radius: 50%;
  font-size: 18px; font-weight: 700;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  transition: background var(--transition), transform 0.2s, opacity 0.2s;
  cursor: pointer;
}
.scroll-top-btn:hover { background: var(--accent-2); transform: translateY(-2px); }
.scroll-top-btn.hidden { opacity: 0; pointer-events: none; }

/* ── Lang toggle ─────────────────────────── */
.lang-toggle {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 99px; padding: 5px 14px;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  margin-right: 6px;
}
.lang-toggle:hover { background: var(--border); color: var(--ink); }

/* ── ZIP doc card updates ────────────────── */
.zip-doc-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  transition: border-color 0.2s;
}
.zip-doc-card.has-file { border-color: var(--green); }

/* ── Info block overrides for new card layout ─ */
.info-block {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  break-inside: avoid;
}
.info-block-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
  font-family: var(--font-head); font-weight: 700; font-size: 16px;
}
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

/* ── PDF preview thumb in ZIP ───────────── */
.pdf-preview-thumb {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 6px;
  font-size: 32px; color: var(--ink-2);
  padding: 16px; height: 100%; min-height: 80px;
}
.pdf-preview-thumb span {
  font-size: 11px; word-break: break-all; text-align: center;
  max-width: 160px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Checkerboard for transparent bg preview ─ */
.checkerboard {
  background-image: linear-gradient(45deg, #ccc 25%, transparent 25%),
    linear-gradient(-45deg, #ccc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ccc 75%),
    linear-gradient(-45deg, transparent 75%, #ccc 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}

/* ══════════════════════════════════════════
   EXAMS MODAL — Overlay & Box
══════════════════════════════════════════ */
.exams-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeInOverlay 0.2s ease;
}
.exams-modal-overlay.hidden { display: none !important; }

@keyframes fadeInOverlay {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.exams-modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%;
  max-width: 900px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.06);
  animation: slideUpModal 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.exams-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 28px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.exams-modal-header h2 {
  font-family: var(--font-head);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink-1);
  margin: 0 0 4px;
  line-height: 1.3;
}
.exams-modal-sub {
  font-size: 0.82rem;
  color: var(--ink-2);
  margin: 0;
}
.exams-modal-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, transform 0.15s;
  line-height: 1;
}
.exams-modal-close:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: rotate(90deg);
}

/* Trigger section */
.info-trigger-section {
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.btn-exams-modal {
  font-size: 1.05rem;
  padding: 14px 32px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(232, 93, 48, 0.25);
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-exams-modal:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(232, 93, 48, 0.35);
}

/* ══════════════════════════════════════════
   EXAM CATEGORY MODAL — Search Bar
══════════════════════════════════════════ */
.exams-modal-search {
  position: relative;
  padding: 14px 28px 0;
  flex-shrink: 0;
}
.ems-search-icon {
  position: absolute;
  left: 44px;
  top: 50%;
  transform: translateY(-30%);
  font-size: 1rem;
  pointer-events: none;
  opacity: 0.55;
}
#examSearchInput {
  width: 100%;
  padding: 10px 16px 10px 40px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-1);
  font-size: 0.92rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}
#examSearchInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232,93,48,0.15);
}
#examSearchInput::placeholder { color: var(--ink-3); }

/* ══════════════════════════════════════════
   EXAM CATEGORY MODAL — updated body
══════════════════════════════════════════ */
.exams-modal-body {
  overflow-y: auto;
  padding: 20px 28px 28px;
  flex: 1 1 auto;
  overscroll-behavior: contain;
}

/* ── Category container grid ── */
.ec-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* ── Category card ── */
.ec-card {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.ec-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  border-color: var(--cat-color, var(--accent));
}

.ec-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1.5px solid var(--border);
}
.ec-icon { font-size: 1.25rem; line-height: 1; }
.ec-name {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink-1);
  flex: 1;
}
.ec-count {
  background: var(--cat-color, var(--accent));
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  min-width: 22px;
  text-align: center;
}

/* ── Exam tag buttons ── */
.ec-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ec-tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.12s, box-shadow 0.15s;
  white-space: nowrap;
}
.ec-tag:hover {
  background: var(--cat-color, var(--accent));
  color: #fff;
  border-color: var(--cat-color, var(--accent));
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0,0,0,0.15);
}
.ec-tag:active { transform: translateY(0); }

/* ── No results ── */
.ec-no-results {
  text-align: center;
  color: var(--ink-3);
  font-size: 0.92rem;
  padding: 40px 20px;
}

/* ══════════════════════════════════════════
   DOC-TYPE PICKER POPOVER
══════════════════════════════════════════ */
.ec-doc-picker {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35), 0 2px 8px rgba(0,0,0,0.15);
  min-width: 260px;
  max-width: 320px;
  /* position:fixed set by JS — z-index ensures it's above modal */
  z-index: 3000 !important;
  animation: pickerIn 0.15s ease forwards;
}
@keyframes pickerIn {
  from { opacity:0; transform:translateY(-4px) scale(0.96); }
  to   { opacity:1; transform:translateY(0) scale(1); }
}
.ec-picker-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 10px;
  line-height: 1.3;
}
.ec-picker-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.ec-picker-btn {
  flex: 1;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-1);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ec-picker-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.ec-picker-dims {
  font-size: 0.75rem;
  color: var(--ink-3);
  min-height: 16px;
  text-align: center;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .ec-container { grid-template-columns: 1fr; }
  .exams-modal-search { padding: 12px 16px 0; }
  .ems-search-icon { left: 32px; }
  .exams-modal-body { padding: 14px 16px 20px; }
}

/* ══════════════════════════════════════════
   MAGIC CROP — AUTO DOCUMENT SCANNER
   Tab badge, layout, canvas, filters, export
══════════════════════════════════════════ */

/* Tab NEW badge — inline, vertically centred inside the flex button */
.tab-btn--new { gap: 6px; }
.tab-new-badge {
  display: inline-flex;
  align-items: center;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.07em;
  padding: 2px 6px;
  border-radius: 99px;
  line-height: 1;
  pointer-events: none;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ── Panel header ── */
.scan-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.scan-subtitle {
  color: var(--ink-2);
  font-size: 15px;
  margin-top: 6px;
  max-width: 600px;
  line-height: 1.6;
}
.scan-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
  padding-top: 4px;
}
.scan-badge {
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid rgba(212,69,26,0.25);
  border-radius: 99px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* ── Upload zone ── */
.scan-upload-zone {
  border: 2.5px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  margin-bottom: 20px;
}
.scan-upload-zone:hover,
.scan-upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-glow);
}
.scan-upload-zone:focus-within { outline: 2px solid var(--accent); }
.scan-upload-icon { font-size: 44px; margin-bottom: 12px; line-height: 1; }
.scan-upload-title { font-family: var(--font-head); font-weight: 700; font-size: 18px; margin-bottom: 6px; color: var(--ink); }
.scan-upload-sub { color: var(--ink-3); font-size: 14px; margin-bottom: 20px; }
.scan-upload-hint { color: var(--ink-3); font-size: 12px; margin-top: 14px; }

/* ── Status / Error ── */
.scan-error {
  background: rgba(212,69,26,0.08);
  border: 1px solid rgba(212,69,26,0.25);
  border-radius: var(--radius);
  color: var(--accent);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 16px;
}
.scan-status {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink-2);
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 20px;
}

/* ── Canvas section ── */
.scan-canvas-section { margin-bottom: 20px; }
.scan-section-title {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}
.scan-canvas-header { margin-bottom: 14px; }
.scan-canvas-hint { color: var(--ink-3); font-size: 13px; }

.scan-canvas-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--bg-2);
  border: 1px solid var(--border);
  line-height: 0;
}
#scanCanvas {
  display: block;
  max-width: 100%;
}
.scan-overlay {
  position: absolute;
  top: 0; left: 0;
  cursor: crosshair;
  touch-action: none;
}

/* ── Loading overlay ── */
.scan-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border-radius: var(--radius);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  backdrop-filter: blur(4px);
  z-index: 10;
}
.scan-spinner {
  width: 38px; height: 38px;
  border: 3.5px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: scanSpin 0.75s linear infinite;
}
@keyframes scanSpin { to { transform: rotate(360deg); } }

/* ── Action bar ── */
.scan-action-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.btn-secondary-scan {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 14px;
  padding: 11px 22px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-secondary-scan:hover { background: var(--accent); color: #fff; }
.btn-ghost-scan {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--border);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 14px;
  padding: 11px 22px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-ghost-scan:hover { background: var(--border); color: var(--ink); }

/* ── Result section ── */
.scan-result-wrap { margin-top: 4px; }
.scan-result-header { margin-bottom: 16px; }

/* Filter row */
.scan-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.scan-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 99px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  transition: all var(--transition);
}
.scan-filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.scan-filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 3px 12px var(--accent-glow);
}
.sfilter-icon { font-size: 14px; }

/* Result canvas */
.scan-result-canvas-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
  padding: 12px;
  margin-bottom: 20px;
  line-height: 0;
  overflow: hidden;
  text-align: center;
}
#scanResultCanvas {
  display: inline-block;
  max-width: 100%;
  border-radius: 4px;
  box-shadow: var(--shadow-md);
}

/* Export row */
.scan-export-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 28px;
}
.scan-kb-input { display: flex; flex-direction: column; gap: 4px; }
.scan-kb-label { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.scan-kb-field {
  width: 130px;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  font-family: var(--font-body);
  transition: border-color var(--transition);
}
.scan-kb-field:focus { outline: none; border-color: var(--accent); }
.scan-dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 14px;
  padding: 12px 22px;
  border-radius: var(--radius);
  cursor: pointer;
  border: none;
  transition: all var(--transition);
}
.scan-dl-jpg {
  background: var(--accent);
  color: #fff;
}
.scan-dl-jpg:hover { background: var(--accent-2); transform: translateY(-1px); }
.scan-dl-pdf {
  background: var(--surface-2);
  color: var(--ink);
  border: 1.5px solid var(--border);
}
.scan-dl-pdf:hover { border-color: var(--accent); color: var(--accent); }

/* ── How-to strip ── */
.scan-howto {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 20px;
  background: var(--bg-2);
  border-radius: var(--radius);
  margin-top: 8px;
}
.scan-howto-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 500;
}
.scan-howto-num {
  width: 26px; height: 26px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 12px;
  flex-shrink: 0;
}
.scan-howto-arrow { color: var(--ink-3); font-size: 16px; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .scan-header { flex-direction: column; gap: 14px; }
  .scan-action-bar { gap: 8px; }
  .scan-action-bar .btn-primary,
  .btn-secondary-scan,
  .btn-ghost-scan { width: 100%; justify-content: center; }
  .scan-filters { gap: 6px; }
  .scan-filter-btn { padding: 7px 12px; font-size: 12px; }
  .scan-export-row { flex-direction: column; align-items: flex-start; }
  .scan-kb-field { width: 100%; }
  .scan-dl-btn { width: 100%; justify-content: center; }
  .scan-howto { gap: 8px; }
  .scan-howto-arrow { display: none; }
}

/* ═══════════════════════════════════════════════════════════════
   BGREMOVE — AI Background Removal Panel
   ─────────────────────────────────────────────────────────────
   All rules are scoped to the Remove BG tab panel to avoid any
   risk of bleeding into existing components.
═══════════════════════════════════════════════════════════════ */

/* ── Model status badge ── */
.rb-model-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 16px;
  transition: background 0.3s, color 0.3s;
}
.rb-model-status--idle {
  background: var(--surface-2, #f4f4f5);
  color: var(--ink-2, #666);
}
.rb-model-status--loading {
  background: #fffbeb;
  color: #92400e;
  animation: rb-pulse 1.4s ease-in-out infinite;
}
.rb-model-status--ready {
  background: #d1fae5;
  color: #065f46;
}
.rb-model-status--fallback {
  background: #fef3c7;
  color: #92400e;
}
@keyframes rb-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

/* ── Tech chips row ── */
.rb-tech-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.rb-chip {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2, #f4f4f5);
  color: var(--ink-2, #555);
  letter-spacing: 0.02em;
}

/* ── Primary action row ── */
.rb-primary-action {
  display: flex;
  justify-content: center;
  padding: 20px 0 8px;
}

/* ── Background replacement grid ── */
.rb-bg-section {
  margin-top: 24px;
  padding: 20px;
  background: var(--surface-2, #f9f9fa);
  border-radius: 14px;
}
.rb-bg-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-2, #666);
  margin: 0 0 14px 0;
}
.rb-bg-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.rb-bg-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 2px solid var(--border, #e5e5e5);
  background: var(--surface-1, #fff);
  color: var(--ink-1, #1a1a1a);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.12s;
}
.rb-bg-btn:hover {
  border-color: var(--accent, #e85d30);
  box-shadow: 0 2px 12px rgba(232,93,48,.12);
  transform: translateY(-1px);
}
.rb-bg-btn:active { transform: translateY(0); }

/* Colour swatch inside button */
.rb-bg-swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
}
.rb-swatch-custom {
  background: linear-gradient(135deg, #e85d30 50%, #4B7BF5 50%);
}

/* ── Passport size section ── */
.rb-passport-section {
  margin-top: 16px;
  padding: 20px;
  background: var(--surface-2, #f9f9fa);
  border-radius: 14px;
}
.rb-passport-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.rb-passport-btn {
  padding: 10px 18px;
  border-radius: 10px;
  border: 2px solid var(--border, #e5e5e5);
  background: var(--surface-1, #fff);
  color: var(--ink-1, #1a1a1a);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.12s;
}
.rb-passport-btn:hover {
  border-color: var(--accent, #e85d30);
  box-shadow: 0 2px 12px rgba(232,93,48,.12);
  transform: translateY(-1px);
}
.rb-passport-btn--blue { border-color: #4B7BF5; }
.rb-passport-btn--blue:hover { border-color: #2255e0; box-shadow: 0 2px 12px rgba(75,123,245,.18); }

/* ── Checkerboard for transparent preview ── */
.checkerboard {
  background-image:
    linear-gradient(45deg, #ccc 25%, transparent 25%),
    linear-gradient(-45deg, #ccc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ccc 75%),
    linear-gradient(-45deg, transparent 75%, #ccc 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  background-color: #f0f0f0;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .rb-bg-grid,
  .rb-passport-grid { gap: 8px; }
  .rb-bg-btn,
  .rb-passport-btn { width: 100%; justify-content: center; }
  .rb-primary-action .btn-download { width: 100%; }
}

/* ── Dark mode adjustments ── */
[data-theme="dark"] .rb-model-status--idle {
  background: rgba(255,255,255,0.07);
  color: #aaa;
}
[data-theme="dark"] .rb-model-status--ready {
  background: rgba(16,185,129,0.15);
  color: #34d399;
}
[data-theme="dark"] .rb-model-status--loading,
[data-theme="dark"] .rb-model-status--fallback {
  background: rgba(251,191,36,0.12);
  color: #fcd34d;
}
[data-theme="dark"] .rb-bg-section,
[data-theme="dark"] .rb-passport-section {
  background: rgba(255,255,255,0.04);
}
[data-theme="dark"] .rb-bg-btn,
[data-theme="dark"] .rb-passport-btn {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.12);
  color: #e8e8e8;
}
[data-theme="dark"] .rb-chip {
  background: rgba(255,255,255,0.07);
  color: #bbb;
}

/* ═══════════════════════════════════════════════════════════════
   PIPELINE REMOVE BG CARD
   Shown inline inside #step3, between crop and final result.
═══════════════════════════════════════════════════════════════ */

.pipeline-removebg {
  background: var(--surface-1, #fff);
  border: 2px solid var(--border, #e8e8e8);
  border-radius: 18px;
  padding: 24px;
  margin-bottom: 28px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.05);
  transition: border-color 0.2s;
}
.pipeline-removebg:focus-within {
  border-color: var(--accent, #e85d30);
}

/* ── Header ── */
.prb-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.prb-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.prb-icon {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}
.prb-title {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 3px 0;
  color: var(--ink-1, #1a1a1a);
}
.prb-subtitle {
  font-size: 12px;
  color: var(--ink-3, #888);
  margin: 0;
}
.prb-badge {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: #fef3c7;
  color: #92400e;
  flex-shrink: 0;
}

/* ── Cropped thumbnail + action row ── */
.prb-preview-row {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.prb-thumb-wrap {
  width: 80px;
  height: 100px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--border, #e5e5e5);
  flex-shrink: 0;
  background: #f4f4f4;
}
.prb-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.prb-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.prb-btn-remove {
  font-size: 14px;
  padding: 12px 22px;
}
.prb-btn-skip {
  font-size: 13px;
}

/* ── After AI result ── */
.prb-result {
  margin-top: 20px;
  border-top: 1px solid var(--border, #eee);
  padding-top: 20px;
}
.prb-result-previews {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}
.prb-result-card {
  text-align: center;
  max-width: 200px;
}
.prb-result-card .preview-img-wrap {
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--border, #e5e5e5);
  margin-bottom: 6px;
}
.prb-result-card .preview-img-wrap img {
  width: 100%;
  display: block;
  max-height: 200px;
  object-fit: contain;
}
.prb-result-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3, #888);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── BG colour choice ── */
.prb-bg-choice {
  background: var(--surface-2, #f9f9fa);
  border-radius: 12px;
  padding: 16px 18px;
}
.prb-choice-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2, #555);
  margin: 0 0 12px 0;
}
.prb-choice-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.prb-choice-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 2px solid var(--border, #e5e5e5);
  background: var(--surface-1, #fff);
  color: var(--ink-1, #1a1a1a);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.1s;
  user-select: none;
}
.prb-choice-btn:hover {
  border-color: var(--accent, #e85d30);
  box-shadow: 0 2px 10px rgba(232,93,48,.14);
  transform: translateY(-1px);
}
.prb-choice-btn:active { transform: translateY(0); }
.prb-choice-btn--blue  { border-color: #4B7BF5; }
.prb-choice-btn--blue:hover { border-color: #2244c8; }
.prb-choice-btn--transparent { border-style: dashed; }

/* Custom colour button hides the native input */
.prb-choice-btn--custom input[type="color"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0; height: 0;
}

.prb-choice-swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Mini progress inside pipeline card ── */
.prb-progress {
  margin-top: 14px;
}
.prb-progress-label {
  font-size: 13px;
  color: var(--ink-2, #666);
  margin-bottom: 6px;
}

/* ── Responsive ── */
@media (max-width: 520px) {
  .prb-preview-row    { flex-direction: column; align-items: flex-start; }
  .prb-choice-btns    { gap: 8px; }
  .prb-choice-btn,
  .prb-btn-remove,
  .prb-btn-skip       { width: 100%; justify-content: center; }
}

/* ── Dark mode ── */
[data-theme="dark"] .pipeline-removebg {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.1);
}
[data-theme="dark"] .prb-bg-choice {
  background: rgba(255,255,255,0.04);
}
[data-theme="dark"] .prb-choice-btn {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.12);
  color: #e8e8e8;
}
[data-theme="dark"] .prb-badge {
  background: rgba(251,191,36,0.12);
  color: #fcd34d;
}
/* ══════════════════════════════════════════════════════
   WORKFLOW UI ADDITIONS — ExamFit v4.0
   These rules add the new exam workflow styles.
   Append to the end of style.css.
══════════════════════════════════════════════════════ */

/* ── App Main (workflow container) ────── */
.app-main {
  padding: 48px 0 64px;
}

/* ══════════════════════════════════════════
   WORKFLOW STEPPER
══════════════════════════════════════════ */
.wf-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 40px;
  overflow-x: auto;
  padding: 8px 0 16px;
  scrollbar-width: none;
}
.wf-stepper::-webkit-scrollbar { display: none; }

.wf-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: default;
  flex-shrink: 0;
}
.wf-step-circle {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border);
  color: var(--ink-3);
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.wf-step-label {
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap;
  font-weight: 500;
  transition: color var(--transition);
}
.wf-step-line {
  flex: 1;
  min-width: 24px;
  max-width: 60px;
  height: 2px;
  background: var(--border);
  margin-bottom: 22px;
  transition: background var(--transition);
  flex-shrink: 0;
}
.wf-step--active .wf-step-circle {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.wf-step--active .wf-step-label { color: var(--accent); font-weight: 700; }
.wf-step--complete .wf-step-circle {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.wf-step--complete .wf-step-circle::after { content: '✓'; }
.wf-step--complete .wf-step-label { color: var(--green); }

/* ══════════════════════════════════════════
   WORKFLOW PANELS
══════════════════════════════════════════ */
.wf-panel {
  display: none;
  animation: fadeSlideIn 0.3s ease;
}
.wf-panel--active { display: block; }

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.wf-panel-header {
  margin-bottom: 28px;
}
.wf-panel-title {
  font-family: var(--font-head);
  font-size: clamp(20px, 3vw, 26px);
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.wf-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
}
.wf-panel-sub {
  font-size: 15px;
  color: var(--ink-2);
  margin-left: 42px;
}
.wf-back-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.wf-back-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--ink-2);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
}
.wf-back-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}
.wf-selected-exam-badge {
  background: var(--accent);
  color: #fff;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-head);
}
.wf-req-chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink-2);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
}

/* ══════════════════════════════════════════
   EXAM SEARCH BAR
══════════════════════════════════════════ */
.exam-search-wrap {
  position: relative;
  margin-bottom: 28px;
}
.exam-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  pointer-events: none;
  opacity: 0.6;
}
.exam-search-input {
  width: 100%;
  padding: 14px 44px 14px 44px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
  font-family: var(--font-body);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.exam-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.exam-search-input::placeholder { color: var(--ink-3); }
.exam-search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--ink-3);
  font-size: 16px;
  padding: 4px;
  border-radius: 50%;
  transition: color var(--transition);
}
.exam-search-clear:hover { color: var(--accent); }

/* ══════════════════════════════════════════
   EXAM CATEGORY PILLS
══════════════════════════════════════════ */
.wf-cat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}
.wf-cat-pill {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
}
.wf-cat-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.wf-cat-pill--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ══════════════════════════════════════════
   EXAM GRID
══════════════════════════════════════════ */
.wf-exam-grids {
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.wf-exam-category-section {}
.wf-cat-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}
.wf-cat-icon { font-size: 18px; }
.wf-cat-name {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.wf-cat-count {
  font-size: 12px;
  color: var(--ink-3);
  margin-left: auto;
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: 10px;
}
.wf-exam-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.wf-exam-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  text-align: left;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.wf-exam-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--cat-color, var(--accent));
  opacity: 0;
  transition: opacity var(--transition);
}
.wf-exam-card:hover {
  border-color: var(--cat-color, var(--accent));
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.wf-exam-card:hover::before { opacity: 1; }
.wf-exam-card-label {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.wf-exam-card-full {
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.3;
}
.wf-exam-card-cat-chip {
  font-size: 10px;
  color: var(--ink-3);
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 6px;
  margin-bottom: 2px;
  align-self: flex-start;
}

/* Search results */
.wf-search-count {
  font-size: 13px;
  color: var(--ink-3);
  margin-bottom: 12px;
  font-weight: 500;
}
.wf-no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-3);
  font-size: 15px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1.5px dashed var(--border);
}

/* Custom mode wrap */
.wf-custom-toggle-wrap {
  margin-top: 24px;
  text-align: center;
}

/* ══════════════════════════════════════════
   STEP 2: DOCUMENT TYPE CARDS
══════════════════════════════════════════ */
.wf-doc-types-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.wf-doc-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 20px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: left;
  transition: all var(--transition);
  position: relative;
}
.wf-doc-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.wf-doc-card--required { border-left: 4px solid var(--accent); }
.wf-doc-card--pdf {
  border-style: dashed;
  opacity: 0.8;
}
.wf-doc-card--pdf:hover { opacity: 1; }
.wf-doc-card-icon { font-size: 28px; margin-bottom: 2px; }
.wf-doc-card-name {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.wf-doc-card-size { font-size: 12px; color: var(--ink-3); }
.wf-doc-required-badge {
  font-size: 10px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  padding: 2px 8px;
  border-radius: 8px;
  position: absolute;
  top: 14px; right: 14px;
}
.wf-doc-optional-badge {
  font-size: 10px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--ink-3);
  padding: 2px 8px;
  border-radius: 8px;
  position: absolute;
  top: 14px; right: 14px;
}

/* ══════════════════════════════════════════
   STEP 3: REQUIREMENTS CARD
══════════════════════════════════════════ */
.wf-req-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
}
.wf-req-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}
.wf-req-badge {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
}
.wf-req-privacy {
  font-size: 12px;
  color: var(--ink-3);
  background: var(--surface-2);
  padding: 3px 10px;
  border-radius: 8px;
}
.wf-req-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
}
.wf-req-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 10px 16px;
  background: var(--bg);
  border-radius: var(--radius);
  min-width: 90px;
  border: 1px solid var(--border);
}
.wf-req-stat-val {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}
.wf-req-stat-lbl { font-size: 11px; color: var(--ink-3); }
.wf-req-tip {
  font-size: 13px;
  color: var(--ink-2);
  background: var(--surface-2);
  padding: 8px 12px;
  border-radius: 8px;
  flex: 1;
  min-width: 180px;
}
.wf-req-guidelines-wrap { margin-top: 12px; }
.wf-guidelines-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--ink-2);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
}
.wf-guidelines-toggle:hover { border-color: var(--accent); color: var(--accent); }
.wf-guidelines-list {
  margin-top: 10px;
  padding: 14px 20px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wf-guidelines-list li {
  font-size: 13px;
  color: var(--ink-2);
  padding-left: 16px;
  position: relative;
}
.wf-guidelines-list li::before {
  content: '✓';
  position: absolute; left: 0;
  color: var(--green);
  font-size: 11px;
}

/* ══════════════════════════════════════════
   STEP 4: TOOLS GRID
══════════════════════════════════════════ */
.wf-upload-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
}
.wf-upload-thumb-wrap {
  width: 72px; height: 72px;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid var(--border);
  flex-shrink: 0;
  background: var(--surface-2);
}
.wf-upload-thumb-wrap img { width: 100%; height: 100%; object-fit: cover; }
.wf-upload-meta { font-size: 13px; color: var(--ink-2); }

.wf-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.wf-tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 12px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all var(--transition);
  text-align: center;
}
.wf-tool-btn:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  background: var(--accent-glow);
}
.wf-tool-icon { font-size: 26px; }
.wf-tool-name {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.wf-tool-desc { font-size: 11px; color: var(--ink-3); }

/* Sub-panels (BG, Compress) */
.wf-sub-panel {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 20px;
}
.wf-sub-panel-title {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--ink);
}

/* Compress form */
.wf-compress-form { display: flex; flex-direction: column; gap: 12px; }
.wf-compress-range-hint {
  font-size: 13px;
  color: var(--ink-3);
  background: var(--surface-2);
  padding: 8px 12px;
  border-radius: 8px;
}
.wf-compress-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.wf-compress-label { font-size: 14px; color: var(--ink-2); font-weight: 500; }
.wf-compress-input {
  width: 140px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
}
.wf-compress-input:focus { outline: none; border-color: var(--accent); }
.wf-compress-error {
  font-size: 13px;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 8px 12px;
  border-radius: 8px;
}

/* Process action */
.wf-process-action {
  text-align: center;
  margin-top: 24px;
  padding: 20px;
  background: var(--surface);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
}
.wf-process-btn {
  font-size: 16px;
  padding: 14px 32px;
}
.wf-process-hint {
  font-size: 13px;
  color: var(--ink-3);
  margin-top: 8px;
}

/* ══════════════════════════════════════════
   STEP 5: DOWNLOAD ACTIONS + FOLDER
══════════════════════════════════════════ */
.wf-download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
  align-items: center;
}
.btn-folder {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 24px;
  background: var(--surface);
  border: 2px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius);
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 700;
  transition: all var(--transition);
  cursor: pointer;
}
.btn-folder:hover {
  background: var(--accent);
  color: #fff;
}

/* Exam Folder Section */
.wf-folder-section {
  margin-top: 40px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.wf-folder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.wf-folder-title {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}
.wf-folder-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.wf-folder-count {
  font-size: 13px;
  color: var(--ink-3);
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.wf-zip-btn {
  font-size: 14px;
  padding: 8px 18px;
}
.wf-clear-folder-btn {
  font-size: 13px;
  padding: 7px 14px;
}
.wf-folder-list { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.wf-folder-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.wf-folder-item-thumb-wrap {
  width: 52px; height: 52px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-2);
  flex-shrink: 0;
}
.wf-folder-item-thumb { width: 100%; height: 100%; object-fit: cover; }
.wf-folder-item-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wf-folder-item-label { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wf-folder-item-name  { font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wf-folder-item-size  { font-size: 11px; color: var(--ink-3); }
.wf-folder-item-actions { display: flex; gap: 6px; flex-shrink: 0; }
.wf-folder-dl, .wf-folder-remove { padding: 6px 10px; font-size: 13px; }

/* ══════════════════════════════════════════
   TOOLS SECTION (Standalone)
══════════════════════════════════════════ */
.tools-section-wrap {
  background: var(--bg-2);
  padding: 56px 0 64px;
  border-top: 2px solid var(--border);
}
.tool-tabs--slim .tabs-inner {
  /* slightly smaller tabs for secondary use */
}

/* ══════════════════════════════════════════
   RESPONSIVE ADJUSTMENTS
══════════════════════════════════════════ */
@media (max-width: 600px) {
  .wf-stepper {
    justify-content: flex-start;
    padding-left: 8px;
  }
  .wf-step-label { display: none; }
  .wf-step-line  { min-width: 16px; max-width: 32px; }
  .wf-exam-grid  { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .wf-doc-types-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .wf-tools-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .wf-compress-input-row { flex-direction: column; align-items: flex-start; }
  .wf-compress-input { width: 100%; }
  .wf-download-actions { flex-direction: column; }
  .btn-folder, .btn-download { width: 100%; justify-content: center; }
  .wf-folder-header { flex-direction: column; align-items: flex-start; }
}

/* ══════════════════════════════════════════
   MISC: ensure legacy IDs still used by
   scan.js / bgremove.js aren't broken
══════════════════════════════════════════ */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}
