/* ====== Design Tokens ====== */
:root {
  --bg-body: #020617;
  --bg-card: #0f172a;
  --bg-card-soft: #111827;
  --border-subtle: rgba(148, 163, 184, 0.35);
  --accent: #f9735b;
  --accent-strong: #fb4f35;
  --accent-alt: #22c55e;
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --text-soft: #6b7280;
  --shadow-soft: 0 24px 60px rgba(15, 23, 42, 0.7);
  --radius-lg: 22px;
  --radius-pill: 999px;
}

/* ====== Global ====== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(79, 70, 229, 0.45), transparent 55%),
    radial-gradient(circle at bottom right, rgba(249, 115, 91, 0.35), transparent 55%),
    var(--bg-body);
  color: var(--text-main);
}

/* ====== Scrollbar Theme (Score & Tailor pages) ====== */
/* Firefox */
html,
body,
.jd-input,
textarea {
  scrollbar-width: thin;
  scrollbar-color: rgba(249, 115, 91, 0.9) rgba(15, 23, 42, 0.65);
}

/* Chromium / Safari */
html::-webkit-scrollbar,
body::-webkit-scrollbar,
.jd-input::-webkit-scrollbar,
textarea::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track,
.jd-input::-webkit-scrollbar-track,
textarea::-webkit-scrollbar-track {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.88), rgba(17, 24, 39, 0.92));
  border-radius: 999px;
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb,
.jd-input::-webkit-scrollbar-thumb,
textarea::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  border-radius: 999px;
  border: 2px solid rgba(15, 23, 42, 0.9);
}

html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover,
.jd-input::-webkit-scrollbar-thumb:hover,
textarea::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #ff8a73, var(--accent));
}

html::-webkit-scrollbar-corner,
body::-webkit-scrollbar-corner,
.jd-input::-webkit-scrollbar-corner,
textarea::-webkit-scrollbar-corner {
  background: rgba(15, 23, 42, 0.9);
}


.page-upload,
.page-dashboard {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ====== Top Bar ====== */
.topbar {
  height: 60px;
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
  backdrop-filter: blur(18px);
  background: linear-gradient(
      to bottom,
      rgba(15, 23, 42, 0.9),
      rgba(15, 23, 42, 0.96)
    );
  position: sticky;
  top: 0;
  z-index: 20;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 15px;
}

.logo-heart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: radial-gradient(circle at 30% 20%, #f9735b, #ef4444);
  color: #fee2e2;
  font-size: 15px;
}

.logo-text {
  color: #f9fafb;
}

.top-nav {
  display: flex;
  gap: 18px;
  font-size: 14px;
}

.nav-link {
  position: relative;
  text-decoration: none;
  color: var(--text-muted);
  padding: 6px 0;
  transition: color 0.18s ease;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--accent), var(--accent-alt));
  transition: width 0.2s ease;
}

.nav-link:hover {
  color: #e5e7eb;
}

.nav-link.active {
  color: #fef2f2;
}

.nav-link.active::after {
  width: 100%;
}

/* ====== Layout ====== */
.center-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px 40px;
}

.card {
  background: radial-gradient(circle at top left, rgba(55, 65, 81, 0.85), rgba(15, 23, 42, 0.97));
  border-radius: 26px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  box-shadow: var(--shadow-soft);
  max-width: 840px;
  width: 100%;
  padding: 34px 40px 32px;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 10% 0, rgba(248, 250, 252, 0.05), transparent 55%);
  pointer-events: none;
}

.card-centered {
  text-align: center;
}

.title-main {
  margin: 0 0 6px;
  font-size: clamp(26px, 3vw, 30px);
  letter-spacing: 0.03em;
}

.subtitle {
  margin: 0 0 26px;
  color: var(--text-muted);
  font-size: 14px;
}

/* Step label */
.step-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(148, 163, 184, 0.4);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-soft);
  margin-bottom: 10px;
}

/* ====== Upload drop area ====== */
.upload-drop {
  margin-top: 8px;
  padding: 26px 24px 22px;
  border-radius: 22px;
  border: 1px dashed rgba(148, 163, 184, 0.7);
  background: linear-gradient(
    135deg,
    rgba(15, 23, 42, 0.55),
    rgba(15, 23, 42, 0.95)
  );
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.upload-icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: rgba(249, 115, 91, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fed7d7;
  font-size: 24px;
}

.hint {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-soft);
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-accent,
.btn-generate {
  border-radius: var(--radius-pill);
  padding: 11px 26px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff7ed;
  box-shadow: 0 18px 40px rgba(248, 113, 113, 0.55);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 24px 60px rgba(248, 113, 113, 0.7);
  background: linear-gradient(135deg, var(--accent-strong), #ef4444);
}

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.6);
}

.btn-secondary:hover {
  border-color: rgba(248, 250, 252, 0.7);
  color: #e5e7eb;
}

.btn-large {
  min-width: 260px;
}

/* Error message */
.form-error {
  margin-top: 10px;
  font-size: 12px;
  color: #fecaca;
  background: rgba(248, 113, 113, 0.16);
  border: 1px solid rgba(248, 113, 113, 0.4);
  padding: 6px 10px;
  border-radius: 10px;
}

/* Progress bars */
.progress-bar {
  width: 100%;
  height: 11px;
  border-radius: var(--radius-pill);
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.4);
  overflow: hidden;
  margin: 24px 0 10px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #fb923c);
  box-shadow: 0 0 20px rgba(248, 113, 113, 0.6);
  transition: width 0.1s linear;
}

.progress-percent {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #fef2f2;
}

/* Processing circle (static) */
.circle-wrapper {
  display: flex;
  justify-content: center;
  margin: 24px 0 4px;
}

.circle-loader {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 3px solid rgba(148, 163, 184, 0.25);
  background: radial-gradient(circle at 25% 20%, rgba(248, 250, 252, 0.12), rgba(15, 23, 42, 0.96));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 22px 40px rgba(15, 23, 42, 0.95);
}

.circle-inner {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 15%, rgba(248, 250, 252, 0.14), #020617);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 19px;
  color: #fefce8;
}

/* ====== JD step ====== */
.jd-container {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}

.jd-block {
  padding: 10px 12px 12px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: radial-gradient(circle at 0 0, rgba(248, 250, 252, 0.03), rgba(15, 23, 42, 0.98));
}

.jd-label {
  font-size: 12px;
  color: var(--text-soft);
  margin-bottom: 4px;
  display: block;
}

.jd-textarea {
  width: 100%;
  min-height: 90px;
  max-height: 200px;
  resize: vertical;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  background: rgba(15, 23, 42, 0.94);
  color: #e5e7eb;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.4;
}

.jd-textarea:focus {
  outline: none;
  border-color: rgba(248, 250, 252, 0.85);
}

.jd-footer {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.jd-status {
  font-size: 11px;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.jd-status-check {
  font-size: 13px;
  color: #4ade80;
}

.jd-generate-btn {
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  border: 1px solid rgba(249, 115, 91, 0.55);
  background: radial-gradient(circle at 0 0, rgba(249, 115, 91, 0.18), rgba(15, 23, 42, 0.95));
  color: #fed7d7;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  box-shadow: 0 8px 18px rgba(248, 113, 113, 0.25);
}

.jd-generate-btn::before {
  content: "✨";
  font-size: 12px;
  opacity: 0.9;
}

.jd-generate-btn:hover:not(.is-loading) {
  border-color: rgba(248, 250, 252, 0.9);
  box-shadow: 0 12px 26px rgba(248, 113, 113, 0.4);
  background: radial-gradient(circle at 0 0, rgba(249, 115, 91, 0.26), rgba(15, 23, 42, 1));
  color: #ffe4e6;
}

.jd-btn-spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(148, 163, 184, 0.5);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.jd-generate-btn.is-loading {
  cursor: default;
  opacity: 0.9;
  box-shadow: none;
}

.jd-generate-btn.is-loading::before {
  content: "";
}

.jd-download-btn {
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  border: 1px solid rgba(34, 197, 94, 0.7);
  background: radial-gradient(circle at 0 0, rgba(34, 197, 94, 0.2), rgba(15, 23, 42, 0.95));
  color: #bbf7d0;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.jd-download-btn:hover {
  border-color: rgba(248, 250, 252, 0.9);
  color: #ecfdf3;
}


.jd-download-btn.spinner-only {
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0;
  min-width: 20px;
  min-height: 20px;
  cursor: default;
}

.jd-download-btn.spinner-only:hover {
  border: none;
  background: transparent;
}
.jd-footer-row {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.jd-add-btn {
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  border: 1px dashed rgba(148, 163, 184, 0.8);
  background: rgba(15, 23, 42, 0.7);
  color: var(--text-muted);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.jd-add-btn span.icon {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(34, 197, 94, 0.18);
  color: #bbf7d0;
  font-size: 14px;
}

/* ====== Helpers & Animations ====== */
.hidden {
  display: none !important;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ====== Responsive ====== */
@media (max-width: 900px) {
  .topbar {
    padding: 0 18px;
  }

  .card {
    padding: 26px 20px 24px;
  }

  .dashboard-main {
    padding: 18px 16px 28px;
  }

  .dashboard-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-sidebar,
  .dashboard-list {
    padding: 16px;
  }

  .resume-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .resume-meta {
    align-self: flex-end;
  }
}


.dashboard-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 12px;
}


.upload-drop.drag-over {
  border-style: solid;
  border-color: rgba(248, 250, 252, 0.9);
  background: rgba(15, 23, 42, 0.85);
}


@media (max-width: 600px) {
  .topbar {
    padding: 0 12px;
    height: 54px;
  }

  .logo-text {
    font-size: 13px;
  }

  .top-nav {
    gap: 10px;
    font-size: 12px;
  }

  .center-wrapper {
    padding: 18px 10px 20px;
  }

  .card {
    padding: 20px 16px 18px;
    border-radius: 20px;
  }

  .title-main {
    font-size: 20px;
  }

  .subtitle {
    font-size: 13px;
  }

  .upload-drop {
    padding: 18px 14px 16px;
  }

  .btn-primary,
  .btn-secondary,
  .btn-accent,
  .btn-generate {
    width: 100%;
    justify-content: center;
  }

  .btn-large {
    min-width: 0;
  }

  .jd-actions {
    flex-direction: column-reverse;
  }

  .dashboard-main {
    padding: 14px 10px 22px;
  }

  .dashboard-layout {
    gap: 14px;
  }

  .dashboard-sidebar,
  .dashboard-list {
    padding: 14px;
  }

  .preview-panel {
    width: 100%;
  }

  .preview-content {
    padding: 12px 14px 70px;
  }
}


.jd-paste-btn {
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.jd-paste-btn::before {
  content: "📋";
  font-size: 11px;
}


/* --- JD toolbar copy/paste buttons (ChatGPT-style) --- */
.jd-block .jd-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}

.jd-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: radial-gradient(circle at 0 0, rgba(255,255,255,0.06), rgba(0,0,0,0.9));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;

  color: #ffffff;}


.jd-icon-btn svg {
  color: #ffffff;
  stroke: #ffffff;
}
.jd-icon-btn .jd-icon {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: #e5e7eb;
  stroke-width: 1.4;
}

.jd-icon-btn .jd-icon rect,
.jd-icon-btn .jd-icon path {
  fill: none;
  stroke: #e5e7eb;
}

.jd-icon-btn:hover {
  border-color: rgba(59, 130, 246, 0.9);
  background: radial-gradient(circle at 0 0, rgba(59,130,246,0.45), rgba(15,23,42,0.95));
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.35), 0 6px 18px rgba(15, 23, 42, 0.7);
  transform: translateY(-0.5px);
}

.jd-icon-btn:active {
  transform: translateY(0.5px) scale(0.98);
  box-shadow: 0 0 0 1px rgba(30, 64, 175, 0.5), 0 2px 6px rgba(15, 23, 42, 0.9);
}

.jd-icon-btn.jd-copy-btn.copied {
  border-color: rgba(34, 197, 94, 0.9);
  background: radial-gradient(circle at 0 0, rgba(34,197,94,0.5), rgba(15,23,42,0.95));
}

.jd-icon-btn.jd-copy-btn.copied .jd-icon rect,
.jd-icon-btn.jd-copy-btn.copied .jd-icon path {
  stroke: #bbf7d0;
}

/* Override legacy jd-paste-btn styles when used as icon button */
.jd-icon-btn.jd-paste-btn::before {
  content: "";
}

/* ====== Keyword Analysis (View / Preview) ====== */
.keyword-analysis {
  margin-top: 24px;
  padding: 16px 18px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.9);
}

.keyword-analysis h2 {
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 600;
}

.keyword-section {
  margin-top: 18px;
}

.keyword-section h3 {
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 600;
}

.keyword-note {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 8px;
}

.keyword-table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.keyword-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.keyword-table thead tr {
  background: rgba(15, 23, 42, 0.9);
}

.keyword-table th,
.keyword-table td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid rgba(30, 64, 175, 0.4);
}

.keyword-table th {
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
}

.keyword-name {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}

.status-ok {
  background: rgba(34, 197, 94, 0.16);
  border: 1px solid rgba(34, 197, 94, 0.7);
  color: #bbf7d0;
}

.status-missing {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.9);
  color: #fecaca;
}

.count-cell {
  text-align: center;
  width: 80px;
}

.empty-state {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
}


/* ====== JD progress ring + download state ====== */
.jd-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.jd-progress {
  --p: 0;
  --ring-color: var(--accent-alt);
  width: 34px;
  height: 34px;
  position: relative;
  border-radius: 999px;
  flex: 0 0 auto;
}

.jd-progress-ring {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: conic-gradient(var(--ring-color) calc(var(--p) * 1%), rgba(148,163,184,0.25) 0);
}

.jd-progress-center {
  position: absolute;
  inset: 4px;
  border-radius: 999px;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
}

.jd-progress-text {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-main);
}

.jd-generate-btn.btn-download {
  background: var(--accent-alt);
  color: #052e16;
  border: 1px solid rgba(34, 197, 94, 0.45);
}

.jd-generate-btn.btn-download:hover {
  filter: brightness(1.05);
}


.jd-progress-pair{display:flex;gap:8px;align-items:center;}
.jd-progress-block{display:flex;flex-direction:column;align-items:center;gap:4px;}
.jd-progress-label{font-size:11px;line-height:1;opacity:.85;}
.jd-progress-tailored{--ring-color: var(--accent);} 


.subtitle-highlight {
  color: #fbbf24;
  font-weight: 700;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.45);
  border-radius: 12px;
  padding: 10px 12px;
  animation: subtitlePulse 1s ease 2;
}

@keyframes subtitlePulse {
  0% { transform: scale(1); box-shadow: 0 0 0 rgba(251, 191, 36, 0); }
  35% { transform: scale(1.02); box-shadow: 0 0 0 8px rgba(251, 191, 36, 0.12); }
  100% { transform: scale(1); box-shadow: 0 0 0 rgba(251, 191, 36, 0); }
}

/* Score page analysis dropdown */
.jd-analysis-table{width:100%;border-collapse:collapse;font-size:13px;background:#0f172a;border:1px solid #22304a;border-radius:10px;overflow:hidden}
.jd-analysis-table th,.jd-analysis-table td{padding:8px 10px;border-bottom:1px solid #1f2a44;text-align:left}
.jd-analysis-table th{background:#16233b;color:#c7d2fe;font-weight:700}
.jd-analysis-table td{color:#e2e8f0}
.jd-analysis-table tr:last-child td{border-bottom:none}
.jd-analysis-empty{color:#94a3b8;margin:6px 0 0}


/* index.html emphasize BEFORE ring on the right */
.jd-header{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:8px;}
.jd-title{font-weight:700;color:#f1f5f9;letter-spacing:.01em;}
.page-score .jd-block .jd-actions{margin-left:auto;}
.page-score .jd-progress-before-only .jd-progress{width:84px;height:84px;}
.page-score .jd-progress-before-only .jd-progress-center{inset:8px;}
.page-score .jd-progress-before-only .jd-progress-text{font-size:18px;}
.page-score .jd-progress-before-only .jd-progress-label{font-size:13px;font-weight:700;opacity:1;margin-top:6px;}
.page-score .jd-progress-pair{gap:0;}
.page-score .jd-progress-block{align-items:center;}
@media (max-width: 640px){
  .page-score .jd-progress-before-only .jd-progress{width:70px;height:70px;}
  .page-score .jd-progress-before-only .jd-progress-text{font-size:15px;}
}

/* index.html: move BEFORE circle outside jdScreen card and enlarge */
.page-score #jdScreen.card{overflow:visible;}
.page-score #jdScreen .jd-block{position:relative; overflow:visible; padding-right:72px; min-height:170px;}
.page-score #jdScreen .jd-header{position:relative;}
/* Keep the BEFORE ring completely outside the JD form */
.page-score #jdScreen .jd-header .jd-actions{position:absolute; right:-245px; top:50%; transform:translateY(-50%); margin-left:0; z-index:4; pointer-events:auto;}
.page-score #jdScreen .jd-progress-before-only .jd-progress{width:120px;height:120px;}
.page-score #jdScreen .jd-progress-before-only .jd-progress-center{inset:10px;}
.page-score #jdScreen .jd-progress-before-only .jd-progress-text{font-size:26px;font-weight:800;}
.page-score #jdScreen .jd-progress-before-only .jd-progress-label{font-size:15px;margin-top:8px;}

@media (max-width: 1100px){
  .page-score #jdScreen .jd-header .jd-actions{right:-190px;}
  .page-score #jdScreen .jd-progress-before-only .jd-progress{width:104px;height:104px;}
}
@media (max-width: 900px){
  /* fallback inside on smaller screens so layout stays usable */
  .page-score #jdScreen .jd-block{padding-right:24px; min-height:unset;}
  .page-score #jdScreen .jd-header .jd-actions{position:static; margin-left:auto;}
  .page-score #jdScreen .jd-progress-before-only .jd-progress{width:88px;height:88px;}
  .page-score #jdScreen .jd-progress-before-only .jd-progress-text{font-size:20px;}
}


/* copy/paste moved inside form */
.jd-form-tools{
  display:flex;
  justify-content:flex-end;
  gap:8px;
  margin-top:8px;
  margin-bottom:4px;
}



/* Score page: align Before circle with JD title line */
.page-score .jd-header{align-items:center;}
.page-score .jd-block .jd-actions{margin-top:0;}
.page-score .jd-progress-before-only .jd-progress-label{display:none;}
.page-score .jd-progress-before-only .jd-progress{width:110px;height:110px;}
.page-score .jd-progress-before-only .jd-progress-center{inset:10px;}
.page-score .jd-progress-before-only .jd-progress-text{font-size:28px;font-weight:800;line-height:1;}
@media (max-width: 640px){
  .page-score .jd-progress-before-only .jd-progress{width:90px;height:90px;}
  .page-score .jd-progress-before-only .jd-progress-text{font-size:22px;}
}


/* index.html: center outside circle in the empty right-side space */
.page-score #jdScreen .jd-block{position:relative; overflow:visible; padding-right:72px; min-height:220px;}
.page-score #jdScreen .jd-header .jd-actions{
  position:absolute !important;
  right:-245px !important;
  top:50% !important;
  transform:translateY(-50%) !important;
  margin-left:0 !important;
  z-index:6;
}
@media (max-width: 1100px){
  .page-score #jdScreen .jd-header .jd-actions{right:-205px !important;}
}
@media (max-width: 900px){
  .page-score #jdScreen .jd-header .jd-actions{
    position:static !important;
    transform:none !important;
    margin-left:auto !important;
  }
  .page-score #jdScreen .jd-block{min-height:unset; padding-right:24px;}
}


/* Score page: analysis dropdown outside form, under the score circle */
.page-score .jd-actions{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  min-width:280px;
  gap:10px;
}
.page-score .jd-side-analysis{
  width:260px;
}
.page-score .jd-side-analysis .jd-analysis-dropdown{
  margin-top:0 !important;
}
.page-score .jd-side-analysis .jd-analysis-table th,
.page-score .jd-side-analysis .jd-analysis-table td{
  font-size:11px;
  padding:4px 6px;
}
@media (max-width: 1200px){
  .page-score .jd-actions{min-width:220px;}
  .page-score .jd-side-analysis{width:220px;}
}
@media (max-width: 900px){
  .page-score .jd-actions{width:100%; min-width:0;}
  .page-score .jd-side-analysis{width:100%;}
}


/* vNext: hard-separate score circle + analysis from jdScreen */
.page-score #jdScreen{
  max-width: 920px;
  overflow: visible;
}
.page-score #jdScreen .jd-block{
  position: relative;
  overflow: visible;
  padding-right: 24px !important;
  min-height: 240px;
}
.page-score #jdScreen .jd-header .jd-actions{
  position:absolute !important;
  right:-360px !important;
  top:50% !important;
  transform:translateY(-50%) !important;
  width:300px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:12px;
}
.page-score .jd-side-analysis{
  width:300px;
}
@media (max-width: 1280px){
  .page-score #jdScreen .jd-header .jd-actions{right:-320px !important; width:270px;}
  .page-score .jd-side-analysis{width:270px;}
}
@media (max-width: 1024px){
  .page-score #jdScreen{max-width: 100%;}
  .page-score #jdScreen .jd-header .jd-actions{right:-290px !important; width:250px;}
  .page-score .jd-side-analysis{width:250px;}
}
@media (max-width: 900px){
  .page-score #jdScreen .jd-block{padding-right:24px !important; min-height:unset;}
  .page-score #jdScreen .jd-header .jd-actions{
    position:static !important;
    right:auto !important;
    top:auto !important;
    transform:none !important;
    width:100%;
  }
  .page-score .jd-side-analysis{width:100%;}
}

/* tighten analysis dropdown width on score page */
/* tighten analysis dropdown width on score page */
.page-score .jd-side-analysis .jd-analysis-dropdown{max-width:190px;width:100%;margin:8px auto 0;display:block;}
@media (max-width: 900px){
  .page-score .jd-side-analysis .jd-analysis-dropdown{max-width:100%;}
}

/* Score page: keep action button on the left */
.page-score .jd-footer { justify-content: flex-start; }
.page-score .jd-footer .jd-generate-btn { order: -1; }

/* Score button inline with copy/paste */
.page-score .jd-form-tools{justify-content:space-between; align-items:center;}
.page-score .jd-form-tools .jd-generate-inline{margin-right:auto;}
.page-score .jd-footer .jd-generate-btn{display:none !important;}

/* index.html pending-payment lock */
.jd-textarea.jd-locked,
textarea.jd-locked{
  cursor: not-allowed;
  opacity: 0.65;
  filter: grayscale(15%);
}
.jd-icon-btn:disabled{ opacity:0.55; cursor:not-allowed; }



/* ===== Payment Modal (Tailor download gate) ===== */
.payment-overlay {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(2, 6, 23, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid; place-items: center;
  padding: 20px;
}
.payment-overlay.hidden { display: none; }
.payment-modal {
  width: min(760px, 96vw);
  background: #f8fafc;
  color: #111827;
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(2,6,23,.45);
  border: 1px solid rgba(148,163,184,.35);
  overflow: hidden;
  position: relative;
}
.payment-modal-header {
  background: linear-gradient(135deg, #1f2937, #111827);
  color: #fff;
  padding: 24px 26px 18px;
}
.payment-modal-header h2 { margin:0; font-size: 34px; line-height:1.05; color:#fbbf24; }
.payment-modal-header p { margin:10px 0 0; color: rgba(255,255,255,.88); }
.payment-close {
  position:absolute; top:14px; right:14px; width:38px; height:38px; border-radius:999px;
  border:1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.06); color:#fff;
  font-size:28px; line-height:1; cursor:pointer;
}
.payment-price-box {
  margin: 18px auto 8px; width:min(320px, calc(100% - 28px)); text-align:center;
  border-radius: 18px; padding: 16px 20px;
  background: #f1f5f9; border: 2px solid transparent;
  background-image: linear-gradient(#f1f5f9,#f1f5f9), linear-gradient(90deg, #f59e0b, #fb7185);
  background-origin: border-box; background-clip: padding-box, border-box;
}
.payment-price-label { color:#6b7280; font-weight:700; }
.payment-price-value { font-size: 42px; font-weight: 800; color:#111827; line-height:1.1; margin-top:4px; }
.payment-price-note { color:#64748b; font-size:13px; margin-top:4px; }
.payment-tabs { display:flex; gap:10px; padding: 12px 22px 0; border-bottom: 1px solid #e5e7eb; margin-top: 8px; }
.payment-tab {
  border:0; background:transparent; padding:10px 6px 12px; font-weight:700; color:#64748b; cursor:pointer;
  border-bottom: 3px solid transparent;
}
.payment-tab.active { color:#1d4ed8; border-bottom-color:#ef4444; }
.payment-panel { padding: 20px 22px 24px; }
.payment-label { display:block; font-size:14px; font-weight:700; color:#374151; margin-bottom:8px; }
.payment-card-row, .payment-card-split { display:flex; gap:10px; }
.payment-card-split { margin-top:10px; }
.payment-input {
  width:100%; border:1px solid #d1d5db; background:#fff; color:#111827;
  border-radius:10px; padding:12px 14px; font-size:15px; outline:none;
}
.payment-input:focus { border-color:#60a5fa; box-shadow:0 0 0 3px rgba(59,130,246,.15); }
.payment-pay-btn {
  margin-top:18px; width:100%; border:0; border-radius:12px; padding:13px 14px; cursor:pointer;
  background: linear-gradient(90deg, #ef4444, #fb5a3c); color:#fff; font-weight:800; font-size:18px;
}
.payment-paypal-static {
  width:100%; border:0; border-radius:10px; padding:12px 14px; cursor:default;
  background:#0891d1; color:#fff; font-weight:800; font-size:28px; letter-spacing:.01em;
}
.payment-static-note { margin:10px 2px 0; color:#64748b; font-size:13px; text-align:center; }
body.modal-open { overflow:hidden; }
@media (max-width: 640px) {
  .payment-modal-header h2 { font-size: 28px; }
  .payment-price-value { font-size: 34px; }
  .payment-card-split { flex-direction: column; }
}

/* ====== Tailor Download Upsell ====== */
.upsell-overlay{
  position:fixed; inset:0; z-index:95;
  background: rgba(7,10,18,.35);
  backdrop-filter: blur(8px);
  display:flex; align-items:center; justify-content:center;
  padding: 20px;
}
.upsell-overlay.hidden{display:none}
.upsell-modal{width:min(1080px, 96vw);}
.upsell-brand{
  text-align:center; font-size:44px; font-weight:800; letter-spacing:-.03em;
  color:#111827; margin-bottom:14px;
}
.upsell-card{
  background:#fff; border-radius:18px; box-shadow:0 28px 80px rgba(15,23,42,.18);
  padding:28px 30px; display:grid; grid-template-columns: 320px 1fr; gap:24px; align-items:center;
}
.upsell-illustration{position:relative; height:220px; border-radius:14px; background:linear-gradient(180deg,#fff,#fafafa);} 
.upsell-balance{position:absolute; left:18px; right:18px; top:112px; height:6px; background:#f8a9a0; transform:rotate(8deg); border-radius:999px;}
.upsell-balance::before,.upsell-balance::after{content:""; position:absolute; width:10px; height:10px; background:#ff6f61; border-radius:50%; bottom:-12px;}
.upsell-balance::before{left:26px}.upsell-balance::after{right:26px}
.upsell-paper{position:absolute; width:82px; height:118px; background:#fff; border-radius:10px; right:48px; top:58px; box-shadow:0 10px 22px rgba(0,0,0,.08); border:1px solid #ececec;}
.upsell-paper::before{content:""; position:absolute; left:14px; top:18px; width:36px; height:3px; background:#6b7280; box-shadow:0 12px 0 #9ca3af, 0 24px 0 #d1d5db; border-radius:99px;}
.upsell-paper::after{content:""; position:absolute; left:14px; bottom:16px; width:48px; height:28px; border-radius:4px; background:linear-gradient(135deg,#f7d45c,#f59e0b);}
.upsell-check{position:absolute; left:46px; top:108px; width:34px; height:34px; border-radius:50%; background:#dcfce7; border:2px solid #4ade80;}
.upsell-check::before{content:"✓"; position:absolute; inset:0; display:flex; align-items:center; justify-content:center; color:#22c55e; font-weight:800;}
.upsell-dot{position:absolute; border-radius:50%; opacity:.7}
.upsell-dot-a{width:12px;height:12px;left:94px;top:66px;background:#d8b4fe}
.upsell-dot-b{width:7px;height:7px;left:196px;top:72px;background:#fbbf24}
.upsell-content h2{margin:0; font-size:28px; color:#1f2937;}
.upsell-limit{margin:12px 0 14px; color:#374151; font-size:16px;}
.upsell-meter-track{height:10px; background:#f3e7b5; border-radius:999px; position:relative; overflow:hidden; margin-bottom:8px;}
.upsell-meter-fill{position:absolute; left:0; top:0; bottom:0; width:6%; background:linear-gradient(90deg,#22c55e,#f59e0b); border-radius:999px;}
.upsell-meter-labels{display:flex; justify-content:space-between; font-size:12px; font-weight:700; color:#f59e0b;}
.upsell-meter-labels span:first-child{color:#22c55e}
.upsell-note{margin:18px 0 22px; font-size:18px; color:#374151; line-height:1.45;}
.upsell-hover-wrap{position:relative; display:inline-block;}
.upsell-hover-word{background:none; border:none; padding:0; color:#ef4444; font-weight:800; text-decoration:underline; cursor:default; font:inherit;}
.upsell-benefits{position:absolute; left:50%; transform:translateX(-50%); bottom: calc(100% + 12px); width:min(360px, 80vw); background:#fff; color:#1f2937; border:1px solid #e5e7eb; border-radius:12px; box-shadow:0 18px 36px rgba(15,23,42,.18); padding:14px 16px; display:none; z-index:3;}
.upsell-benefits::after{content:""; position:absolute; left:50%; transform:translateX(-50%) rotate(45deg); bottom:-6px; width:12px; height:12px; background:#fff; border-right:1px solid #e5e7eb; border-bottom:1px solid #e5e7eb;}
.upsell-hover-wrap:hover .upsell-benefits,.upsell-hover-wrap:focus-within .upsell-benefits{display:grid; gap:10px;}
.upsell-benefits span{font-size:14px; line-height:1.35; font-weight:600;}
.upsell-buttons{display:flex; gap:14px; align-items:center;}
.upsell-btn-primary,.upsell-btn-ghost{height:56px; border-radius:12px; font-weight:800; font-size:16px; padding:0 24px; cursor:pointer;}
.upsell-btn-primary{border:none; background:#fbbf24; color:#1f2937; box-shadow:0 6px 18px rgba(251,191,36,.3);} 
.upsell-btn-ghost{background:#fff; color:#ef4444; border:2px solid #ef4444;}
@media (max-width: 900px){
  .upsell-card{grid-template-columns:1fr; padding:22px 20px; gap:14px}
  .upsell-brand{font-size:34px}
  .upsell-illustration{height:150px}
  .upsell-content h2{font-size:22px}
  .upsell-note{font-size:16px}
  .upsell-buttons{flex-direction:column; align-items:stretch}
}

/* --- PayPal approval box + toast --- */
.paypal-approval-box{margin-top:12px;padding:12px;border:1px solid rgba(255,255,255,.12);border-radius:12px;background:rgba(0,0,0,.22)}
.paypal-approval-title{font-size:12px;opacity:.85;margin-bottom:8px}
.paypal-approval-row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.paypal-approval-row a{color:#fff;text-decoration:underline;word-break:break-all}
.paypal-approval-hint{font-size:12px;opacity:.75;margin-top:8px;line-height:1.35}

.toast{position:fixed;left:50%;top:18px;transform:translateX(-50%);z-index:9999;max-width:min(720px, calc(100vw - 24px));padding:10px 14px;border-radius:12px;border:1px solid rgba(255,255,255,.14);background:rgba(20,20,22,.92);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);box-shadow:0 10px 30px rgba(0,0,0,.35);font-size:14px}
.toast.success{border-color:rgba(46,204,113,.55);color:#b6ffcd}
.toast.error{border-color:rgba(231,76,60,.55);color:#ffd2d2}

.payment-note{margin-top:10px;padding:10px 12px;border-radius:12px;background:rgba(248,113,113,0.12);border:1px solid rgba(248,113,113,0.35);color:#fecaca;font-size:13px;line-height:1.35;}

/* ====== Additional Responsive Polish (Score & Tailor) ====== */
@media (max-width: 1024px){
  .topbar{padding:0 18px;}
  .card{max-width: 980px;}
}

@media (max-width: 820px){
  /* Make header/nav wrap gracefully on tablets */
  .topbar{flex-wrap:wrap; height:auto; padding:12px 14px; gap:10px;}
  .top-nav{flex-wrap:wrap; justify-content:flex-end; gap:12px;}
}

@media (max-width: 600px){
  /* Ensure JD tool rows don't overflow */
  .jd-footer{flex-wrap:wrap; align-items:flex-start;}
  .jd-form-tools{flex-wrap:wrap; justify-content:flex-start;}
  .jd-form-tools > *{flex:0 0 auto;}
  .jd-generate-btn, .jd-download-btn{min-height:34px;}

  /* Payment modal: tabs wrap + tighter spacing */
  .payment-tabs{flex-wrap:wrap; padding: 10px 14px 0;}
  .payment-panel{padding:16px 14px 18px;}
}

@media (max-width: 480px){
  /* Buttons + icons spacing on very small screens */
  .jd-icon-btn{width:32px; height:32px;}
  .jd-generate-btn{width:100%; justify-content:center;}

  /* Score page: keep inline controls clean */
  .page-score .jd-form-tools{gap:10px;}
  .page-score .jd-form-tools .jd-generate-inline{width:100%;}

  /* Payment modal typography */
  .payment-modal-header{padding:18px 16px 14px;}
  .payment-modal-header h2{font-size:24px;}
  .payment-modal-header p{font-size:13px;}
  .payment-price-box{width:min(360px, calc(100% - 20px));}
  .payment-price-value{font-size:30px;}
  .payment-tab{flex:1 1 auto; text-align:center;}
}

/* Tailor page: keep analysis dropdowns and buttons aligned on small screens */
@media (max-width: 600px){
  .page-tailor .jd-footer-row{flex-direction:column; align-items:stretch;}
}


/* Return-to-upload notice */
.notice-banner{
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 16px;
  padding: 14px 14px 12px;
  backdrop-filter: blur(10px);
}
.notice-title{
  font-weight: 700;
  font-size: 14px;
  color: rgba(226, 232, 240, 0.95);
}
.notice-text{
  margin-top: 4px;
  font-size: 12px;
  color: rgba(226, 232, 240, 0.8);
}
.notice-actions{
  margin-top: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}


.builder-export-frame {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  border: 0;
  bottom: 0;
  right: 0;
}
