@font-face {
    font-family: Kalameh;
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/WebFonts/fonts/woff2/KalamehWebFaNum-Regular.woff2") format("woff2");
}

@font-face {
    font-family: Kalameh;
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("/WebFonts/fonts/woff2/KalamehWebFaNum-Bold.woff2") format("woff2");
}

* { box-sizing: border-box; }
body {
	  background-image: url("https://images.squarespace-cdn.com/content/v1/678954ac5164df1f9cbcb0a6/3aeb6d7a-2637-4935-bf08-067f46ac5739/BG+-+Pattern.png");
    backdrop-filter: invert(1);
    background-repeat: no-repeat;
    background-size: cover;
}
body.sync-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    line-height: 1.7;
}

body.sync-page main { flex: 1 0 auto; }

img { max-width: 100%; display: block; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }

.sync-page .skip {
    inset-inline-start: 12px;
    background: var(--lime);
    color: var(--lime-ink);
}

.skip:focus { top: 12px; }

.sync-name, main, .sync-foot { width: min(1080px, calc(100% - 40px)); margin: 0 auto; }

.sync-name {
    position: relative;
    z-index: 1;
    padding: 42px 0 4px;
    text-align: center;
}

.sync-name h1 {
    display: inline-grid;
    justify-items: start;
    font-size: clamp(2.8rem, 7vw, 5.4rem);
}

.step-hint {
    margin: 18px auto 0;
    max-width: 46rem;
    color: var(--muted);
    font-size: 0.98rem;
    text-align: center;
}

.section-title { margin: 18px 0 0; text-align: center; font-size: 1.35rem; font-weight: 700; }
.step-copy { margin: 6px auto 0; max-width: 38rem; text-align: center; color: var(--muted); }

.sync-error, .sync-status {
    margin: 16px auto 0;
    max-width: 40rem;
    padding: 12px 14px;
    border-radius: 14px;
    text-align: center;
}

.sync-error { background: rgba(255, 77, 106, 0.12); color: #ffd0d8; border: 1px solid rgba(255, 77, 106, 0.35); }
.sync-status { background: rgba(226, 255, 77, 0.08); color: var(--ok); border: 1px solid rgba(226, 255, 77, 0.28); }

.sync-page .stage {
    display: grid;
    grid-template-columns: 1fr 74px 1fr;
    gap: 14px;
    align-items: center;
    height: auto;
    min-height: 0;
    margin-top: 22px;
    perspective: none;
}

.file-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 28px 26px 22px;
    border-radius: 18px;
    background: #10100e;
    border: 1px solid var(--line);
    transition: border-color 0.25s ease;
}

.file-card::before,
.file-card::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.file-card::before {
    top: 8px;
    inset-inline-end: 8px;
    border-top: 1px solid var(--lime);
    border-inline-end: 1px solid var(--lime);
    border-start-end-radius: 10px;
}

.file-card::after {
    bottom: 6px;
    inset-inline-start: 6px;
    width: 24px;
    height: 24px;
    border-bottom: 1px solid var(--magenta);
    border-inline-start: 1px solid var(--magenta);
    border-end-start-radius: 14px;
}

.file-card.is-hot { border-color: rgba(226, 255, 77, 0.55); }
.file-card h3 { margin: 12px 0 0; text-align: center; font-size: 1.45rem; }
.file-card > p { margin: 4px 0 16px; text-align: center; color: var(--muted); }

.excel-icon { width: 58px; height: 58px; margin: 4px auto 0; }
.excel-icon svg { width: 100%; height: 100%; }

.sync-orb {
    align-self: center;
    display: grid;
    place-items: center;
    width: 74px;
    height: 74px;
    border-radius: 50%;
    background: #10100e;
    border: 1px solid var(--line);
    box-shadow: 5px -4px 0 var(--magenta), -5px 4px 0 var(--lime);
}

.sync-orb svg { width: 34px; height: 34px; color: var(--ink); }
.sync-orb svg path { stroke: currentColor; stroke-width: 1.6; }

.drop {
    position: relative;
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 0;
    padding: 22px 16px;
    text-align: center;
    border: 1.5px dashed rgba(226, 255, 77, 0.38);
    border-radius: 16px;
    background: rgba(226, 255, 77, 0.04);
    cursor: pointer;
}

.drop strong { font-size: 1.02rem; }
.drop em { color: var(--muted); font-style: normal; }
.browse { position: relative; }
.drop input,
.browse input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.browse {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    margin-top: 8px;
    padding: 0 18px;
    border-radius: 12px;
    background: transparent;
    border: 1px solid var(--line);
    color: var(--ink);
    font-weight: 700;
    cursor: pointer;
}

.file-meta { display: flex; flex-direction: column; gap: 8px; }
.file-meta[hidden], .drop[hidden] { display: none !important; }
.file-name { font-size: 1.05rem; word-break: break-word; }
.file-size, .samples { color: var(--muted); font-size: 0.92rem; }
.samples { margin: 0; }

.field { display: grid; gap: 4px; color: var(--muted); font-size: 0.86rem; }
.field-label { color: var(--muted); font-size: 0.86rem; }
.picker { position: relative; }
.picker-btn {
    position: relative;
    width: 100%;
    min-height: 44px;
    padding: 8px 28px 8px 0;
    border: 0;
    border-bottom: 1px solid rgba(239, 236, 227, 0.22);
    background: transparent;
    color: var(--ink);
    text-align: start;
    cursor: pointer;
}
.picker-btn::after {
    content: "";
    position: absolute;
    inset-inline-end: 6px;
    top: 18px;
    width: 8px;
    height: 8px;
    border-inline-end: 1.5px solid var(--lime);
    border-bottom: 1.5px solid var(--lime);
    transform: rotate(45deg);
}
.picker.is-open .picker-btn::after { transform: rotate(-135deg); top: 22px; }
.picker-menu {
    position: absolute;
    z-index: 30;
    inset-inline: 0;
    top: calc(100% + 8px);
    max-height: 240px;
    overflow: auto;
    padding: 6px;
    border: 1px solid rgba(226, 255, 77, 0.28);
    border-radius: 14px;
    background: #141412;
    box-shadow: 6px -4px 0 var(--magenta), -5px 4px 0 rgba(226, 255, 77, 0.72);
}
.picker-opt {
    display: block;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--ink);
    text-align: start;
    cursor: pointer;
}
.picker-opt:hover,
.picker-opt.is-on { background: rgba(226, 255, 77, 0.12); color: var(--lime); }
.field select, .rename, .pair-row select {
    min-height: 44px;
    padding: 8px 0;
    border: 0;
    border-bottom: 1px solid rgba(239, 236, 227, 0.22);
    border-radius: 0;
    background: transparent;
    color: var(--ink);
}

.field select:focus, .rename:focus, .pair-row select:focus { border-bottom-color: var(--lime); outline: none; }

.actions { display: flex; justify-content: center; gap: 12px; margin: 28px 0 8px; }

.sync-go, .ghost {
    min-height: 52px;
    padding: 0 28px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
}

.sync-go {
    border: 1px solid transparent;
    color: var(--lime-ink);
    background: var(--lime);
    transition: transform 0.2s ease;
}

.sync-go:hover { transform: translateY(-1px); }
.sync-go:disabled, .ghost:disabled { opacity: 0.5; cursor: default; transform: none; }

.ghost {
    border: 1px solid var(--line);
    background: transparent;
    color: var(--ink);
}

.ghost:hover { border-color: var(--lime); }

.features {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin: 28px 0 8px;
    text-align: center;
}

body[data-sync-step]:not([data-sync-step="1"]) .features { display: none; }

.features article { display: grid; justify-items: center; gap: 2px; }
.features svg { width: 28px; height: 28px; margin-bottom: 6px; fill: none; stroke: var(--lime); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.features article:nth-child(2) svg, .features article:nth-child(4) svg { stroke: var(--magenta); }
.features b { font-size: 0.98rem; }
.features span { color: var(--muted); font-size: 0.9rem; }

.sync-page .panel {
    margin-top: 18px;
    background: #10100e;
}

.panel h3 { margin: 0 0 12px; }
.rule-block + .rule-block { margin-top: 22px; }
.rule-block h3 { margin: 0 0 12px; font-size: 1.05rem; }
.switch-grid,
.option-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.option-grid-3 { grid-template-columns: repeat(3, 1fr); }
.switch,
.choice {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: center;
    min-height: 84px;
    margin: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
}
.choice { grid-template-columns: 1fr; }
.switch span,
.choice span { display: grid; gap: 2px; }
.switch small,
.choice small { color: var(--muted); font-size: 0.86rem; line-height: 1.55; }
.switch input,
.choice input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}
.switch-ui {
    width: 44px;
    height: 26px;
    border-radius: 99px;
    background: #2a2a26;
    position: relative;
    transition: background 0.2s ease;
}
.switch-ui::after {
    content: "";
    position: absolute;
    top: 3px;
    inset-inline-start: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #efece3;
    transition: inset-inline-start 0.2s ease;
}
.switch input:checked + .switch-ui { background: var(--lime); }
.switch input:checked + .switch-ui::after { inset-inline-start: 21px; background: #141407; }
.switch input:focus-visible + .switch-ui,
.choice:has(input:focus-visible) { outline: 2px solid var(--lime); outline-offset: 3px; }
.switch:has(input:disabled) { opacity: 0.4; cursor: default; }
.choice:has(input:checked) {
    border-color: var(--lime);
    background: rgba(226, 255, 77, 0.07);
}

.match-card { min-height: 0; }
.col-list { display: grid; gap: 8px; }
.col-pick, .add-col {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: transparent;
    cursor: pointer;
}
.col-pick b, .add-col b { display: block; }
.col-pick small, .add-col small { color: var(--muted); }
.col-pick.is-on { border-color: var(--lime); background: rgba(226, 255, 77, 0.06); }

.text-btn {
    margin: 14px auto 0;
    display: inline-flex;
    border: 0;
    background: transparent;
    color: var(--lime);
    font-weight: 700;
    cursor: pointer;
}

#available { display: flex; flex-direction: column; gap: 10px; }
.add-col { margin: 0; }
.add-row { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 12px; }
.add-row .text-btn { margin: 0; }
.pair-row, .out-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto;
    gap: 8px;
    align-items: center;
    margin-top: 10px;
}
.out-row { grid-template-columns: auto 1fr 1.2fr auto auto auto; }
.pair-row { padding: 10px 0; }
.icon-btn {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; display: block; }
.handle { cursor: grab; color: var(--muted); }

.order-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; min-height: 36px; margin-top: 16px; }
.chip {
    padding: 6px 10px;
    border-radius: 999px;
    background: #10100e;
    border: 1px solid var(--line);
}
.output-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.group-label { display: block; margin: 12px 0 6px; color: var(--muted); font-size: 0.86rem; }
.empty { color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 18px; }
.stat { padding: 14px 12px; border-radius: 14px; background: #10100e; border: 1px solid var(--line); }
.stat b { display: block; font-size: 1.35rem; }
.stat span { color: var(--muted); font-size: 0.82rem; }

.table-wrap { margin-top: 16px; overflow: auto; border-radius: 14px; background: #10100e; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: start; white-space: nowrap; }
th { color: var(--muted); font-size: 0.82rem; font-weight: 700; }
tr.is-matched td:first-child { box-shadow: inset -3px 0 0 var(--lime); }
tr.is-duplicate td:first-child { box-shadow: inset -3px 0 0 #ffb020; }
tr.is-only_a td:first-child, tr.is-only_b td:first-child { box-shadow: inset -3px 0 0 var(--magenta); }

.export-meta { display: grid; gap: 12px; margin: 18px auto 0; max-width: 460px; }
.export-meta div { display: flex; justify-content: space-between; gap: 16px; padding: 14px 16px; border-radius: 14px; background: #10100e; border: 1px solid var(--line); }
.export-meta dt { color: var(--muted); }
.export-meta dd { margin: 0; font-weight: 700; }
.status-ready { color: var(--lime); }

.sync-foot {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: auto;
    padding: 18px 0 36px;
    color: var(--muted);
    border-top: 1px solid var(--line);
    font-size: 0.82rem;
    letter-spacing: 0.06em;
}

@media (max-width: 860px) {
    .sync-name, main, .sync-foot { width: min(1080px, calc(100% - 28px)); }
    .sync-page .stage,
    .output-layout { grid-template-columns: 1fr; }
    .stats { grid-template-columns: 1fr 1fr; }
    .sync-page .stage { gap: 16px; }
    .sync-orb { justify-self: center; margin: 2px 0; }
    .file-card { padding: 22px 16px 18px; }
    .pair-row,
    .switch-grid, .option-grid, .option-grid-3 { grid-template-columns: 1fr; }
    .out-row {
        grid-template-columns: 32px minmax(0, 1fr) 32px 32px 32px;
        gap: 6px;
    }
    .out-row .samples { display: none; }
    .icon-btn { width: 32px; height: 32px; }
    .icon-btn svg { width: 18px; height: 18px; }
    .add-row { flex-wrap: nowrap; justify-content: space-between; gap: 8px; }
    .add-row .text-btn { font-size: 0.78rem; white-space: nowrap; }
    .sync-foot { justify-content: center; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
