/* =============================================================================
   sync.css — the shared design system for every Smartsheet tool page
   (find & replace, clean, merge, dedupe, lookup, rename, backup, uploads,
   sharing audit, sync-to-excel, dropdown sync, admin user report).

   Themed from tokens.css. Every component below reads --accent-*, so a single
   `data-accent="violet"` on .lk-wrap re-hues the whole page — that is how each
   tool gets its own identity without a per-tool stylesheet.

   Accessibility notes worth keeping:
     · Inputs use --line-strong (4.1:1). The previous #d7dbe2 border was
       1.39:1 and failed WCAG 1.4.11 on every one of these pages.
     · Icon chips are a saturated fill with a WHITE glyph. The old pale-tint
       chip put a vivid orange glyph on near-white (2.90:1, a fail); inverting
       it is both more vibrant and comfortably over 3:1.
     · Status is never carried by colour alone — each state has an icon or word.
   ========================================================================== */

/* =========================================
   Page frame
   ========================================= */
.lk-wrap {
    max-width: 940px;
    width: 100%;
    margin: 2.5rem auto 5rem;
    padding: 0 1rem;
    min-width: 0;   /* .main clips overflow; without this wide tools get cut off */
}

.lk-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-2);
    overflow: hidden;
    position: relative;
}
/* The tool's hue as a full-bleed rail across the top of its card. */
.lk-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 5px;
    background: linear-gradient(90deg, var(--accent-vivid), var(--accent-solid));
    z-index: 1;
}

/* =========================================
   Card header
   ========================================= */
.lk-head {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 26px 28px 22px;
    border-bottom: 1px solid var(--line);
    /* Whisper of the accent behind the header only — text sits on the pale end. */
    background: linear-gradient(180deg, var(--accent-tint), var(--surface));
}
.lk-head .lk-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--r-lg);
    background: linear-gradient(135deg, var(--accent-vivid), var(--accent-solid));
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    color: var(--shell-text-hi);
    box-shadow: 0 5px 14px rgba(20, 22, 28, 0.18);
}
.lk-head .lk-icon svg { width: 27px; height: 27px; }
.lk-head h1 { font-size: 1.55rem; margin: 0; }
.lk-head .lk-sub { font-size: 1rem; color: var(--ink-3); margin: 4px 0 0; max-width: 52ch; }

/* "Preview first — nothing's written until you confirm" reassurance chip. */
.lk-badge {
    margin-left: auto;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--emerald-text);
    background: var(--emerald-tint);
    border: 1px solid #A7E3CB;
    border-radius: var(--r-pill);
    padding: 7px 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 20ch;
    line-height: 1.35;
}
.lk-badge svg { width: 16px; height: 16px; flex: none; }

/* =========================================
   Stepper
   ========================================= */
.lk-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    align-items: center;
    padding: 14px 28px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink-3);
}
.lk-steps span { display: inline-flex; align-items: center; }
.lk-steps .num {
    width: 21px;
    height: 21px;
    border-radius: 50%;
    background: var(--surface);
    color: var(--ink-3);
    box-shadow: inset 0 0 0 1.5px var(--line-strong);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    margin-right: 7px;
    flex: none;
}
.lk-steps .sep { color: var(--ink-3); margin: 0 2px; }
/* Progress states. The done step swaps its digit for a tick, so progress is
   legible without relying on the colour change. */
.lk-steps span.current .num { background: var(--accent-solid); color: var(--shell-text-hi); box-shadow: none; }
.lk-steps span.current { color: var(--ink); }
.lk-steps span.done .num { background: var(--emerald-solid); color: var(--shell-text-hi); box-shadow: none; font-size: 0; }
.lk-steps span.done .num::after { content: "\2713"; font-size: 0.8rem; }

/* =========================================
   Body
   ========================================= */
.lk-body { padding: 26px 28px 28px; }

.lk-flow { display: flex; align-items: stretch; gap: 14px; }
.lk-panel {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 17px;
    background: var(--surface);
}
.lk-panel-label {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.lk-panel-label svg { width: 15px; height: 15px; }
/* Source/target keep fixed hues (green in, orange out) regardless of the page
   accent — that pairing is the mental model of every one of these tools. */
.lk-source { border-left: 4px solid var(--emerald-solid); }
.lk-target { border-left: 4px solid var(--brand-solid); }
.lk-source .lk-panel-label { color: var(--emerald-text); }
.lk-target .lk-panel-label { color: var(--brand-text); }
.lk-arrow { display: flex; align-items: center; color: var(--accent-solid); flex: none; }
.lk-arrow svg { width: 26px; height: 26px; }

/* =========================================
   Form controls
   ========================================= */
.form-group { margin-bottom: 1.5rem; text-align: left; }
.form-label {
    display: block;
    color: var(--ink);
    font-size: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}
.form-control, .form-select {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1.5px solid var(--line-strong);
    border-radius: var(--r-sm);
    font-size: 1rem;
    background-color: var(--surface);
    color: var(--ink-2);
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.form-select {
    padding-right: 2.3rem;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235A6472' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
}
.form-control:hover, .form-select:hover { border-color: var(--ink-3); }
.form-control:focus, .form-select:focus {
    border-color: var(--accent-solid);
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-tint), 0 0 0 4.5px var(--accent-solid);
}
.form-text { font-size: 0.94rem; color: var(--ink-3); margin-top: 0.4rem; }
.form-control::placeholder { color: var(--ink-3); opacity: 1; }
.form-check-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--ink-2);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.lk-field { border: none; padding: 0; margin: 24px 0 26px; }
.lk-field legend {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink);
    padding: 0;
    margin-bottom: 11px;
    display: flex;
    align-items: center;
    gap: 9px;
}
.lk-legend-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-solid);
    color: var(--shell-text-hi);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 800;
    flex: none;
}

.lk-note { font-size: 0.95rem; color: var(--ink-2); line-height: 1.55; margin: 12px 0 0; }
.lk-fieldlabel { display: block; font-size: 1rem; font-weight: 600; color: var(--ink-2); }

/* Scrollable pick-lists (sheets, columns) shared across the tools. */
.lk-picklist {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 1rem;
    background: var(--surface-2);
}

/* (i) tooltip ------------------------------------------------------------ */
.lk-info { position: relative; display: inline-flex; align-items: center; color: var(--ink-3); cursor: help; }
.lk-info:hover, .lk-info:focus-visible { color: var(--accent-text); }
.lk-info svg { width: 16px; height: 16px; }
.lk-tip {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 260px;
    background: var(--ink);
    color: var(--shell-text-hi);
    font-size: 0.84rem;
    font-weight: 500;
    line-height: 1.45;
    padding: 9px 11px;
    border-radius: var(--r-sm);
    box-shadow: var(--shadow-2);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.12s var(--ease);
    z-index: 5;
}
.lk-tip::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom-color: var(--ink);
}
.lk-info:hover .lk-tip, .lk-info:focus .lk-tip, .lk-info:focus-within .lk-tip { opacity: 1; visibility: visible; }

/* Mapping rows ----------------------------------------------------------- */
.lk-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.lk-row .form-select { flex: 1; min-width: 170px; }
.lk-eq { font-size: 1.05rem; color: var(--ink-3); font-weight: 700; padding-bottom: 10px; }

.lk-keycol { flex: 1; min-width: 170px; display: flex; flex-direction: column; gap: 5px; }
.lk-keycol .form-select { width: 100%; min-width: 0; }

/* align-items: flex-end keeps the arrow and the remove button on the input's
   baseline now that each select carries a stacked label above it. */
.map-row { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 10px; }
.map-row .lk-keycol { margin-bottom: 0; }
.lk-map-arrow { color: var(--accent-solid); flex: none; display: inline-flex; padding-bottom: 10px; }
.lk-map-arrow svg { width: 18px; height: 18px; }
.map-remove {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--bad-text);
    width: 38px;
    height: 38px;
    flex: none;
    border-radius: var(--r-sm);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}
.map-remove:hover { background: var(--bad-bg); border-color: var(--bad-line); }

.lk-add {
    border: 1.5px dashed var(--accent-solid);
    background: var(--accent-tint);
    color: var(--accent-text);
    font-weight: 700;
    font-size: 0.92rem;
    border-radius: var(--r-sm);
    padding: 10px 15px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 2px;
}
.lk-add:hover { background: var(--surface); }
.lk-add svg { width: 15px; height: 15px; }

/* Hints ------------------------------------------------------------------ */
.lk-hint { font-size: 1rem; font-weight: 600; color: var(--ink); margin-top: 0.6rem; min-height: 1.4em; }
.lk-subhint { font-size: 0.95rem; color: var(--ink-3); margin-top: 0.25rem; }
.lk-muted { color: var(--ink-3); font-style: italic; }

.lk-check {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    color: var(--ink-2);
    cursor: pointer;
    margin-top: 18px;
}
.lk-check input { width: 18px; height: 18px; accent-color: var(--accent-solid); flex: none; }
.lk-check input[type="checkbox"]:indeterminate { accent-color: var(--ink-3); }
.lk-check:focus-within { outline: 2px solid var(--accent-solid); outline-offset: 3px; border-radius: var(--r-sm); }

/* Live "here's what will happen" summary. */
.lk-summary {
    margin-top: 18px;
    background: var(--accent-tint);
    border: 1px solid currentColor;
    border-radius: var(--r-md);
    padding: 15px 17px;
    font-size: 0.97rem;
    color: var(--accent-text);
    line-height: 1.55;
}
.lk-summary[hidden] { display: none; }
.lk-summary svg { width: 17px; height: 17px; vertical-align: -3px; margin-right: 7px; }

/* =========================================
   Buttons
   ========================================= */
.lk-cta, .btn-sync {
    margin-top: 20px;
    width: 100%;
    border: none;
    background: linear-gradient(135deg, var(--accent-solid) 0%, var(--brand-deep) 100%);
    color: var(--shell-text-hi);
    font-weight: 700;
    font-size: 1.02rem;
    border-radius: var(--r-md);
    padding: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    box-shadow: 0 6px 18px rgba(20, 22, 28, 0.18);
    transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), filter 0.15s var(--ease);
}
/* Accent-hued CTAs drop the gradient; only the orange default mixes into
   --brand-deep, which would otherwise muddy e.g. a violet button.
   :not(:disabled) is load-bearing — without it this rule (same specificity as
   .lk-cta:disabled but later in the file) repaints disabled buttons in the
   full accent colour, making them look enabled on every non-brand page. */
[data-accent]:not([data-accent="brand"]) .lk-cta:not(:disabled),
[data-accent]:not([data-accent="brand"]) .btn-sync:not(:disabled),
[data-accent]:not([data-accent="brand"]) .lk-continue:not(:disabled) {
    background: var(--accent-solid);
}
.lk-cta:hover, .btn-sync:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(20, 22, 28, 0.24);
    filter: saturate(1.15) brightness(0.94);
}
.lk-cta:disabled, .btn-sync:disabled {
    background: var(--line);
    color: var(--ink-3);
    box-shadow: none;
    transform: none;
    filter: none;
    cursor: not-allowed;
}
.lk-cta svg, .btn-sync svg { width: 18px; height: 18px; }

.btn-cancel {
    background: var(--surface);
    color: var(--ink-2);
    border: 1.5px solid var(--line-strong);
    box-shadow: none;
    flex: 1;
    filter: none;
}
.btn-cancel:hover { background: var(--surface-2); box-shadow: none; transform: none; filter: none; }
.btn-confirm { flex: 2; }
.btn-small { width: auto; padding: 0.6rem 1.2rem; font-size: 0.94rem; margin-top: 0; box-shadow: none; white-space: nowrap; }

.preview-actions { display: flex; gap: 0.75rem; margin-top: 1rem; flex-wrap: wrap; }
.preview-actions .lk-cta, .preview-actions .btn-sync { margin-top: 0; }

/* Remaining daily-quota hint above the Apply CTA. */
.lk-quota { margin-top: 16px; font-size: 0.95rem; font-weight: 600; color: var(--ink-3); text-align: center; }
.lk-quota.depleted { color: var(--bad-text); }
.lk-quota[hidden] { display: none; }

.lk-toolbar { display: flex; justify-content: flex-end; padding: 12px 28px 0; }
.lk-linkbtn {
    background: none;
    border: 1px solid transparent;
    color: var(--accent-text);
    font-weight: 700;
    font-size: 0.94rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 7px 10px;
    border-radius: var(--r-sm);
}
.lk-linkbtn:hover { background: var(--accent-tint); }

/* =========================================
   Results & feedback
   ========================================= */
.results-card {
    margin-top: 2rem;
    padding: 1.4rem 1.6rem;
    border-radius: var(--r-md);
    font-size: 1rem;
    display: none;
    border: 1px solid;
    transition: opacity 0.15s var(--ease);
}
/* Greys out a preview the moment its inputs change, so a stale preview can't
   be mistaken for the result of the current settings. */
.results-card.stale { opacity: 0.4; }
.lk-card .results-card { margin: 1.5rem 28px 28px; }
.results-card.success { background: var(--ok-bg);   color: var(--ok-text);   border-color: var(--ok-line); }
.results-card.warning { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-line); }
.results-card.error   { background: var(--bad-bg);  color: var(--bad-text);  border-color: var(--bad-line); }
.results-card h4 { margin: 0 0 1rem; font-weight: 800; color: inherit; }
.results-card ul { margin: 0; padding-left: 1.5rem; }
.error-list { color: var(--bad-text); font-size: 0.92rem; margin-top: 0.5rem; }

.warning-box {
    background: var(--warn-bg);
    color: var(--warn-text);
    border: 1px solid var(--warn-line);
    border-radius: var(--r-sm);
    padding: 0.8rem 1rem;
    margin-top: 0.75rem;
    font-size: 0.94rem;
}

/* Partial-write ("interrupted, safe to re-run") banner. */
.interrupted-note {
    margin-top: 10px;
    padding: 10px 12px;
    border-left: 4px solid var(--amber-solid);
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    background: var(--amber-tint);
    color: var(--amber-text);
    font-size: 0.94em;
}

/* Inline, per-step validation message (role="alert"). */
.lk-error {
    margin-top: 14px;
    background: var(--bad-bg);
    color: var(--bad-text);
    border: 1px solid var(--bad-line);
    border-radius: var(--r-sm);
    padding: 12px 14px;
    font-size: 0.95rem;
    font-weight: 600;
}
.lk-error[hidden] { display: none; }

/* =========================================
   Wizard
   =========================================
   All step sections live in the DOM at once. In wizard mode only .current
   shows; "Show all steps" (.lk-show-all) reveals them and swaps the per-step
   nav for a single submit. */
.lk-wizard .lk-step { display: none; }
.lk-wizard .lk-step.current { display: block; }
.lk-show-all .lk-step { display: block; }
.lk-show-all .lk-step + .lk-step { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 22px; }
.lk-show-all .lk-nav,
.lk-show-all .lk-step-count,
.lk-show-all #step4Title { display: none; }
.lk-step:focus { outline: none; }
.lk-step-count {
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--accent-text);
    margin: 0 0 8px;
}
.lk-step-title { font-size: 1.1rem; font-weight: 700; color: var(--ink); margin: 0 0 13px; }

/* Persistent "From / To / Match using / Copy" recap. */
.lk-context {
    margin: 12px 28px 0;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 13px 16px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 5px 14px;
    font-size: 0.95rem;
    line-height: 1.45;
}
.lk-context[hidden] { display: none; }
.lk-context-row { display: contents; }
.lk-context-k { color: var(--ink-3); font-weight: 700; white-space: nowrap; }
.lk-context-v { color: var(--ink); }

.lk-nav { display: flex; gap: 10px; margin-top: 22px; }
.lk-continue {
    flex: 1;
    border: none;
    background: linear-gradient(135deg, var(--accent-solid) 0%, var(--brand-deep) 100%);
    color: var(--shell-text-hi);
    font-weight: 700;
    font-size: 1rem;
    border-radius: var(--r-md);
    padding: 13px 18px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(20, 22, 28, 0.16);
    transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.lk-continue:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(20, 22, 28, 0.22); }
.lk-back {
    border: 1.5px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink-2);
    font-weight: 700;
    font-size: 1rem;
    border-radius: var(--r-md);
    padding: 13px 22px;
    cursor: pointer;
}
.lk-back:hover { background: var(--surface-2); }

/* =========================================
   Mobile
   ========================================= */
@media (max-width: 700px) {
    .lk-wrap { margin: 1.25rem auto 3.5rem; padding: 0 0.5rem; }
    .lk-card { border-radius: var(--r-lg); }
    .lk-head { flex-wrap: wrap; padding: 20px 18px 18px; gap: 13px; }
    .lk-head h1 { font-size: 1.3rem; }
    .lk-badge { margin-left: 0; max-width: none; }
    .lk-steps, .lk-body { padding-left: 18px; padding-right: 18px; }
    .lk-card .results-card, .lk-context { margin-left: 18px; margin-right: 18px; }
    .lk-toolbar { padding-left: 18px; padding-right: 18px; }

    .lk-flow { flex-direction: column; }
    .lk-arrow { transform: rotate(90deg); justify-content: center; }
    /* Let the labelled map selects shrink side-by-side so the row (two selects
       + arrow + remove) fits a phone instead of overflowing off-screen. */
    .map-row .lk-keycol { min-width: 0; }
    .lk-nav { flex-direction: column-reverse; }
}

/* "Get a support snapshot" — offered under any failure or interrupted result.
   Deliberately quiet: it is the next step for someone stuck, not a call to
   action for everyone. */
.support-snapshot-offer { margin-top: 6px; font-size: .88rem; }
.support-snapshot-link { font-weight: 600; text-decoration: underline; }
