:root {
    --bg: #080d1a;
    --card-bg: rgba(14, 22, 44, 0.75);
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.18);
    --text-1: #f0f4ff;
    --text-2: #8b9ab8;
    --text-3: #556380;
    --accent: #4f8ef7;
    --accent-glow: rgba(79, 142, 247, 0.35);
    --accent-dim: rgba(79, 142, 247, 0.12);
    --green: #22c55e;
    --green-dim: rgba(34, 197, 94, 0.12);
    --red-dim: rgba(239, 68, 68, 0.35);
    --dropdown-bg: #111827;
    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow: 0 32px 64px -16px rgba(0, 0, 0, 0.6);
    --ease: cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text-1);
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-x: hidden;
}

/* ── Animated background ── */
.background-blobs {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.5;
    animation: drift 18s infinite alternate ease-in-out;
}

.blob-1 {
    width: 520px;
    height: 520px;
    background: #1d4ed8;
    top: -180px;
    right: -60px;
    animation-duration: 22s;
}

.blob-2 {
    width: 400px;
    height: 400px;
    background: #6d28d9;
    bottom: -150px;
    left: -80px;
    animation-delay: -6s;
}

.blob-3 {
    width: 280px;
    height: 280px;
    background: #0f766e;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -12s;
    opacity: 0.25;
}

@keyframes drift {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(40px, 60px) scale(1.07);
    }
}

/* ── Page layout ── */
.page-wrapper {
    width: 100%;
    max-width: 860px;
    padding: 0 1.25rem 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 100dvh;
}

/* ── Brand bar ── */
.brand-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 0 0;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--text-1);
}

.logo-mark {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: linear-gradient(135deg, #4f8ef7, #6d28d9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: white;
    flex-shrink: 0;
}

.logo-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-2);
}

.logo-accent {
    color: var(--accent);
}

.privacy-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--green-dim);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: var(--green);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    white-space: nowrap;
}

/* ── Main card ── */
.container {
    width: 100%;
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

/* ── Hero header ── */
.hero-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.tool-badge {
    display: inline-block;
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid rgba(79, 142, 247, 0.25);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 0.3rem 0.9rem;
    border-radius: 999px;
}

h1 {
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #f0f4ff 0%, #8eaaff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.15;
}

.hero-header>p {
    color: var(--text-2);
    font-size: 1rem;
    max-width: 480px;
    line-height: 1.6;
}

/* ── Steps row ── */
.steps-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    flex-wrap: nowrap;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex: 0 0 auto;
    padding: 0 0.5rem;
}

.step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-dim);
    border: 1.5px solid var(--accent);
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step span {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-2);
    text-align: center;
    white-space: nowrap;
}

.step-line {
    flex: 1;
    min-width: 24px;
    height: 1px;
    background: linear-gradient(to right, var(--accent), transparent);
    opacity: 0.3;
    margin-bottom: 1.2rem;
}

/* ── Upload ── */
.upload-area {
    display: flex;
    justify-content: center;
}

.hidden-input {
    display: none;
}

.drag-drop-zone {
    width: 100%;
    padding: 3.5rem 2rem;
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.25s var(--ease);
    position: relative;
    overflow: hidden;
}

.drag-drop-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, var(--accent-dim) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.drag-drop-zone:hover::before,
.drag-drop-zone.dragover::before {
    opacity: 1;
}

.drag-drop-zone:hover,
.drag-drop-zone.dragover {
    border-color: var(--accent);
    border-style: solid;
    transform: scale(1.01);
}

.upload-icon-wrap {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: var(--accent-dim);
    border: 1px solid rgba(79, 142, 247, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    transition: transform 0.3s var(--ease);
}

.drag-drop-zone:hover .upload-icon-wrap {
    transform: translateY(-4px);
}

.drag-drop-zone h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

.drag-drop-zone p {
    color: var(--text-2);
    font-size: 0.9rem;
}

.browse-link {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.file-types {
    font-size: 0.72rem;
    color: var(--text-3);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    margin-top: 0.25rem;
}

/* ── Mapping section ── */
.mapping-area {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.mapping-area:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
}

.hidden {
    display: none !important;
}

.mapping-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.mapping-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.mapping-header p {
    color: var(--text-2);
    font-size: 0.85rem;
}

.file-info {
    font-size: 0.75rem;
    color: var(--text-3);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.3rem 0.75rem;
    white-space: nowrap;
    align-self: flex-start;
}

/* ── Mapping grid ── */
.mapping-grid {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: 38vh;
    overflow-y: auto;
    padding-right: 4px;
}

.mapping-grid::-webkit-scrollbar {
    width: 6px;
}

.mapping-grid::-webkit-scrollbar-track {
    background: transparent;
}

.mapping-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 10px;
}

.mapping-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.22);
}

.mapping-row {
    display: grid;
    grid-template-columns: 1fr auto 1.4fr;
    align-items: center;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.65rem 1rem;
    transition: background 0.2s ease, border-color 0.2s ease;
    gap: 0.75rem;
}

.mapping-row:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-hover);
}

.ghl-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-1);
    min-width: 0;
}

.ghl-field span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mapping-separator {
    color: var(--text-3);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    background: var(--dropdown-bg);
    color: var(--text-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.55rem 2rem 0.55rem 0.85rem;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="%238b9ab8" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>');
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

select.matched {
    border-color: rgba(34, 197, 94, 0.4);
}

select.unmatched {
    border-color: rgba(239, 68, 68, 0.3);
}

/* ── Action footer ── */
.action-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    gap: 0.75rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.7rem 1.4rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s var(--ease);
    border: none;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, #4f8ef7, #6366f1);
    color: white;
    box-shadow: 0 4px 18px var(--accent-glow);
    padding-right: 1.2rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--accent-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-2);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-1);
}

/* ── Page footer ── */
.page-footer {
    text-align: center;
    color: var(--text-3);
    font-size: 0.78rem;
    padding-bottom: 1rem;
}

.page-footer a {
    color: var(--accent);
    text-decoration: none;
}

.page-footer a:hover {
    text-decoration: underline;
}

.footer-privacy {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--green);
    opacity: 0.8;
    margin-left: 0.25rem;
}

/* ── Mobile ── */
@media (max-width: 600px) {
    .container {
        padding: 1.75rem 1.25rem;
    }

    .mapping-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .mapping-separator {
        display: none;
    }

    .steps-row {
        gap: 0.25rem;
    }

    .step span {
        font-size: 0.62rem;
    }

    .step-line {
        min-width: 12px;
    }

    .brand-bar {
        padding-top: 1rem;
    }

    .action-footer {
        flex-direction: column-reverse;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .mapping-header {
        flex-direction: column;
    }

    .file-info {
        align-self: flex-start;
    }

    .drag-drop-zone {
        padding: 2.5rem 1.25rem;
    }
}