:root {
    --start-bg: #eef1f4;
    --start-surface: #ffffff;
    --start-text: #1f2937;
    --start-muted: #6b7280;
    --start-border: #dde3ea;
    --start-accent: #008c78;
    --start-accent-hover: #007566;
    --start-shadow: 0 18px 40px -24px rgba(15, 23, 42, 0.35);
    --a4-width: 794px;
    --a4-height: 1123px;
}

* { box-sizing: border-box; }

body.start-page {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, system-ui, -apple-system, sans-serif;
    color: var(--start-text);
    background: var(--start-bg);
}

.start-header {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.5rem;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--start-border);
}

.start-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 800;
    color: #0f172a;
    text-decoration: none;
}

.start-brand-mark {
    width: 2rem;
    height: 2rem;
    border-radius: 0.65rem;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    display: grid;
    place-items: center;
    font-size: 0.8rem;
}

.start-header-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--start-muted);
    text-decoration: none;
}

.start-header-link:hover { color: #2563eb; }

.start-steps {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    padding: 1rem 1.25rem 0;
    flex-wrap: wrap;
}

.start-step {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #9ca3af;
}

.start-step span {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-size: 0.72rem;
    background: #e5e7eb;
    color: #6b7280;
}

.start-step.active {
    color: var(--start-text);
}

.start-step.active span {
    background: var(--start-accent);
    color: white;
}

.start-hero {
    text-align: center;
    padding: 1.75rem 1.25rem 1.25rem;
    max-width: 760px;
    margin: 0 auto;
}

.start-hero h1 {
    margin: 0 0 0.65rem;
    font-size: clamp(1.65rem, 3.5vw, 2.35rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #111827;
}

.start-hero p {
    margin: 0;
    color: var(--start-muted);
    line-height: 1.6;
    font-size: 0.95rem;
}

.start-hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.75rem 1rem;
    margin-top: 1.15rem;
}

.start-upload-btn {
    border: none;
    border-radius: 999px;
    padding: 0.7rem 1.15rem;
    background: var(--start-accent);
    color: white;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.start-upload-btn:hover {
    background: var(--start-accent-hover);
}

.start-hero-actions span {
    font-size: 0.82rem;
    color: var(--start-muted);
}

.start-import-banner {
    margin: 1rem auto 0;
    max-width: 36rem;
    padding: 0.7rem 1rem;
    border-radius: 0.75rem;
    background: #ecfdf5;
    color: #047857;
    font-size: 0.88rem;
    font-weight: 600;
}

.start-import-banner.hidden {
    display: none;
}

.start-toolbar {
    max-width: 1680px;
    margin: 0 auto;
    padding: 0 1.25rem 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.start-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    background: var(--start-surface);
    border: 1px solid var(--start-border);
    border-radius: 999px;
    padding: 0.3rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.filter-tab {
    border: none;
    background: transparent;
    border-radius: 999px;
    padding: 0.55rem 1rem;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    color: #4b5563;
    cursor: pointer;
    transition: 0.18s ease;
}

.filter-tab:hover { color: #111827; background: #f3f4f6; }

.filter-tab.active {
    background: #111827;
    color: white;
}

.start-count {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--start-muted);
}

.start-grid-wrap {
    max-width: 1680px;
    margin: 0 auto;
    padding: 0 1.25rem 2.5rem;
}

.start-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
}

.template-card {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    text-align: left;
    width: 100%;
    max-width: none;
}

.template-card-preview {
    position: relative;
    background: #dfe5eb;
    border-radius: 0.35rem;
    overflow: hidden;
    box-shadow: var(--start-shadow);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.template-card:hover .template-card-preview,
.template-card:focus-visible .template-card-preview {
    transform: translateY(-4px);
    box-shadow: 0 24px 48px -20px rgba(15, 23, 42, 0.45);
}

.template-page-shell {
    width: 100%;
    aspect-ratio: 210 / 297;
    position: relative;
    overflow: hidden;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: linear-gradient(180deg, #e8edf2 0%, #d7dee6 100%);
}

.template-page-scale {
    width: 794px;
    height: 1123px;
    margin: 0 auto;
    transform-origin: top center;
    pointer-events: none;
    user-select: none;
}

.start-page .template-page-scale .cv-page {
    width: 794px !important;
    min-height: 1123px !important;
    max-width: none !important;
    margin: 0 !important;
    box-shadow: none;
    box-sizing: border-box;
}

.start-page .template-page-scale .cv-modern-layout {
    min-height: 297mm !important;
}

.start-page .template-page-scale .cv-text-margins {
    min-height: 297mm;
}

.template-card-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(17, 24, 39, 0.52);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.template-card:hover .template-card-overlay,
.template-card:focus-visible .template-card-overlay {
    opacity: 1;
}

.template-choose-btn {
    border: none;
    border-radius: 999px;
    padding: 0.65rem 1rem;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    color: white;
    background: var(--start-accent);
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 140, 120, 0.35);
    transition: background 0.18s ease, transform 0.18s ease;
}

.template-choose-btn:hover {
    background: var(--start-accent-hover);
    transform: scale(1.03);
}

.template-badge-ats {
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
    z-index: 2;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #047857;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.template-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem 0.15rem 0;
}

.template-card-footer strong {
    font-size: 0.82rem;
    color: #111827;
    line-height: 1.3;
}

.template-free-badge {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--start-accent);
    background: rgba(0, 140, 120, 0.1);
    border-radius: 999px;
    padding: 0.2rem 0.5rem;
}

.start-footer {
    text-align: center;
    padding: 0 1.25rem 2.5rem;
}

.start-footer p {
    margin: 0;
    color: #94a3b8;
    font-size: 0.8rem;
}

/* Preview-only photo placeholder (Zety-style sample headshot) */
.start-page .cv-photo-placeholder {
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.12));
    color: rgba(255, 255, 255, 0.95);
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    object-fit: cover;
}

.start-page .cv-header-with-photo .cv-photo-placeholder {
    color: #475569;
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
}

@media (max-width: 640px) {
    .start-steps { gap: 0.75rem; }
    .start-step { font-size: 0.75rem; }
    .start-toolbar { flex-direction: column; align-items: stretch; }
    .start-filters { border-radius: 1rem; }
    .start-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    .template-card-overlay {
        opacity: 1;
        background: linear-gradient(180deg, transparent 50%, rgba(17, 24, 39, 0.78) 100%);
        align-items: flex-end;
        padding-bottom: 0.85rem;
    }
}

@media (min-width: 641px) and (max-width: 900px) {
    .start-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 901px) and (max-width: 1100px) {
    .start-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
