:root {
    /* 1. New Oceanic Teal Primary Colors */
    --primary: #0D9488; 
    --primary-hover: #0F766E;
    
    --secondary: #6B7280;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --surface: #F9FAFB;
    --card: #FFFFFF;
    --text-main: #111827;
    --text-muted: #6B7280;
    --border: #E5E7EB;
    --desk-bg: #e2e8f0;

    /* Background overlay remains transparent to let animation show through */
    --bg-gradient: linear-gradient(180deg, transparent 0%, var(--surface) 350px);
    
    /* 2. Updated Gradients to match Teal & Sky Blue */
    --primary-gradient: linear-gradient(135deg, #0D9488 0%, #0284C7 100%);
    --primary-gradient-hover: linear-gradient(135deg, #0F766E 0%, #0369A1 100%);
    --text-gradient: linear-gradient(135deg, #06B6D4 0%, #0D9488 100%);
    --card-gradient: linear-gradient(180deg, #FFFFFF 0%, #FCFDFD 100%);
    --border-gradient: linear-gradient(135deg, rgba(13, 148, 136, 0.25) 0%, rgba(2, 132, 199, 0.05) 100%);
}

body {
    font-family: 'Inter', sans-serif;
    background-image: var(--bg-gradient);
    
    /* Starting background color to match the animation's 0% state */
    background-color: #99F6E4; 
    
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--text-main);
    font-size: 0.75rem;
    overflow-x: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;

    animation: shiftBgColor 15s infinite alternate ease-in-out;
}

/* 3. New soft, fresh background transitions */
@keyframes shiftBgColor {
    0% {
        background-color: #99F6E4; /* Soft Mint/Teal */
    }
    33% {
        background-color: #BAE6FD; /* Soft Sky Blue */
    }
    66% {
        background-color: #E2E8F0; /* Clean Slate/Gray */
    }
    100% {
        background-color: #A7F3D0; /* Soft Emerald */
    }
}


/* Gradient Text Utility */
.text-gradient {
    background: var(--text-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    letter-spacing: -0.025em;
}

h4 {
    font-size: 1rem;
}

h5 {
    font-size: 0.9rem;
}

h6 {
    font-size: 0.8rem;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-primary {
    color: var(--primary) !important;
}

/* Buttons */
.btn {
    font-size: 0.75rem;
    padding: 0.4rem 0.8rem;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: var(--primary-gradient);
    border: none;
    font-weight: 500;
    color: #fff;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.15);
}

.btn-primary:hover {
    background: var(--primary-gradient-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(79, 70, 229, 0.25);
    color: #fff;
}

/* Optimize with JD - navbar CTA used across editor & standalone pages */
.btn-optimize-jd {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 99px;
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: 0.01em;
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.28);
    transition: opacity .15s, transform .13s, box-shadow .15s;
}
.btn-optimize-jd:hover {
    color: #fff;
    opacity: .9;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.38);
}
.btn-optimize-jd i { font-size: 0.65rem; }

/* Cards with Gradient Border */
.card-custom {
    background: var(--card-gradient);
    border-radius: 12px;
    box-shadow: 0 8px 12px -3px rgba(0, 0, 0, 0.03), 0 4px 6px -2px rgba(0, 0, 0, 0.015);
    transition: all 0.3s ease-in-out;
    position: relative;
    border: 1px solid transparent;
}

.card-custom::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 12px;
    padding: 1px;
    background: var(--border-gradient);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* Layout */
.navbar-custom {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    height: 54px;
}

.main-container {
    flex: 1;
    overflow-y: auto;
    padding: 2.5rem 1rem 5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.workflow-container {
    width: 100%;
    max-width: 800px;
    transition: max-width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.workflow-container.expanded {
    max-width: 95%;
}

/* Banner Ad Placements */
.static-ad-banner {
    width: 100%;
    height: 90px;
    /* max-width: 728px; */
    margin: 0 auto;
    background-color: transparent;
    /* border: 1px dashed var(--border);
    border-radius: 8px; */
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 0.65rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.video-ad-placeholder {
    width: 280px;
    height: 157px;
    background: var(--desk-bg);
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #64748b;
    margin: 1.25rem 0;
}

/* Animated Stepper */
.stepper-wrapper {
    transition: opacity 0.5s ease, height 0.5s ease, margin 0.5s ease;
    overflow: hidden;
    height: 70px;
}

.stepper-wrapper.hidden {
    opacity: 0;
    height: 0;
    margin-bottom: 0 !important;
    pointer-events: none;
}

.stepper {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
    position: relative;
    max-width: 580px;
    margin-left: auto;
    margin-right: auto;
}

.stepper::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--border);
    z-index: 0;
    border-radius: 2px;
}

.stepper-progress {
    position: absolute;
    top: 12px;
    left: 0;
    width: 0%;
    height: 4px;
    background: var(--success);
    z-index: 0;
    border-radius: 2px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.step {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    transition: all 0.4s;
}

.step-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--secondary);
}

.step:not(.active):not(.completed) .step-icon {
    transform: scale(0.9);
}

.step.active .step-icon {
    background: var(--primary-gradient);
    border: none;
    color: white;
    box-shadow: 0 0 0 5px rgba(79, 70, 229, 0.12);
    transform: scale(1.1);
    animation: pulse-ring 2s infinite;
}

.step.active .step-label {
    color: var(--primary);
    font-weight: 600;
}

.step.completed .step-icon {
    background: var(--success);
    border: none;
    color: white;
    transform: scale(1.05);
}

.step.completed .step-label {
    color: var(--text-main);
}

.step-label {
    font-size: 0.65rem;
    font-weight: 500;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: color 0.3s;
}

@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.3);
    }

    70% {
        box-shadow: 0 0 0 8px rgba(79, 70, 229, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(79, 70, 229, 0);
    }
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed rgba(79, 70, 229, 0.3);
    border-radius: 12px;
    padding: 3rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.03);
}

.upload-icon {
    font-size: 2.2rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
    opacity: 0.9;
}

/* Loaders */
.ai-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 0;
}

.spinner-border {
    width: 2rem;
    height: 2rem;
    color: var(--primary);
    border-width: 0.15em;
}

.progress-message {
    margin-top: 0.75rem;
    font-weight: 500;
    color: var(--secondary);
    min-height: 20px;
    font-size: 0.85rem;
}

/* Badges */
.badge-skill {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.05) 0%, rgba(79, 70, 229, 0.1) 100%);
    color: var(--primary);
    border: 1px solid rgba(79, 70, 229, 0.15);
    font-weight: 500;
    font-size: 0.7rem;
}

.badge-missing {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.05) 0%, rgba(239, 68, 68, 0.1) 100%);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.15);
    font-size: 0.7rem;
}

.badge-added {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(16, 185, 129, 0.15) 100%);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
    font-size: 0.7rem;
}

/* Modern Inputs */
.modern-input-group {
    display: flex;
    align-items: baseline;
    margin-bottom: 1rem;
    gap: 1rem;
}

.modern-input-label {
    width: 100px;
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-align: right;
}

.modern-input {
    flex-grow: 1;
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
    padding: 0.4rem 0;
    font-size: 0.75rem;
    color: var(--text-main);
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}

.modern-input:focus {
    border-bottom-color: var(--primary);
}

/* Bootstrap Accordion Overrides */
.custom-accordion .accordion-item {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
}

/* Editor entrance animation */
@keyframes editor-slide-in {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#resumeEditorAccordion.editor-animating .accordion-item {
    opacity: 0;
    animation: editor-slide-in 0.72s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

#resumeEditorAccordion.editor-animating .accordion-item:nth-child(1) {
    animation-delay: 0.00s;
}

#resumeEditorAccordion.editor-animating .accordion-item:nth-child(2) {
    animation-delay: 0.18s;
}

#resumeEditorAccordion.editor-animating .accordion-item:nth-child(3) {
    animation-delay: 0.32s;
}

#resumeEditorAccordion.editor-animating .accordion-item:nth-child(4) {
    animation-delay: 0.46s;
}

#resumeEditorAccordion.editor-animating .accordion-item:nth-child(5) {
    animation-delay: 0.60s;
}

#resumeEditorAccordion.editor-animating .accordion-item:nth-child(6) {
    animation-delay: 0.74s;
}

#resumeEditorAccordion.editor-animating .accordion-item:nth-child(7) {
    animation-delay: 0.88s;
}

#resumeEditorAccordion.editor-animating .accordion-item:nth-child(8) {
    animation-delay: 1.02s;
}

/* Expand-all button */
.editor-expand-all-btn {
    background: none;
    border: none;
    padding: 2px 4px;
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    line-height: 1;
}

.editor-expand-all-btn:hover {
    color: var(--primary);
    background: rgba(9, 86, 251, 0.07);
}

.editor-expand-all-btn svg {
    display: block;
}

/* Scroll-hint bounce */
@keyframes hint-bounce {

    0%,
    100% {
        transform: translateY(0);
        opacity: 0.55;
    }

    50% {
        transform: translateY(5px);
        opacity: 1;
    }
}

.editor-scroll-hint {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 6px 0 2px;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.15s;
}

.editor-scroll-hint svg {
    animation: hint-bounce 1.6s ease-in-out infinite;
}

.editor-scroll-hint:hover {
    color: var(--primary);
}

.editor-scroll-hint.hidden {
    display: none;
}

/* ---- Editor Tab Bar ---- */
.editor-tabbed-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

.editor-tab-bar {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding: 0 14px;
    flex-shrink: 0;
    gap: 2px;
}

.tab-lbl-sm { display: none; }

.editor-tab {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    padding: 10px 10px 9px;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: color 0.18s, border-color 0.18s;
    white-space: nowrap;
}
.editor-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.editor-tab:hover:not(.active) { color: var(--text-main); }
.editor-tab svg { flex-shrink: 0; }

.editor-tab-panel {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 14px 24px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.editor-tab-panel::-webkit-scrollbar { width: 4px; }
.editor-tab-panel::-webkit-scrollbar-track { background: transparent; }
.editor-tab-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.editor-tab-panel.hidden { display: none; }

/* ---- Job View Panel ---- */
.job-view-hero {
    background: var(--primary-gradient);
    border-radius: 10px;
    padding: 22px 18px 18px;
    color: #fff;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}
.job-view-hero::before {
    content: '';
    position: absolute;
    top: -40px; right: -28px;
    width: 130px; height: 130px;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
    pointer-events: none;
}
.job-view-hero::after {
    content: '';
    position: absolute;
    bottom: -28px; left: 12px;
    width: 90px; height: 90px;
    background: rgba(255,255,255,0.04);
    border-radius: 50%;
    pointer-events: none;
}
.job-view-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.22);
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.9);
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}
.job-view-title {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.3;
    margin: 0 0 12px;
    position: relative;
    z-index: 1;
}
.job-view-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    position: relative;
    z-index: 1;
}
.job-view-meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.14);
    border: 1px solid rgba(255,255,255,0.22);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 0.62rem;
    font-weight: 500;
    color: rgba(255,255,255,0.92);
    backdrop-filter: blur(4px);
}
.job-view-section-label {
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.job-view-section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
.job-view-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 22px;
}
.job-view-skill-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 11px;
    border-radius: 20px;
    font-size: 0.64rem;
    font-weight: 600;
    background: color-mix(in srgb, var(--primary) 10%, transparent);
    color: var(--primary);
    border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);
    transition: background 0.15s, transform 0.12s;
}
.job-view-skill-chip:hover {
    background: color-mix(in srgb, var(--primary) 18%, transparent);
    transform: translateY(-1px);
}
.job-view-requirements {
    list-style: none;
    padding: 0;
    margin: 0 0 22px;
    display: flex;
    flex-direction: column;
    gap: 9px;
}
.job-view-requirements li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 0.72rem;
    line-height: 1.55;
    color: var(--text-main);
}
.job-req-check {
    flex-shrink: 0;
    margin-top: 1px;
    display: block;
}
.job-req-check-circle {
    fill: var(--primary);
}
.job-view-jd-label {
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.job-view-jd-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
.job-view-jd-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 0.67rem;
    line-height: 1.65;
    color: var(--text-muted);
    white-space: pre-wrap;
    font-family: inherit;
}

.custom-accordion .accordion-button {
    background: transparent;
    padding: 1rem 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
    box-shadow: none;
}

.custom-accordion .accordion-button:not(.collapsed) {
    color: var(--primary);
    background: transparent;
    box-shadow: none;
}

.custom-accordion .accordion-body {
    padding: 1rem 0 1.5rem 0;
}

/* ---- Resume Editor - compact field overrides ---- */
/* Tighter row spacing within a section */
#resumeEditorAccordion .modern-input-group {
    margin-bottom: 5px;
    gap: 8px;
    align-items: baseline;
}

/* Narrower label to give the input more room */
#resumeEditorAccordion .modern-input-label {
    /* width: 72px; */
    font-size: 0.64rem;
    /* text-align: right; */
    flex-shrink: 0;
    line-height: 1.3;
    padding-top: 0.25rem;
}

/* Compact input sizing */
#resumeEditorAccordion .modern-input {
    padding: 0.28rem 0;
    font-size: 0.73rem;
}

/* Squeeze accordion body padding so sections breathe but aren't excessive */
#resumeEditorAccordion .accordion-body {
    padding: 0.4rem 0 0.9rem 0;
}

/* Repeatable item card */
.editor-repeatable {
    background: #fafbfc;
    border-color: #e8ecf0 !important;
    padding: 8px 10px !important;
}

.editor-repeatable+.editor-repeatable {
    margin-top: 6px;
}

.editor-remove-btn {
    opacity: 0.5;
    transition: opacity 0.15s;
}

.editor-remove-btn:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.08);
    border-radius: 4px;
}

.editor-add-btn {
    margin-top: 6px;
    font-size: 0.72rem;
}

/* Section title row inside a repeatable */
.editor-repeatable .editor-item-title {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* Diff highlights */
/* Highlight added words - instant on, slow reveal-out */
.diff-added {
    border-radius: 2px;
    /* Animation is set exclusively via inline style by _startHighlightAnimation()
       so it only fires on explicit tab-switch, not whenever spans enter the DOM */
}

/*
  Reveal cycle (3 s total, one-shot):
  0%   → instant highlight (no fade in - appears immediately)
  65%  → hold so user can read
  100% → faded away (highlight removed like a reveal wipe)
*/
@keyframes hl-reveal {
    0%, 65% { background-color: color-mix(in srgb, var(--primary) 28%, transparent); color: var(--primary-hover); }
    100%    { background-color: transparent; color: inherit; }
}

.highlights-hidden .diff-added {
    background-color: transparent !important;
    color: inherit !important;
    animation: none !important;
}

/* ================================================================
   RESUME VIEWER HEADER
   ================================================================ */
.resume-viewer-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-bottom: 1px solid var(--border);
    background: #fff;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* Enhanced / Original toggle pill */
.rvh-tabs {
    display: flex;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2px;
    gap: 2px;
}
.rvh-tab {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: none;
    background: none;
    border-radius: 16px;
    padding: 5px 11px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.18s, color 0.18s, box-shadow 0.18s;
    white-space: nowrap;
    line-height: 1;
}
.rvh-tab.active {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: 0 2px 6px rgba(79,70,229,0.25);
}
.rvh-tab:not(.active):hover { color: var(--text-main); background: var(--border); }
.rvh-tab svg { flex-shrink: 0; }

/* Region + Template bar */
.rvh-region-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.rvh-region-group {
    display: flex;
    align-items: center;
    gap: 4px;
}
.rvh-region-label {
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    white-space: nowrap;
}
.rvh-region-sep {
    width: 1px;
    height: 18px;
    background: var(--border);
    flex-shrink: 0;
    margin: 0 2px;
}
.rvh-select-region {
    max-width: 148px;
}
/* Dim "coming soon" options */
.rvh-select-region option:disabled {
    color: #b0b8c1;
}

/* Template select */
.rvh-select {
    flex: 1;
    min-width: 110px;
    max-width: 170px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 5px 26px 5px 9px;
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-main);
    background: #fff url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e") no-repeat right 7px center / 12px;
    appearance: none;
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s;
}
.rvh-select:focus { border-color: var(--primary); }

/* Right controls group */
.rvh-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

/* Zoom cluster */
.rvh-zoom {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}
.rvh-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 5px 7px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.14s, background 0.14s;
    line-height: 1;
}
.rvh-icon-btn:hover { color: var(--primary); background: rgba(79,70,229,0.06); }
.rvh-zoom-val {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-main);
    min-width: 36px;
    text-align: center;
    user-select: none;
    padding: 0 1px;
}

/* Color palette button */
.rvh-palette-anchor { position: relative; }
.rvh-palette-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 5px 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.14s, border-color 0.14s, background 0.14s;
    line-height: 1;
}
.rvh-palette-btn:hover,
.rvh-palette-btn.active { color: var(--primary); border-color: var(--primary); background: rgba(79,70,229,0.04); }

/* PDF button */
.rvh-btn-pdf {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 6px 13px;
    font-size: 0.68rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.14s, transform 0.12s;
    box-shadow: 0 2px 6px rgba(79,70,229,0.22);
    white-space: nowrap;
    line-height: 1;
}
.rvh-btn-pdf:hover { opacity: 0.9; transform: translateY(-1px); }

/* ================================================================
   COLOR PALETTE OVERLAY
   ================================================================ */
.color-palette-overlay {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 272px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.13), 0 4px 12px rgba(0,0,0,0.06);
    z-index: 9999;
    overflow: hidden;
    animation: cpo-appear 0.18s cubic-bezier(0.22,1,0.36,1);
}
.color-palette-overlay.hidden { display: none; }

@keyframes cpo-appear {
    from { opacity: 0; transform: translateY(-6px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.cpo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 9px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--primary) 5%, #fff);
}
.cpo-title {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-main);
}
.cpo-close {
    background: none;
    border: none;
    padding: 3px;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 5px;
    display: flex;
    align-items: center;
    transition: color 0.14s, background 0.14s;
    line-height: 1;
}
.cpo-close:hover { color: var(--danger); background: rgba(239,68,68,0.08); }

.cpo-body {
    padding: 6px 14px 4px;
}

/* Theme preset dots */
.cpo-themes {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 8px 0 9px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}
.cpo-themes-label {
    font-size: 0.57rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
}
.cpo-theme-dots {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.cpo-theme-dot {
    position: relative;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid transparent;
    padding: 0;
    cursor: pointer;
    background: linear-gradient(135deg, var(--dot-a) 0%, var(--dot-b) 100%);
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    transition: transform 0.14s, box-shadow 0.14s, border-color 0.14s;
    overflow: visible;
}
.cpo-theme-dot:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 8px rgba(0,0,0,0.22);
}
.cpo-theme-dot.active {
    border-color: var(--text-main);
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--text-main);
    transform: scale(1.1);
}
.cpo-dot-label {
    position: absolute;
    bottom: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15,23,42,0.85);
    color: #fff;
    font-size: 0.55rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s;
}
.cpo-theme-dot:hover .cpo-dot-label { opacity: 1; }

.cpo-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(229,231,235,0.6);
}
.cpo-row:last-child { border-bottom: none; }
.cpo-row-info { display: flex; flex-direction: column; gap: 1px; }
.cpo-row-label { font-size: 0.67rem; font-weight: 600; color: var(--text-main); }
.cpo-row-desc  { font-size: 0.57rem; color: var(--text-muted); }
.cpo-swatch-wrap {
    display: flex;
    align-items: center;
    gap: 7px;
}
.cpo-color-input {
    width: 28px;
    height: 22px;
    border: 1px solid var(--border);
    border-radius: 5px;
    cursor: pointer;
    padding: 1px;
    background: none;
    flex-shrink: 0;
}
.cpo-color-input::-webkit-color-swatch-wrapper { padding: 0; }
.cpo-color-input::-webkit-color-swatch { border: none; border-radius: 3px; }
.cpo-hex {
    font-size: 0.6rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-muted);
    min-width: 54px;
    letter-spacing: 0.02em;
}
.cpo-footer {
    padding: 8px 14px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}
.cpo-reset-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    background: none;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 5px 10px;
    font-size: 0.64rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.14s, border-color 0.14s;
}
.cpo-reset-btn:hover { color: var(--primary); border-color: var(--primary); }

/* Layered Reveal Animation */
.reveal-container {
    position: relative;
    height: 70vh;
    min-height: 500px;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--desk-bg);
    border-radius: 0 0 12px 12px;
    scrollbar-width: thin;
}

.reveal-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    min-height: 100%;
    padding: 2.5rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ── Card Shuffle Layer System ─────────────────────────────────────────────── */
/* z-indices are set here as defaults; JS _rebuildZIndex() overrides dynamically */
.layer-original { z-index: 1; }
.layer-enhanced { z-index: 2; background: var(--desk-bg); }
.layer-edited   { z-index: 3; background: var(--desk-bg); }

/* Card exits: slides to the right with a slight clockwise tilt */
@keyframes cardShuffleExit {
    0%   { transform: translateX(0)    rotate(0deg)  scale(1);    opacity: 1; }
    35%  { transform: translateX(25%)  rotate(2deg)  scale(0.99); opacity: 0.9; }
    100% { transform: translateX(108%) rotate(7deg)  scale(0.93); opacity: 0; }
}

/* Card enters: rises gently from slightly below */
@keyframes cardShuffleEnter {
    0%   { transform: translateY(14px) scale(0.965); opacity: 0; }
    60%  { transform: translateY(-3px) scale(1.003); opacity: 1; }
    100% { transform: translateY(0)    scale(1);     opacity: 1; }
}

.reveal-layer.card-exiting {
    animation: cardShuffleExit 0.38s ease-in forwards;
    z-index: 99 !important;
    pointer-events: none;
}

/* Holds a card invisible (but in layout) after it has exited.
   Replaced atomically with card-exiting on animationend so there
   is never a frame where the card is both untransformed and visible. */
.reveal-layer.card-gone {
    visibility: hidden;
    pointer-events: none;
}

.reveal-layer.card-entering {
    animation: cardShuffleEnter 0.44s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Smooth UI Transitions */
.fade-view {
    animation: fadeIn 0.4s ease-in-out forwards;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0);    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Step reveal - staggered slide-up for page-level content blocks */
.sr {
    opacity: 0;
    animation: fadeIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.sr-1 { animation-delay: 0.08s; }
.sr-2 { animation-delay: 0.22s; }
.sr-3 { animation-delay: 0.36s; }
.sr-4 { animation-delay: 0.50s; }
.sr-5 { animation-delay: 0.64s; }
.sr-6 { animation-delay: 0.78s; }

.d-none {
    display: none !important;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 65px;
    right: 20px;
    z-index: 1055;
    font-size: 0.75rem;
}

/* ---------------------------------------------------- */
/* STEP 4 - Full-screen comparison view                 */
/* ---------------------------------------------------- */
body.step4-active .main-container {
    padding: 0.5rem;
    overflow: hidden;
}

body.step4-active #workflow-wrapper {
    height: 100%;
    max-width: 100% !important;
    display: flex;
    flex-direction: column;
}

body.step4-active #step4-comparison {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

body.step4-active #step4-comparison>.row {
    flex: 1;
    min-height: 0;
}

body.step4-active #step4-comparison .col-lg-6 {
    min-height: 0;
}

/* Left col clips content - inner vscroll div handles editor scrolling */
body.step4-active #step4-comparison .col-lg-6:first-child {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

body.step4-active #comparison-card {
    height: 100%;
}

body.step4-active .reveal-container {
    flex: 1;
    height: auto !important;
    min-height: 0;
}

.vscroll {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.vscroll::-webkit-scrollbar {
    display: none;
}

.resume-editor-card {
    padding-bottom: 200px;
}

/* Print - show only the active resume layer (JS adds .card-active to it) */
@media print {
    body * { visibility: hidden; }

    .reveal-layer.card-active,
    .reveal-layer.card-active * { visibility: visible; }

    .reveal-layer.card-active {
        position: absolute;
        left: 0; top: 0;
        margin: 0; padding: 0;
    }

    .reveal-layer:not(.card-active) { display: none !important; }

    @page { size: A4; margin: 0; }
}

/* ================================================================
   SEVERITY BADGES (compact, used in score header strip)
   ================================================================ */
.severity-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.severity-critical { background: #fee2e2; color: #b91c1c; }
.severity-high     { background: #ffedd5; color: #c2410c; }
.severity-med      { background: #fef9c3; color: #92400e; }
.severity-low      { background: #dcfce7; color: #166534; }

/* ================================================================
   ATS SCORE HEADER
   ================================================================ */
.ats-score-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
}
.ats-ring { flex-shrink: 0; }
.ats-score-info { flex: 1; }
.ats-score-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.ats-issues-badges { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }

/* ================================================================
   ATS BREAKDOWN HINT
   ================================================================ */
.ats-breakdown-hint {
    margin-top: 100px;
    text-align: center;
    padding-bottom: 1.5rem;
}
.ats-breakdown-toggle {
    background: none;
    border: none;
    cursor: pointer;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 0;
}
.ats-breakdown-toggle:hover .ats-toggle-label { opacity: 0.75; }
.ats-toggle-label {
    font-size: 0.875rem;
    font-weight: 700;
    background: linear-gradient(135deg, #0D9488 0%, #0284C7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.3;
    transition: opacity 0.2s;
}
.ats-toggle-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.ats-dbl-arrow {
    display: inline-flex;
    animation: ats-bounce 1.4s ease-in-out infinite;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.ats-dbl-arrow.ats-arrow-up {
    transform: rotate(180deg);
    animation: none;
}
@keyframes ats-bounce {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(7px); }
}

/* ================================================================
   SCORING ACCORDION
   ================================================================ */
/* ── Flat scoring table wrapper ────────────────────────────────── */
.scoring-accordion {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.scoring-accordion-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    padding: 8px 12px 6px;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}

/* Category section header row */
.cat-section-hdr td { padding: 0; }
.cat-sec-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px 8px 14px;
    background: var(--primary-gradient);
    border-top: 1px solid rgba(255,255,255,0.15);
    position: relative;
}
.cat-section-hdr:first-child .cat-sec-inner { border-top: none; }

.cat-name {
    flex: 1;
    font-size: 0.73rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cat-bar-inline {
    width: 64px;
    height: 5px;
    background: rgba(255,255,255,0.25);
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}
.cat-bar-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.cat-sec-score {
    font-size: 0.67rem;
    color: rgba(255,255,255,0.85);
    white-space: nowrap;
    flex-shrink: 0;
}
.cat-sec-score .cat-b { opacity: 0.55; }
.cat-sec-score strong { color: #fff; }

/* ================================================================
   ENHANCEMENT COMPARISON CARDS (Enhancements tab)
   ================================================================ */
.enh-compare-wrap {
    overflow: hidden;
}
.enh-cat-section { margin-bottom: 4px; }
.enh-cat-hdr {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px 8px 14px;
    background: var(--primary-gradient);
    border-top: 1px solid rgba(255,255,255,0.15);
}
.enh-cat-section:first-child .enh-cat-hdr { border-top: none; }

.enh-crit-card {
    margin: 6px 10px;
    overflow: hidden;
    background: #fff;
}

.enh-crit-card:last-child  { margin-bottom: 8px; }

/* Card header */
.enh-crit-hdr {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px 8px;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
}
.enh-status-icon {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    line-height: 0;
}
.enh-crit-name {
    flex: 1;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-main);
}

/* Card body - 3-point layout */
.enh-crit-body {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.enh-point {
    display: flex;
    gap: 11px;
    align-items: flex-start;
}
.enh-point-divider {
    height: 1px;
    background: linear-gradient(90deg, #e2e8f0 0%, transparent 100%);
    margin: 2px 0;
}

/* Point icon pill */
.enh-point-icon {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
    line-height: 0;
}
.enh-icon-orig    { background: #f1f5f9; }
.enh-icon-enh     { background: #ede9fe; }
.enh-icon-outcome { background: #d1fae5; }

.enh-point-content {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
    flex-wrap: wrap;
}
.enh-point-label {
    font-size: 0.59rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    flex-shrink: 0;
    white-space: nowrap;
}
.enh-point-val {
    font-size: 0.73rem;
    color: var(--text-main);
    line-height: 1.5;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

/* Final outcome score row */
.enh-outcome-scores {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.enh-outcome-before { color: var(--text-muted); }
.enh-outcome-icon   { display: inline-flex; align-items: center; line-height: 0; margin-left: 2px; }

.crit-delta.neutral { font-size: 0.62rem; color: var(--text-muted); padding: 2px 5px; border-radius: 4px; background: #f1f5f9; display: inline-block; }

/* Criteria table */
.crit-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.crit-main-row { vertical-align: middle; border-top: 1px solid #f1f5f9; }
.crit-main-row.status-warn { background: #fffdf0; }
.crit-main-row.status-fail { background: #fff8f8; }
.crit-main-row.status-pass { background: #f2fff2; }
.crit-detail-row { border-bottom: 1px solid #f8fafc; }

.crit-td-dot  { width: 28px; padding: 8px 0 8px 12px; }
.crit-td-name { padding: 8px 6px; font-size: 0.74rem; font-weight: 600; color: var(--text-main); }
.crit-td-score {
    width: 100px;
    padding: 8px 4px;
    font-size: 0.67rem;
    white-space: nowrap;
    text-align: right;
    color: var(--text-muted);
}
.crit-td-score .cb { opacity: 0.55; }
.crit-td-score .ca { font-weight: 600; }
.crit-td-delta {
    width: 44px;
    padding: 8px 6px;
    text-align: right;
}
.crit-td-badge { width: 46px; padding: 8px 10px 8px 4px; text-align: right; }
.crit-detail-row td { padding: 0 10px 8px 28px; }
.crit-td-detail { padding: 0 10px 8px 6px !important; }

.crit-dot {
    display: inline-block;
    width: 7px; height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dot-pass { background: #10B981; }
.dot-warn { background: #F59E0B; }
.dot-fail { background: #EF4444; }

.crit-pts { font-size: 0.63rem; color: var(--text-muted); }
.crit-delta { font-size: 0.62rem; font-weight: 700; padding: 2px 5px; border-radius: 4px; display: inline-block; }
.crit-delta.pos     { background: #dcfce7; color: #15803d; }
.crit-delta.neg     { background: #fee2e2; color: #b91c1c; }

.crit-badge {
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 2px 5px;
    border-radius: 4px;
    display: inline-block;
}
.badge-pass { background: #dcfce7; color: #15803d; }
.badge-warn { background: #fef9c3; color: #92400e; }
.badge-fail { background: #fee2e2; color: #b91c1c; }

.crit-msg {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.45;
}
.crit-fix-row {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    margin-top: 4px;
    font-size: 0.67rem;
    color: #0369a1;
    line-height: 1.4;
}
.crit-fix-row i { margin-top: 1px; flex-shrink: 0; font-size: 0.63rem; }
.crit-fix-row.applied { color: #15803d; }

/* ================================================================
   ISSUE BULLET LISTS (score header + mismatches tab)
   ================================================================ */
.ats-issue-bullets { margin-top: 8px; }
.mismatch-list { padding: 4px 0; }
.issue-bullet {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid #f1f5f9;
}
.issue-bullet:last-child { border-bottom: none; }

/* Severity badge - fixed width so issue-text always starts at the same indent */
.sev-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    flex-shrink: 0;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1.4;
}
.sev-critical { background: #fff1f2; color: var(--danger); border: 1px solid var(--danger); }
.sev-high     { background: #fff7ed; color: var(--danger); border: 1px solid var(--danger); }
.sev-med      { background: #fffbeb; color: var(--warning); border: 1px solid var(--warning); }
.sev-low      { background: #f0fdf4; color: var(--text-muted); border: 1px solid var(--text-muted); }

.issue-text {
    font-size: 0.73rem;
    color: var(--text-main);
    line-height: 1.5;
}
.no-issues-msg {
    font-size: 0.72rem;
    color: #15803d;
    display: flex;
    align-items: center;
    gap: 6px;
}
.sev-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.sev-count { font-weight: 400; opacity: 0.65; }

/* ================================================================
   ENHANCEMENT SCORE BAR (step-4 main header)
   ================================================================ */
.enh-score-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}
.enh-score-bar.compact { gap: 6px; }
.enh-ring-wrap  { flex-shrink: 0; }
.enh-arrow-icon { color: var(--text-muted); font-size: 0.85rem; flex-shrink: 0; }

.score-ring-labeled {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.score-ring-label {
    font-size: 0.52rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.enh-delta-pill {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
}
.enh-delta-pill.pos { background: #dcfce7; color: #15803d; }
.enh-delta-pill.neg { background: #fee2e2; color: #b91c1c; }

/* ================================================================
   JOB DETAIL VIEW
   ================================================================ */
.jd-detail-view { font-size: 0.8rem; padding: 4px; }
.jd-row {
    display: flex;
    gap: 8px;
    padding: 6px 4px;
    border-bottom: 1px solid #f1f5f9;
    align-items: flex-start;
}
.jd-tag-row { flex-direction: column; }
.jd-tag-row .jd-label { margin-bottom: 4px; }
.jd-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.jd-label {
    font-size: 0.63rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    min-width: 100px;
    flex-shrink: 0;
    padding-top: 1px;
}
.jd-val { font-size: 0.78rem; color: var(--text-main); line-height: 1.4; }

/* ================================================================
   RESPONSIVE - TABLET  (< 992px)
   ================================================================ */
@media (max-width: 991.98px) {

    /* Expanded workflow always fills available width on non-desktop */
    .workflow-container.expanded { max-width: 100%; }

    /* ── Step 4: unlock the viewport-locked layout ── */

    /* Restore scrolling - the main container was overflow:hidden on all sizes */
    body.step4-active .main-container {
        padding: 0.75rem 0.5rem 2rem;
        overflow-y: auto !important;
    }

    /* Workflow wrapper: natural height, not viewport-filling */
    body.step4-active #workflow-wrapper {
        height: auto !important;
        flex: none;
    }

    /* Step 4 container: block layout so columns stack normally */
    body.step4-active #step4-comparison {
        flex: none !important;
        display: block !important;
    }

    /* Row: stop trying to fill remaining flex height */
    body.step4-active #step4-comparison > .row {
        flex: none !important;
    }

    /* Both columns: natural height, no clipping */
    body.step4-active #step4-comparison .col-lg-6 {
        height: auto !important;
        overflow: visible !important;
    }

    /* Left column specifically: remove overflow clip; keep d-flex flex-column (Bootstrap classes) */
    body.step4-active #step4-comparison .col-lg-6:first-child {
        overflow: visible !important;
    }

    /* Inner flex wrapper: don't grow to fill space; let content set height */
    #editor-scroll-wrapper {
        flex-grow: 0 !important;
        overflow: visible !important;
    }

    /* Editor card and vscroll: auto height - page scroll handles navigation */
    .editor-tabbed-card { height: auto !important; }
    .vscroll            { height: auto !important; overflow-y: visible !important; }

    /* Tab panel: bounded max-height with its own scroll so content is reachable */
    .editor-tab-panel { max-height: 55vh; }

    /* Resume comparison card: natural height */
    body.step4-active #comparison-card { height: auto !important; }

    /* Resume preview: fixed viewport height - scrollable inside */
    body.step4-active .reveal-container {
        flex: none !important;
        height: 65vh !important;
        min-height: 380px !important;
    }
}

/* ================================================================
   RESPONSIVE - MOBILE  (< 768px)
   ================================================================ */
@media (max-width: 767.98px) {

    /* Tighter main padding */
    .main-container { padding: 1.25rem 0.75rem 3rem; }

    /* Navbar: natural height on mobile */
    .navbar-custom { height: auto; }

    /* Step 3 header: wrap button below title */
    #step3-ats-result > .d-flex {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    #step3-ats-result > .d-flex > button { width: 100%; }

    /* Step 3 ATS score header: ring centered on its own row, issues below */
    .ats-score-header {
        flex-direction: column;
        align-items: center;
    }
    .ats-ring { margin-bottom: 4px; }
    .ats-score-info { width: 100%; }

    /* Step 4 score card: stack heading and rings, centered */
    #step4-score-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 0.75rem;
    }

    /* ── Editor tab bar ── */

    /* Short labels on mobile, hide full labels */
    .tab-lbl    { display: none; }
    .tab-lbl-sm { display: inline; }

    /* Tab bar: horizontally scrollable - never wraps or clips */
    .editor-tab-bar {
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        -ms-overflow-style: none;
        flex-wrap: nowrap;
        padding: 0 8px;
    }
    .editor-tab-bar::-webkit-scrollbar { display: none; }

    /* ── Edit tab form: single column - label above input ── */
    .editor-tab-panel .modern-input-group {
        flex-direction: column;
        gap: 2px;
    }
    .editor-tab-panel .modern-input-label {
        width: 100%;
        text-align: left;
        padding-top: 0;
    }
    /* Textareas: at least 6 lines tall on mobile */
    .editor-tab-panel textarea.modern-input { min-height: 7.5rem; }

    /* ── Resume viewer header: two-row layout
       Row 1 - rvh-tabs + template select (same row)
       Row 2 - controls (zoom, palette, highlight, PDF) right-aligned ── */
    .resume-viewer-header {
        padding: 5px 8px;
        row-gap: 6px;
    }
    .rvh-tabs     { order: 1; flex-shrink: 0; }
    .rvh-select   { order: 2; flex: 1; max-width: none; min-width: 0; }
    .rvh-controls { order: 3; flex: 0 0 100%; margin-left: 0; justify-content: flex-end; }

    /* Reveal container: slightly shorter baseline on tablets */
    .reveal-container { min-height: 380px; }
}

/* ================================================================
   RESPONSIVE - SMALL MOBILE  (< 576px)
   ================================================================ */
@media (max-width: 575.98px) {

    .main-container { padding: 1rem 0.5rem 3rem; }

    /* Upload zone: reduce whitespace */
    .upload-zone { padding: 2rem 1rem; }

    /* Step 4 score card: stack score chip below heading */
    #step4-comparison .card-custom.flex-shrink-0 {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Stepper labels: smallest readable size */
    .step-label { font-size: 0.55rem; }

    /* Zoom value label: hide to save space in viewer header
       +/- buttons remain; user can still zoom */
    .rvh-zoom-val { display: none; }

    /* Reveal container: shorter on small phones */
    .reveal-container {
        height: 60vh;
        min-height: 320px;
    }
}