/*
 * Admin redesign styles. Plain CSS, no build step: deploy never runs Vite, so `php artisan filament:assets`
 * publishes this file to public/css/app/admin-redesign.css and that copy is committed.
 * One section per piece of the redesign; a section only touches its own selectors.
 */

/* ==========================================================================
   No scroll bars anywhere in the admin panel (the page that renders .khx-brand). Every area still scrolls with the
   wheel, trackpad, touch and keyboard; only the bar is hidden.
   ========================================================================== */

html:has(.khx-brand),
html:has(.khx-brand) * {
    scrollbar-width: none;
}

html:has(.khx-brand)::-webkit-scrollbar,
html:has(.khx-brand) *::-webkit-scrollbar {
    display: none;
}

/* ==========================================================================
   Sidebar (YON-164): collapsible 72px rail, 256px expanded, always dark.
   Scoped to the sidebar that renders .khx-brand (the admin panel), so other panels keep Filament's look.
   Open state is Filament's own `.fi-sidebar-open` on the <aside>; the collapsed rail is its absence.
   ========================================================================== */

.fi-main-sidebar:has(.khx-brand) {
    --khx-bg: #111113;
    --khx-line: #27272a;
    --khx-muted: #a1a1aa;
    --khx-text: #fafafa;

    box-sizing: border-box;
    padding: 14px 12px;
    background: var(--khx-bg);
    border-inline-end: 1px solid var(--khx-line);
    font-family: Inter, system-ui, -apple-system, sans-serif;
    color: var(--khx-text);

    .fi-sidebar-header {
        display: none;
    }

    .fi-sidebar-nav {
        padding: 0;
        gap: 0;
        scrollbar-gutter: auto !important;
        scrollbar-width: none;

        &::-webkit-scrollbar {
            display: none;
        }
    }

    .fi-sidebar-nav-groups {
        margin: 0;
        gap: 0;
        padding: 4px 0;
    }

    /* Brand row: mark, name and the collapse button, pinned to the top of the nav. */
    .khx-brand {
        position: sticky;
        top: 0;
        z-index: 1;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 2px 6px 12px;
        background: var(--khx-bg);
        border-bottom: 1px solid var(--khx-line);
    }

    .khx-brand-link {
        display: flex;
        align-items: center;
        gap: 10px;
        min-width: 0;
        border-radius: 10px;
        text-decoration: none;
    }

    /* The wordmark while open, the mark on the collapsed rail. Both are transparent PNGs drawn for a dark ground. */
    .khx-brand-wordmark {
        display: block;
        width: auto;
        height: 30px;
    }

    .khx-brand-mark {
        display: none;
        width: 40px;
        height: auto;
    }

    .khx-toggle {
        flex: none;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        margin-inline-start: auto;
        padding: 0;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: var(--khx-muted);
        cursor: pointer;

        &:hover {
            background: #1f1f23;
            color: var(--khx-text);
        }
    }

    .khx-brand-link:focus-visible,
    .khx-toggle:focus-visible,
    .fi-sidebar-item-button:focus-visible {
        outline: 2px solid #93c5fd;
        outline-offset: 2px;
    }

    /* Groups: a heading when open, a divider on the rail. */
    .fi-sidebar-group {
        gap: 0;
    }

    .fi-sidebar-group-button {
        padding: 14px 10px 4px;
    }

    .fi-sidebar-group-label {
        font-size: 11px;
        font-weight: 600;
        line-height: 1.5;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: var(--khx-muted);
    }

    .fi-sidebar-group-items {
        gap: 2px;
    }

    /* Items: 44px rows, icon centred on the rail, left-aligned with a label when open. */
    .fi-sidebar-item-button {
        gap: 12px;
        height: 44px;
        padding: 0;
        justify-content: center;
        border-radius: 10px;
        background: transparent;
        color: var(--khx-muted);
        font-size: 14px;
        font-weight: 400;
        text-decoration: none;

        &:hover,
        &:focus-visible {
            background: #1f1f23;
            color: var(--khx-text);
        }
    }

    .fi-sidebar-item.fi-active > .fi-sidebar-item-button {
        background: #102a3e;
        color: #fff;
        font-weight: 600;
        box-shadow: inset 0 0 0 1px #1c7ec6;
    }

    .fi-sidebar-item-icon {
        flex: none;
        display: flex;
        width: 20px;
        height: 20px;
        color: inherit;

        > svg {
            width: 20px;
            height: 20px;
        }
    }

    .fi-sidebar-item-label {
        color: inherit;
        font-size: 14px;
        font-weight: inherit;
    }

    /* Count badges: a pill beside the label when open, a dot on the icon corner on the rail. */
    .fi-sidebar-item-button > span:has(> .fi-badge) {
        flex: none;
    }

    .fi-badge {
        min-height: 0;
        padding: 1px 7px;
        border-radius: 999px;
        background: #27272a;
        color: #d4d4d8;
        font-size: 11px;
        font-weight: 600;
        box-shadow: none;

        &.fi-color-warning {
            background: #7c2d12;
            color: #fed7aa;
        }
    }

    /* User block pinned below the nav. */
    .khx-user {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-top: 10px;
        padding: 14px 6px 4px;
        border-top: 1px solid var(--khx-line);
    }

    .khx-user-avatar {
        flex: none;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        border-radius: 999px;
        background: #1e3a5f;
        color: #bfdbfe;
        font-size: 12px;
        font-weight: 600;
    }

    .khx-user-text {
        display: flex;
        flex-direction: column;
        min-width: 0;
    }

    .khx-user-name {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 13px;
        font-weight: 600;
        color: var(--khx-text);
    }

    .khx-user-role {
        font-size: 12px;
        color: var(--khx-muted);
    }

    &:not(.fi-sidebar-open) {
        .khx-brand {
            flex-direction: column;
            gap: 8px;
        }

        .khx-brand-wordmark,
        .khx-user-text {
            display: none;
        }

        .khx-brand-mark {
            display: block;
        }

        .khx-toggle {
            margin-inline-start: 0;

            svg {
                transform: scaleX(-1);
            }
        }

        .fi-sidebar-group + .fi-sidebar-group::before {
            content: '';
            display: block;
            height: 1px;
            margin: 10px 12px;
            background: var(--khx-line);
        }

        .khx-user {
            padding-inline: 8px;
        }

        .fi-sidebar-item-button {
            position: relative;
        }

        .fi-sidebar-item-button > span:has(> .fi-badge) {
            position: absolute;
            top: 4px;
            inset-inline-end: 4px;
            display: block !important;
            opacity: 1 !important;
        }

        .fi-badge {
            box-sizing: border-box;
            min-width: 16px;
            height: 16px;
            padding: 0 4px;
            justify-content: center;
            background: #52525b;
            color: #fff;
            font-size: 10px;
            font-weight: 700;

            &.fi-color-warning {
                background: #ea580c;
                color: #fff;
            }
        }
    }

    &.fi-sidebar-open .fi-sidebar-item-button {
        justify-content: flex-start;
        padding: 0 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fi-main-sidebar:has(.khx-brand),
    .fi-main-sidebar:has(.khx-brand) * {
        transition: none !important;
    }
}

/* ---- Event analytics (YON-166) ---- */

.khx-ea,
.khx-ea-header {
    --ea-surface: #fff;
    --ea-inset: #fafafa;
    --ea-head: #f4f4f5;
    --ea-line: #e4e4e7;
    --ea-line-strong: #d4d4d8;
    --ea-text: #18181b;
    --ea-muted: #52525b;
    --ea-faint: #a1a1aa;
    --ea-hover: #f4f4f5;
    --ea-link: #1a6faf;
    --ea-accent: #1c7ec6;
    --ea-accent-bg: #e6f2fb;
    --ea-accent-text: #0c4a7a;
    --ea-chip-label: #1a6faf;
    --ea-seg-on: #e4e4e7;
    --ea-up: #047857;
    --ea-down: #c2410c;
    --ea-good: #059669;

    font-family: Inter, system-ui, -apple-system, sans-serif;
    color: var(--ea-text);
}

.dark .khx-ea,
.dark .khx-ea-header {
    --ea-surface: #18181b;
    --ea-inset: #09090b;
    --ea-head: #141417;
    --ea-line: #27272a;
    --ea-line-strong: #3f3f46;
    --ea-text: #fafafa;
    --ea-muted: #a1a1aa;
    --ea-faint: #71717a;
    --ea-hover: #1f1f23;
    --ea-link: #5ab0ec;
    --ea-accent-bg: #102a3e;
    --ea-accent-text: #e0f0fb;
    --ea-chip-label: #8cc8f2;
    --ea-seg-on: #27272a;
    --ea-up: #6ee7b7;
    --ea-down: #fdba74;
    --ea-good: #34d399;
}

.khx-ea {
    display: flex;
    flex-direction: column;
    gap: 20px;
    font-size: 14px;
    line-height: 1.45;
}

.khx-ea-noscroll {
    scrollbar-width: none;
    -ms-overflow-style: none;

    &::-webkit-scrollbar {
        display: none;
    }
}

.khx-ea-muted {
    color: var(--ea-muted);
}

.khx-ea .khx-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.khx-ea-strong {
    font-weight: 500;
}

.khx-ea-up {
    color: var(--ea-up);
    font-weight: 600;
}

.khx-ea-down {
    color: var(--ea-down);
}

/* Header: breadcrumb, title and the page's actions. */

.khx-ea-header {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    justify-content: space-between;
}

.khx-ea-heading {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.khx-ea-crumbs {
    display: flex;
    gap: 8px;
    font-size: 13px;
    color: var(--ea-muted);

    a {
        color: inherit;
        text-decoration: none;

        &:hover {
            color: var(--ea-text);
        }
    }
}

.khx-ea-title {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.khx-ea-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.khx-ea-switch {
    height: 28px;
    padding: 0 28px 0 8px;
    border-radius: 6px;
    border: 1px solid var(--ea-line-strong);
    background-color: var(--ea-surface);
    color: var(--ea-text);
    font-size: 13px;
    cursor: pointer;
}

.khx-ea-switch-inactive {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--ea-muted);
    cursor: pointer;
}

.khx-ea-crumbs {
    align-items: center;
}

.khx-ea-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid var(--ea-line-strong);
    background: var(--ea-surface);
    color: var(--ea-text);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;

    &:hover {
        background: var(--ea-hover);
    }

    &:focus-visible {
        outline: 2px solid var(--ea-accent);
        outline-offset: 2px;
    }
}

/* Tab strip. */

.khx-ea-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--ea-line);
    overflow-x: auto;
}

.khx-ea-tab {
    flex: none;
    padding: 10px 14px;
    margin-bottom: -1px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--ea-muted);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;

    &:hover {
        color: var(--ea-text);
    }

    &[aria-current='page'] {
        color: var(--ea-text);
        font-weight: 600;
        border-bottom-color: var(--ea-accent);
    }

    &:focus-visible {
        outline: 2px solid var(--ea-accent);
        outline-offset: -2px;
    }
}

/* Pinned filter bar. Sits under the panel's 4rem top bar. */

.khx-ea-filters {
    position: sticky;
    top: 4.5rem;
    z-index: 15;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--ea-line);
    border-radius: 12px;
    background: var(--ea-surface);
}

.khx-ea-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.khx-ea-dates {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid var(--ea-line-strong);
    background: var(--ea-inset);
    color: var(--ea-muted);

    input {
        width: 120px;
        height: 100%;
        padding: 0;
        border: 0;
        background: transparent;
        color: var(--ea-text);
        font-size: 14px;
        font-family: inherit;
        outline: none;
        box-shadow: none;
        color-scheme: light;
    }

    input:focus {
        box-shadow: none;
    }

    &:focus-within {
        border-color: var(--ea-accent);
    }
}

.dark .khx-ea-dates input {
    color-scheme: dark;
}

.khx-ea-seg {
    display: flex;
    padding: 3px;
    border-radius: 8px;
    border: 1px solid var(--ea-line-strong);
    background: var(--ea-inset);

    button {
        height: 32px;
        padding: 0 12px;
        border-radius: 6px;
        border: 0;
        background: transparent;
        color: var(--ea-muted);
        font-size: 13px;
        font-weight: 500;
        font-family: inherit;
        cursor: pointer;
    }

    button[aria-pressed='true'] {
        background: var(--ea-seg-on);
        color: var(--ea-text);
    }

    button:focus-visible {
        outline: 2px solid var(--ea-accent);
        outline-offset: 1px;
    }
}

.khx-ea-divider {
    width: 1px;
    height: 28px;
    background: var(--ea-line-strong);
}

.khx-ea-dd {
    flex: 1 1 200px;
    max-width: 260px;
}

/* The shared dropdown ships dark; follow the panel's theme inside this page. */
.khx-ea .adm-dd {
    color: var(--ea-text);
}

.khx-ea .adm-dd-trigger {
    background: var(--ea-inset);
    border-color: var(--ea-line-strong);
    color: var(--ea-text);

    &.is-active {
        background: var(--ea-accent-bg);
        border-color: var(--ea-accent);
    }
}

.khx-ea .adm-dd-inline-label {
    color: var(--ea-muted);
}

.khx-ea .adm-dd-inline .adm-dd-value {
    color: var(--ea-text);
}

.khx-ea .adm-dd-menu {
    background: var(--ea-surface);
    border-color: var(--ea-line-strong);
}

.khx-ea .adm-dd-search {
    border-bottom-color: var(--ea-line);
}

.khx-ea .adm-dd-search input,
.khx-ea .adm-dd-option {
    color: var(--ea-text);
}

.khx-ea .adm-dd-option.is-hot {
    background: var(--ea-hover);
}

.khx-ea .adm-dd-option.is-selected {
    background: var(--ea-accent-bg);
}

.khx-ea .adm-dd-footer {
    border-top-color: var(--ea-line);
}

.khx-ea .adm-dd-active-count {
    color: var(--ea-chip-label);
}

/* Active filters as removable chips. */

.khx-ea-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--ea-line);
    font-size: 13px;
}

.khx-ea-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 4px 0 10px;
    border-radius: 999px;
    border: 1px solid var(--ea-accent);
    background: var(--ea-accent-bg);
    color: var(--ea-accent-text);

    button {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 24px;
        height: 24px;
        border-radius: 999px;
        border: 0;
        background: transparent;
        color: inherit;
        cursor: pointer;
    }

    button:hover {
        background: rgba(127, 127, 127, 0.2);
    }

    button:focus-visible {
        outline: 2px solid var(--ea-accent);
    }
}

.khx-ea-chip-label {
    color: var(--ea-chip-label);
}

.khx-ea-chip-value {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.khx-ea-clear {
    height: 30px;
    padding: 0 10px;
    border: 0;
    background: transparent;
    color: var(--ea-link);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
}

.khx-ea-summary {
    margin-left: auto;
    color: var(--ea-muted);
}

/* Cards, stat cards and their line graphs. */

.khx-ea-card {
    border: 1px solid var(--ea-line);
    border-radius: 12px;
    background: var(--ea-surface);
    color: var(--ea-text);
}

.khx-ea-pad {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 18px 20px;
}

.khx-ea-card-head {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
    align-items: baseline;

    h2 {
        margin: 0;
        font-size: 16px;
        font-weight: 600;
    }

    span {
        font-size: 13px;
    }
}

.khx-ea-pad-head {
    padding: 18px 20px 12px;
}

.khx-ea-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
    gap: 12px;
}

.khx-ea.is-stacked .khx-ea-kpis {
    grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
}

.khx-ea-kpi {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 18px;
}

.khx-ea-kpi-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--ea-muted);
}

.khx-ea-kpi-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.khx-ea-kpi-sub {
    font-size: 12px;
}

.khx-ea-spark {
    width: 100%;
    height: 56px;
    margin-top: 6px;
    overflow: visible;
}

.khx-ea-spark-area {
    fill: var(--ea-accent);
    fill-opacity: 0.16;
    stroke: none;
}

.khx-ea-spark-line {
    fill: none;
    stroke: var(--ea-link);
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.khx-ea-spark-dot {
    fill: var(--ea-link);
    stroke: var(--ea-surface);
    stroke-width: 2;
}

.khx-ea-kpi-foot {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
}

/* Registration funnel bars. */

.khx-ea-funnel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr));
    gap: 12px;
}

.khx-ea-step {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.khx-ea-step-top,
.khx-ea-step-bottom {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
}

.khx-ea-step-bottom {
    align-items: flex-end;
    font-size: 12px;
}

.khx-ea-step-label {
    font-weight: 500;
}

.khx-ea-track {
    display: flex;
    height: 40px;
    border-radius: 8px;
    background: var(--ea-inset);
    overflow: hidden;
}

.khx-ea-fill {
    background: var(--ea-accent);
    border-radius: 8px;
}

.khx-ea-step-count {
    font-size: 18px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.khx-ea-details {
    border-top: 1px solid var(--ea-line);
    padding-top: 12px;

    summary {
        cursor: pointer;
        font-size: 13px;
        font-weight: 500;
        color: var(--ea-link);
    }
}

.khx-ea-details-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.khx-ea-device {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 240px;
    font-size: 13px;
}

.khx-ea-note {
    margin: 0;
    font-size: 12px;
}

.khx-ea-subhead {
    margin: 4px 0 0;
    font-size: 13px;
    font-weight: 600;
}

/* Source table. The wide columns need room, so the expanded sidebar stacks them. */

.khx-ea-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
    font-size: 14px;

    th,
    td {
        padding: 12px;
        text-align: left;
        vertical-align: top;
    }

    thead tr {
        border-top: 1px solid var(--ea-line);
        border-bottom: 1px solid var(--ea-line);
        background: var(--ea-head);
    }

    thead th {
        padding-block: 10px;
        font-size: 12px;
        font-weight: 600;
        color: var(--ea-muted);
    }

    tbody tr {
        border-bottom: 1px solid var(--ea-line);
    }

    tfoot tr {
        background: var(--ea-head);
        font-weight: 600;
    }

    .khx-ea-first {
        padding-inline-start: 20px;
    }

    .khx-ea-num {
        text-align: right;
        font-variant-numeric: tabular-nums;
    }

    thead .khx-ea-num {
        padding: 0 12px;
    }

    .khx-ea-act {
        width: 56px;
        padding: 6px 12px 6px 0;
        text-align: right;
    }
}

.khx-ea-row:hover {
    background: var(--ea-hover);
}

.khx-ea-clip {
    max-width: 260px;
}

.khx-ea-sort {
    height: 40px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--ea-muted);
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    white-space: nowrap;
    cursor: pointer;

    &:hover,
    &.is-on {
        color: var(--ea-text);
    }

    &:focus-visible {
        outline: 2px solid var(--ea-accent);
    }
}

.khx-ea-source {
    display: flex;
    align-items: center;
    gap: 8px;
}

.khx-ea-dot {
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 999px;
}

.khx-ea-indent {
    padding-inline-start: 16px;
    font-size: 12px;
}

.khx-ea-mono {
    font-size: 12px;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.khx-ea-conv {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;

    span {
        min-width: 48px;
    }
}

.khx-ea-bar {
    width: 64px;
    height: 6px;
    border-radius: 999px;
    background: var(--ea-line);
    overflow: hidden;

    div {
        height: 100%;
    }
}

.khx-ea-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-inline-start: auto;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--ea-muted);
    cursor: pointer;

    &:hover {
        background: var(--ea-hover);
        color: var(--ea-text);
    }

    &:focus-visible {
        outline: 2px solid var(--ea-accent);
    }
}

.khx-ea-empty {
    padding: 24px 20px;
}

.khx-ea-stack {
    display: none;
}

.khx-ea.is-stacked .khx-ea-stack {
    display: table-cell;
}

.khx-ea.is-stacked .khx-ea-wide {
    display: none;
}

/* Follow-up cards that open the follow-up lists. */

.khx-ea-followups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
    gap: 12px;
}

.khx-ea-follow {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    text-align: left;
    font-family: inherit;
    cursor: pointer;

    &:hover {
        background: var(--ea-hover);
    }

    &:focus-visible {
        outline: 2px solid var(--ea-accent);
        outline-offset: 2px;
    }
}

.khx-ea-follow-text {
    display: flex;
    flex-direction: column;
    gap: 4px;

    .khx-ea-strong {
        font-size: 15px;
        font-weight: 600;
    }

    .khx-ea-muted {
        font-size: 13px;
    }
}

.khx-ea-follow-go {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ea-link);
    font-weight: 500;
    white-space: nowrap;
}

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

/* ---- Event analytics: Heatmap (YON-168) ---- */

.khx-hm {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.khx-hm-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 12px 16px;
}

.khx-hm-page {
    width: 240px;
    max-width: 100%;
}

.khx-hm-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-start;
}

.khx-hm-map {
    flex: 999 1 560px;
    min-width: 0;
}

.khx-hm-side {
    flex: 1 1 320px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.khx-hm-stage {
    padding: 16px;
    border-radius: 10px;
    background: var(--ea-inset);
}

.khx-hm-box {
    width: 100%;
    display: flex;
    justify-content: center;
}

.khx-hm-scroller {
    overflow-x: hidden;
    overflow-y: auto;
    border-radius: 12px;
    background: #fafafa;
    box-shadow: 0 0 0 1px var(--ea-line-strong);
}

.khx-hm-sticky {
    position: sticky;
    top: 0;
    overflow: hidden;
}

.khx-hm-page-frame {
    position: relative;
    overflow: hidden;
    transform-origin: top left;

    iframe {
        position: absolute;
        top: 0;
        left: 0;
        border: 0;
        pointer-events: none;
        background: #fff;
    }

    canvas,
    .khx-hm-bands {
        position: absolute;
        top: 0;
        left: 0;
        pointer-events: none;
    }
}

.khx-hm-band {
    position: absolute;
    left: 0;
    right: 0;
    box-sizing: border-box;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 6px 8px;
    border-top: 1px dashed rgba(28, 126, 198, 0.8);

    span {
        padding: 2px 8px;
        border-radius: 999px;
        background: rgba(9, 9, 11, 0.85);
        color: #fafafa;
        font-weight: 700;
        white-space: nowrap;
    }
}

.khx-hm-hint {
    margin: 8px 0 0;
    font-size: 12px;
    text-align: center;
}

.khx-hm-legend {
    font-size: 12px;
}

.khx-hm-legend-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.khx-hm-ramp {
    width: 140px;
    height: 8px;
    border-radius: 999px;
}

.khx-hm-ramp-clicks {
    background: linear-gradient(90deg, rgba(250, 204, 21, 0.4), #f97316, #ef4444);
}

.khx-hm-ramp-scroll {
    background: linear-gradient(90deg, #fafafa, #09090b);
    box-shadow: 0 0 0 1px var(--ea-line-strong);
}

.khx-hm-title {
    display: flex;
    flex-direction: column;
    gap: 2px;

    h2 {
        margin: 0;
        font-size: 16px;
        font-weight: 600;
    }

    span {
        font-size: 13px;
    }
}

.khx-hm-depth {
    display: flex;
    align-items: center;
    gap: 10px;

    .khx-ea-track {
        flex: 1;
        height: 10px;
        border-radius: 999px;
    }

    .khx-ea-fill {
        border-radius: 999px;
    }
}

.khx-hm-depth-at {
    width: 44px;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.khx-hm-depth-share {
    width: 52px;
    text-align: right;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.khx-hm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;

    th,
    td {
        padding: 10px;
        text-align: left;
        vertical-align: top;
    }

    thead tr {
        border-top: 1px solid var(--ea-line);
        border-bottom: 1px solid var(--ea-line);
        background: var(--ea-head);
    }

    thead th {
        padding-block: 8px;
        font-size: 12px;
        font-weight: 600;
        color: var(--ea-muted);
    }

    tbody tr {
        border-bottom: 1px solid var(--ea-line);
    }

    tbody tr:hover {
        background: var(--ea-hover);
    }

    .khx-hm-num {
        text-align: right;
        font-variant-numeric: tabular-nums;
    }

    .khx-hm-first {
        padding-inline-start: 20px;
    }

    .khx-hm-last {
        padding-inline-end: 20px;
    }
}

.khx-hm-sections {
    font-size: 13px;

    .khx-hm-first,
    td:first-child,
    th:first-child {
        padding-inline-start: 0;
    }
}

.khx-hm-el {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.khx-hm-sub {
    font-size: 12px;
}

.khx-hm-rage {
    color: var(--ea-muted);

    &.is-alert {
        color: #b91c1c;
        font-weight: 700;
    }
}

.dark .khx-hm-rage.is-alert {
    color: #fca5a5;
}

/* ---- Event analytics: Videos (YON-167) ---- */

.khx-ea-vcards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
    gap: 12px;
}

.khx-ea-vcard {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 14px 16px;
    text-align: left;
    font: inherit;
    cursor: pointer;

    &:hover {
        border-color: var(--ea-faint);
    }

    &:focus-visible {
        outline: 2px solid var(--ea-accent);
        outline-offset: 2px;
    }

    &[aria-pressed='true'] {
        background: var(--ea-accent-bg);
        border-color: var(--ea-accent);
    }
}

.khx-ea-vcard-top {
    display: flex;
    gap: 12px;
    align-items: center;
}

.khx-ea-vthumb {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 44px;
    border-radius: 6px;
    background: var(--ea-line);
    color: var(--ea-muted);
}

.khx-ea-vcard-name {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.khx-ea-vcard-title {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.khx-ea-vcard-meta,
.khx-ea-vstat .khx-ea-muted {
    font-size: 12px;
}

.khx-ea-vstats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.khx-ea-vstat {
    display: flex;
    flex-direction: column;
}

.khx-ea-vstat-value {
    font-size: 18px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.khx-ea-vrow {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: stretch;
}

.khx-ea-vchart {
    flex: 999 1 560px;
    min-width: 0;
}

.khx-ea-vdrops {
    flex: 1 1 300px;
    min-width: 0;
}

.khx-ea.is-stacked .khx-ea-vchart {
    flex-basis: 440px;
}

.khx-ea-vplot {
    display: block;
    width: 100%;
    height: 240px;
}

.khx-ea-vgrid {
    stroke: var(--ea-line);
    stroke-width: 1;
}

.khx-ea-vdrop {
    stroke: var(--ea-down);
    stroke-width: 1.5;
    stroke-dasharray: 4 4;
}

.khx-ea-vaxis {
    display: flex;
    justify-content: space-between;
    padding-top: 6px;
    font-size: 12px;
}

.khx-ea-vlegend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 12px;

    span {
        display: flex;
        align-items: center;
        gap: 6px;
    }
}

.khx-ea-vkey-line {
    width: 14px;
    height: 3px;
    background: var(--ea-link);
}

.khx-ea-vkey-dash {
    width: 14px;
    border-top: 2px dashed var(--ea-down);
}

.khx-ea-vlist {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;

    li {
        display: flex;
        gap: 12px;
        align-items: center;
        padding: 10px 12px;
        border: 1px solid var(--ea-line);
        border-radius: 10px;
        background: var(--ea-inset);
    }
}

.khx-ea-vtime {
    flex: none;
    min-width: 52px;
    padding: 4px 8px;
    border-radius: 6px;
    background: color-mix(in srgb, var(--ea-down) 16%, transparent);
    color: var(--ea-down);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.khx-ea-vtable {
    min-width: 720px;

    td,
    th {
        vertical-align: middle;
    }

    .khx-ea-last {
        padding-inline-end: 20px;
    }
}

.khx-ea-vbar {
    display: flex;
    align-items: center;
    gap: 10px;

    span {
        min-width: 40px;
        font-variant-numeric: tabular-nums;
    }
}

.khx-ea-vbar-track {
    flex: 1;
    max-width: 180px;
    height: 6px;
    border-radius: 999px;
    background: var(--ea-line);
    overflow: hidden;

    .khx-ea-fill {
        height: 100%;
        border-radius: 0;
        background: var(--ea-link);
    }
}

/* ---- Event analytics: Follow-up (YON-169) ---- */

.khx-ea {
    --ea-badge-bg: #f4f4f5;
    --ea-badge-text: #3f3f46;
    --ea-amber-bg: #fef3c7;
    --ea-amber-text: #92400e;
    --ea-red-bg: #fee2e2;
    --ea-red-text: #b91c1c;
    --ea-primary: #1a6faf;
}

.dark .khx-ea {
    --ea-badge-bg: #27272a;
    --ea-badge-text: #d4d4d8;
    --ea-amber-bg: #3b2a10;
    --ea-amber-text: #fcd34d;
    --ea-red-bg: #3f1d1d;
    --ea-red-text: #fca5a5;
}

.khx-ea-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.khx-ea-fcards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr));
    gap: 12px;
}

.khx-ea-fcard {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    text-align: left;
    font: inherit;
    cursor: pointer;

    &:hover {
        border-color: var(--ea-faint);
    }

    &:focus-visible {
        outline: 2px solid var(--ea-accent);
        outline-offset: 2px;
    }

    &[aria-pressed='true'] {
        background: var(--ea-accent-bg);
        border-color: var(--ea-accent);
    }
}

.khx-ea-fcard-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;

    .khx-ea-strong {
        font-size: 15px;
        font-weight: 600;
    }

    .khx-ea-muted {
        font-size: 13px;
    }
}

.khx-ea-fcard-count {
    font-size: 26px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.khx-ea-ftable {
    display: flex;
    flex-direction: column;
}

.khx-ea-ftools {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 14px 16px 6px;

    h2 {
        margin: 0 8px 0 4px;
        font-size: 16px;
        font-weight: 600;
    }
}

.khx-ea-fgrow {
    flex: 1;
}

.khx-ea-fpicked {
    font-size: 13px;
    color: var(--ea-text);
}

.khx-ea-btn-primary {
    border-color: var(--ea-primary);
    background: var(--ea-primary);
    color: #fff;

    &:hover {
        background: var(--ea-primary);
        filter: brightness(1.1);
    }
}

.khx-ea-btn-sm {
    height: 36px;
    padding: 0 12px;
    font-size: 13px;
    white-space: nowrap;
}

.khx-ea-fabout {
    margin: 0;
    padding: 0 20px 12px;
    font-size: 13px;
}

.khx-ea-fscroll {
    overflow-x: auto;
}

.khx-ea-ftab {
    min-width: 860px;

    td,
    th {
        vertical-align: middle;
    }

    input[type='checkbox'] {
        width: 16px;
        height: 16px;
        accent-color: var(--ea-accent);
    }
}

.khx-ea-fcheck {
    width: 44px;
    padding-inline: 16px 0;
}

.khx-ea-fgo {
    width: 120px;
    padding: 8px 16px 8px 0;
    text-align: right;
}

.khx-ea-fclip {
    max-width: 260px;
}

.khx-ea-flink {
    color: var(--ea-link);
    font-variant-numeric: tabular-nums;
}

.khx-ea-ftg {
    margin-inline-start: 6px;
    font-size: 12px;
    color: var(--ea-muted);
}

.khx-ea-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.khx-ea-fsrc {
    display: none;
    font-size: 12px;
    color: var(--ea-muted);
}

/* Expanded sidebar: fold the source column under the person instead of scrolling sideways. */
.khx-ea.is-stacked .khx-ea-ftab {
    min-width: 640px;
}

.khx-ea.is-stacked .khx-ea-ffrom {
    display: none;
}

.khx-ea.is-stacked .khx-ea-fsrc {
    display: block;
}

.khx-ea-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--ea-badge-bg);
    color: var(--ea-badge-text);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;

    &.is-amber {
        background: var(--ea-amber-bg);
        color: var(--ea-amber-text);
    }

    &.is-red {
        background: var(--ea-red-bg);
        color: var(--ea-red-text);
    }
}

.khx-ea-ffoot {
    padding: 10px 20px;
    font-size: 13px;
}

.dark .khx-ea-ftab input[type='checkbox']:not(:checked) {
    background-color: var(--ea-inset);
    border-color: var(--ea-line-strong);
}

/* ---- Lead tags page (YON-172) ---- */

.khx-tags-header,
.khx-tags {
    --lt-surface: #fff;
    --lt-inset: #fafafa;
    --lt-line: #e4e4e7;
    --lt-text: #18181b;
    --lt-muted: #52525b;
    --lt-faint: #a1a1aa;
    --lt-hover: #f4f4f5;
    --lt-chip: #f4f4f5;
    --lt-chip-text: #27272a;
    --lt-link: #1a6faf;
    --lt-accent: #1c7ec6;
    --lt-hot: #fee2e2;
    --lt-hot-text: #b91c1c;
    --lt-warm: #ffedd5;
    --lt-warm-text: #c2410c;
    --lt-cold: #dbeafe;
    --lt-cold-text: #1d4ed8;

    font-family: Inter, system-ui, -apple-system, sans-serif;
}

.dark .khx-tags-header,
.dark .khx-tags {
    --lt-surface: #18181b;
    --lt-inset: #09090b;
    --lt-line: #27272a;
    --lt-text: #fafafa;
    --lt-muted: #a1a1aa;
    --lt-faint: #52525b;
    --lt-hover: #1f1f23;
    --lt-chip: #27272a;
    --lt-chip-text: #e4e4e7;
    --lt-link: #5ab0ec;
    --lt-hot: #3f1d1d;
    --lt-hot-text: #fca5a5;
    --lt-warm: #3b2a10;
    --lt-warm-text: #fdba74;
    --lt-cold: #102a3e;
    --lt-cold-text: #93c5fd;
}

.khx-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.khx-tags-header {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    justify-content: space-between;
    color: var(--lt-text);
}

.khx-tags-title {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.khx-tags-sub {
    margin: 4px 0 0;
    font-size: 14px;
    color: var(--lt-muted);
}

.khx-tags-search {
    flex: 0 1 300px;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid var(--lt-line);
    background: var(--lt-surface);
    color: var(--lt-muted);

    &:focus-within {
        border-color: var(--lt-accent);
    }

    input {
        flex: 1;
        min-width: 0;
        border: 0;
        outline: none;
        box-shadow: none;
        background: transparent;
        color: var(--lt-text);
        font-size: 14px;
        padding: 0;
    }
}

.khx-tags {
    color: var(--lt-text);
}

/* Columns, not a grid, so a short card never leaves a gap under it. */
.khx-tags-grid {
    column-gap: 16px;
    columns: 3 340px;

    &.khx-tags-grid--2 {
        columns: 2 360px;
    }
}

.khx-tags-card {
    break-inside: avoid;
    margin-bottom: 16px;
    border: 1px solid var(--lt-line);
    border-radius: 12px;
    background: var(--lt-surface);
    display: flex;
    flex-direction: column;
}

.khx-tags-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 12px 10px 16px;
    border-bottom: 1px solid var(--lt-line);
}

.khx-tags-card-title {
    display: flex;
    flex-direction: column;
    gap: 4px;

    > div {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    h2 {
        margin: 0;
        font-size: 16px;
        font-weight: 600;
    }

    p {
        margin: 0;
        font-size: 13px;
        color: var(--lt-muted);
    }
}

.khx-tags-total {
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--lt-chip);
    color: var(--lt-chip-text);
    font-size: 12px;
}

.khx-tags-btn {
    flex: none;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid var(--lt-line);
    background: var(--lt-inset);
    color: var(--lt-text);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;

    &:hover {
        background: var(--lt-hover);
    }

    &.khx-tags-btn--quiet {
        height: 40px;
        border: 0;
        background: transparent;
        color: var(--lt-muted);
        font-size: 14px;
    }
}

.khx-tags-save {
    height: 40px;
    padding: 0 14px;
    border: 0;
    border-radius: 8px;
    background: #1a6faf;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;

    &:hover {
        background: #1c7ec6;
    }
}

.khx-tags-list {
    list-style: none;
    margin: 0;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.khx-tag {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 6px;
    border-radius: 8px;

    &:hover {
        background: var(--lt-hover);
    }

    &.is-dragging {
        opacity: 0.4;
    }

    &:hover .khx-tag-actions,
    &:focus-within .khx-tag-actions {
        opacity: 1;
    }
}

.khx-tag-grip {
    display: flex;
    padding: 4px;
    border: 0;
    background: transparent;
    color: var(--lt-faint);
    cursor: grab;
    border-radius: 4px;

    &:active {
        cursor: grabbing;
    }

    &:focus-visible {
        outline: 2px solid var(--lt-accent);
    }
}

.khx-chip {
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--lt-chip);
    color: var(--lt-chip-text);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;

    &.khx-chip--hot {
        background: var(--lt-hot);
        color: var(--lt-hot-text);
    }

    &.khx-chip--warm {
        background: var(--lt-warm);
        color: var(--lt-warm-text);
    }

    &.khx-chip--cold {
        background: var(--lt-cold);
        color: var(--lt-cold-text);
    }
}

.khx-tag-count {
    margin-inline-start: auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;

    a {
        min-width: 44px;
        text-align: end;
        font-size: 13px;
        font-variant-numeric: tabular-nums;
        color: var(--lt-link);
        text-decoration: none;

        &:hover {
            text-decoration: underline;
        }
    }
}

.khx-tag-bar {
    flex: 0 1 72px;
    min-width: 24px;
    width: 72px;
    height: 6px;
    border-radius: 999px;
    background: var(--lt-chip);
    overflow: hidden;

    span {
        display: block;
        height: 100%;
        background: var(--lt-accent);
    }
}

.khx-tag-actions {
    display: flex;
    gap: 2px;
    opacity: 0.35;

    button {
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 0;
        border-radius: 6px;
        background: transparent;
        color: var(--lt-muted);
        cursor: pointer;

        &:hover {
            background: var(--lt-chip);
            color: var(--lt-text);
        }
    }
}

.khx-tag-edit,
.khx-tag-add form {
    flex: 1;
    display: flex;
    gap: 8px;
    min-width: 0;

    input {
        flex: 1;
        min-width: 0;
        height: 40px;
        padding: 0 12px;
        border-radius: 8px;
        border: 1px solid var(--lt-accent);
        background: var(--lt-inset);
        color: var(--lt-text);
        font-size: 14px;
        outline: none;
        box-shadow: none;
    }
}

.khx-tag-add {
    padding: 6px 8px;

    &[x-cloak] {
        display: none;
    }
}

.khx-tags-note {
    padding: 10px 16px 14px;
    border-top: 1px solid var(--lt-line);
    font-size: 12px;
    color: var(--lt-muted);
}

.khx-tags-empty {
    color: var(--lt-muted);
}

@media (hover: none) {
    .khx-tag-actions {
        opacity: 1;
    }
}

/* ---- Leads page (YON-170) ----
   Call-list rail or chip row, toolbar, table and the lead panel, after the Leads board. Follows the admin's light or dark mode (tokens flip under .dark, as in
   the Event analytics section). The sidebar's collapsed state (Filament's Alpine store) sets [data-nav] on .khx-leads:
   "rail" (sidebar collapsed) shows the rail, "wide" (sidebar expanded) shows the chip row. The panel sits
   beside the table, and slides over it only when the sidebar is expanded on a screen under 1280px. Nothing here is Tailwind. */

.khx-leads {
    --khx-card: #fff;
    --khx-head: #f4f4f5;
    --khx-line: #e4e4e7;
    --khx-field: #fff;
    --khx-field-line: #d4d4d8;
    --khx-text: #18181b;
    --khx-soft: #3f3f46;
    --khx-muted: #52525b;
    --khx-selected: #e6f2fb;
    --khx-selected-text: #0c4a7a;
    --khx-accent: #1c7ec6;
    --khx-primary: #1a6fae;
    --khx-hover: #f4f4f5;
    --khx-row-open: #eaf3fb;
    --khx-on-selected: #0c4a7a;
    --khx-focus: #1c7ec6;
    --khx-link: #1a6faf;
    --khx-link-hover: #0c4a7a;
    --khx-due-bg: #ffedd5;
    --khx-due-text: #9a3412;
    --khx-overdue: #c2410c;
    --khx-avatar-bg: #dbeafe;
    --khx-avatar-text: #1e40af;
    --khx-dashed: #a1a1aa;
    --khx-dot: #1c7ec6;
    --khx-shadow: rgba(0, 0, 0, 0.18);
    --khx-ok: #047857;
    --khx-info: #1a6faf;
    --khx-warn: #c2410c;

    font-family: Inter, system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    color: var(--khx-text);
}

.dark .khx-leads {
    --khx-card: #18181b;
    --khx-head: #141417;
    --khx-line: #27272a;
    --khx-field: #09090b;
    --khx-field-line: #3f3f46;
    --khx-text: #fafafa;
    --khx-soft: #d4d4d8;
    --khx-muted: #a1a1aa;
    --khx-selected: #102a3e;
    --khx-selected-text: #e0f0fb;
    --khx-hover: #1f1f23;
    --khx-row-open: #172636;
    --khx-on-selected: #fff;
    --khx-focus: #5ab0ec;
    --khx-link: #5ab0ec;
    --khx-link-hover: #8cc8f2;
    --khx-due-bg: #7c2d12;
    --khx-due-text: #fed7aa;
    --khx-overdue: #fdba74;
    --khx-avatar-bg: #1e3a5f;
    --khx-avatar-text: #bfdbfe;
    --khx-dashed: #52525b;
    --khx-dot: #5ab0ec;
    --khx-shadow: rgba(0, 0, 0, 0.5);
    --khx-ok: #6ee7b7;
    --khx-info: #8cc8f2;
    --khx-warn: #fdba74;
}

.khx-leads button,
.khx-leads input {
    font-family: inherit;
}

/* The page header, tightened: the lists and the table are what the page is for. */
.fi-resource-list-records-page.fi-resource-leads > section {
    row-gap: 14px;
    padding-block: 14px 24px;
}

.fi-resource-list-records-page.fi-resource-leads .fi-header-heading {
    font-size: 22px;
    line-height: 28px;
}

.fi-resource-list-records-page.fi-resource-leads .fi-header-subheading {
    margin-top: 0;
    font-size: 14px;
}

.khx-leads-body {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
}

.khx-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.khx-noscroll {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.khx-noscroll::-webkit-scrollbar {
    display: none;
}

.khx-muted {
    color: var(--khx-muted);
    font-size: 13px;
}

/* Call lists: both are in the page, [data-nav] picks one. Until Alpine sets it, neither shows. */
.khx-chips,
.khx-rail {
    display: none;
}

.khx-leads[data-nav='wide'] .khx-chips {
    display: flex;
    flex: 1 1 100%;
    min-width: 0;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
}

/* Sticky beside the table; under the 64px top bar. */
.khx-leads[data-nav='rail'] .khx-rail {
    position: sticky;
    top: 76px;
    display: flex;
    flex: 0 0 220px;
    flex-direction: column;
    gap: 1px;
    width: 220px;
    max-height: calc(100vh - 88px);
    overflow-y: auto;
    padding: 4px;
    background: var(--khx-card);
    border: 1px solid var(--khx-line);
    border-radius: 12px;
}

.khx-rail-heading {
    padding: 10px 8px 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--khx-muted);
}

.khx-list,
.khx-chip {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: var(--khx-soft);
    background: transparent;
    border: 0;
}

.khx-list {
    justify-content: space-between;
    gap: 6px;
    min-height: 34px;
    padding: 4px 6px 4px 8px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.3;
    text-align: left;
}

.khx-chip {
    flex: none;
    gap: 8px;
    height: 38px;
    padding: 0 6px 0 12px;
    border-radius: 999px;
    font-size: 13px;
    white-space: nowrap;
    background: var(--khx-card);
    border: 1px solid var(--khx-line);
}

.khx-list:hover {
    background: var(--khx-hover);
}

.khx-chip:hover {
    background: var(--khx-hover);
}

.khx-list[aria-current='page'] {
    background: var(--khx-selected);
    color: var(--khx-on-selected);
    font-weight: 600;
}

.khx-chip[aria-current='page'] {
    background: var(--khx-selected);
    border-color: var(--khx-accent);
    color: var(--khx-on-selected);
    font-weight: 600;
}

.khx-list:focus-visible,
.khx-chip:focus-visible,
.khx-toggle:focus-visible,
.khx-icon-btn:focus-visible,
.khx-next:focus-visible {
    outline: 2px solid var(--khx-focus);
    outline-offset: 1px;
}

.khx-count {
    flex: none;
    padding: 1px 6px;
    white-space: nowrap;
    border-radius: 999px;
    background: var(--khx-line);
    color: var(--khx-soft);
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

[aria-current='page'] > .khx-count,
.khx-count.is-active {
    background: var(--khx-accent);
    color: #fff;
}

.khx-count.is-due {
    background: var(--khx-due-bg);
    color: var(--khx-due-text);
}

/* Main column */
.khx-main {
    display: flex;
    flex: 999 1 560px;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.khx-toolbar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 10px;
    background: var(--khx-card);
    border: 1px solid var(--khx-line);
    border-radius: 12px;
}

.khx-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.khx-search {
    position: relative;
    display: flex;
    flex: 1 1 180px;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 12px;
    background: var(--khx-field);
    border: 1px solid var(--khx-field-line);
    border-radius: 8px;
}

.khx-search input {
    flex: 1;
    min-width: 0;
    padding: 0;
    color: var(--khx-text);
    font-size: 14px;
    background: transparent;
    border: 0;
    outline: 0;
    box-shadow: none;
}

.khx-search input:focus {
    box-shadow: none;
    outline: 0;
}

.khx-search:focus-within {
    border-color: var(--khx-focus);
    box-shadow: 0 0 0 3px rgba(28, 126, 198, 0.25);
}

.khx-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    color: var(--khx-text);
    font-size: 14px;
    cursor: pointer;
    background: var(--khx-field);
    border: 1px solid var(--khx-field-line);
    border-radius: 8px;
}

.khx-toggle:hover {
    background: var(--khx-line);
}

.khx-toggle[aria-pressed='true'] {
    background: var(--khx-selected);
    border-color: var(--khx-accent);
}

.khx-filter {
    max-width: 100%;
}

.khx-narrow {
    max-width: 520px;
}

.khx-ads {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--khx-line);
}

.khx-ads[x-cloak] {
    display: none;
}

.khx-leads .khx-toolbar .adm-dd-trigger {
    height: 36px;
}

.khx-result {
    font-size: 12px;
    color: var(--khx-muted);
}

.khx-dates {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--khx-muted);
}

.khx-date {
    height: 36px;
    padding: 0 10px;
    color: var(--khx-text);
    font-family: inherit;
    font-size: 14px;
    color-scheme: light;
    background: var(--khx-field);
    border: 1px solid var(--khx-field-line);
    border-radius: 8px;
}

.dark .khx-date {
    color-scheme: dark;
}

.khx-date:focus {
    border-color: var(--khx-focus);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(28, 126, 198, 0.25);
}

/* The cards reuse the event analytics cards, whose colours the .khx-ea class carries. */
.khx-leads-kpis {
    display: block;
}

.khx-leads-kpis .khx-ea-kpis {
    grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
}

.khx-leads-kpi-now {
    margin-top: auto;
    padding-top: 6px;
    font-size: 11px;
}

/* Table and panel */
.khx-work {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-start;
}

/* A container, so the columns can give way to the panel beside them (see the @container rules below). */
.khx-table-card {
    flex: 999 1 440px;
    min-width: 0;
    container-type: inline-size;
}

.khx-table-card .fi-ta-ctn {
    background: var(--khx-card);
    border: 1px solid var(--khx-line);
    border-radius: 12px;
    box-shadow: none;
    --tw-ring-shadow: 0 0 #0000;
}

.khx-table-card .fi-ta-content {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.khx-table-card .fi-ta-content::-webkit-scrollbar {
    display: none;
}

.khx-table-card .fi-ta-table {
    min-width: 560px;
}

.khx-table-card .fi-ta-header-cell {
    padding: 10px 12px;
    background: var(--khx-head);
}

.khx-table-card .fi-ta-header-cell:first-of-type {
    padding-inline-start: 16px;
}

.khx-table-card .fi-ta-actions-header-cell {
    background: var(--khx-head);
}

.khx-table-card .fi-ta-header-cell-label,
.khx-table-card .fi-ta-header-cell button {
    color: var(--khx-muted);
    font-size: 12px;
    font-weight: 600;
}

.khx-table-card .fi-ta-row {
    cursor: pointer;
    border-color: var(--khx-line);
}

.khx-table-card .fi-ta-row:hover,
.khx-table-card .fi-ta-row:hover .fi-ta-cell {
    background: var(--khx-hover);
}

.khx-table-card .fi-ta-cell:first-of-type {
    padding-inline-start: 4px;
}

.khx-table-card .fi-ta-filter-indicators {
    background: var(--khx-head);
}

.khx-cell {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 8px 10px;
    text-align: left;
    font-size: 13px;
    color: var(--khx-soft);
}

.khx-person {
    display: flex;
    align-items: center;
    gap: 8px;
}

.khx-person-name {
    color: var(--khx-text);
    font-size: 14px;
    font-weight: 600;
}

.khx-badge,
.khx-pill[style] {
    background: var(--tone-bg);
    color: var(--tone-fg);
}

.dark .khx-badge,
.dark .khx-pill[style] {
    background: var(--tone-bg-dark);
    color: var(--tone-fg-dark);
}

.khx-badge {
    align-self: flex-start;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.khx-pill {
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

.khx-pill.is-neutral {
    padding: 2px 8px;
    background: var(--khx-line);
    color: var(--khx-soft);
    font-size: 12px;
    font-weight: 400;
}

.khx-owner {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.khx-avatar {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: var(--khx-avatar-bg);
    color: var(--khx-avatar-text);
    font-size: 11px;
    font-weight: 600;
}

.khx-avatar.is-empty {
    background: transparent;
    border: 1px dashed var(--khx-dashed);
    color: var(--khx-muted);
}

.khx-source {
    min-width: 130px;
    max-width: 240px;
}

/* Came from is two lines: where from, then the campaign, each cut to one line (the full text is the cell's title). */
.khx-source .khx-clamp {
    -webkit-line-clamp: 1;
}

/* Beside the panel on a narrower screen, the owner shows as initials (the name is the cell's title), and the
   row's "Open page" button gives way to the panel's own link, so Follow-up stays in view. */
@container (max-width: 820px) {
    .khx-owner > span:last-child {
        display: none;
    }
}

@container (max-width: 700px) {
    .khx-table-card .fi-ta-actions-header-cell,
    .khx-table-card .fi-ta-cell:has(.fi-ta-actions) {
        display: none;
    }
}

.khx-clamp {
    display: -webkit-box;
    overflow: hidden;
    white-space: normal;
    overflow-wrap: anywhere;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.khx-due {
    color: var(--khx-text);
    font-weight: 500;
}

.khx-due.is-overdue {
    color: var(--khx-overdue);
    font-weight: 600;
}

.khx-due.is-none {
    color: var(--khx-muted);
    font-weight: 400;
}

/* The lead panel: beside the table, or a drawer over it when the sidebar is expanded on a narrow screen. */
.khx-panel-slot {
    display: contents;
}

/* The action modals' forms: out of the row, so they take no gap beside the table. */
.khx-panel-slot > :not(.khx-panel) {
    position: absolute;
}

.khx-panel {
    display: flex;
    flex: none;
    flex-direction: column;
    width: clamp(380px, 24vw, 420px);
    min-width: 0;
    background: var(--khx-card);
    border: 1px solid var(--khx-line);
    border-radius: 12px;
}

/* Full height under the 64px top bar, scrolling inside itself as the table scrolls past. */
.khx-leads[data-nav='rail'] .khx-panel,
.khx-leads[data-nav='wide'] .khx-panel {
    position: sticky;
    top: 76px;
    height: calc(100vh - 88px);
    overflow-y: auto;
}

.khx-leads:not([data-nav]) .khx-panel {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 30;
    width: min(420px, 100%);
    max-width: none;
    overflow-y: auto;
    border-width: 0 0 0 1px;
    border-color: var(--khx-field-line);
    border-radius: 0;
    box-shadow: -24px 0 48px var(--khx-shadow);
    animation: khx-panel-in 0.18s ease-out;
}

@media (max-width: 1279px) {
    .khx-leads[data-nav='wide'] .khx-panel {
        position: fixed;
        inset: 0 0 0 auto;
        z-index: 30;
        width: min(420px, 100%);
        max-width: none;
        height: auto;
        border-width: 0 0 0 1px;
        border-color: var(--khx-field-line);
        border-radius: 0;
        box-shadow: -24px 0 48px var(--khx-shadow);
        animation: khx-panel-in 0.18s ease-out;
    }
}

@keyframes khx-panel-in {
    from {
        opacity: 0;
        transform: translateX(24px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .khx-leads .khx-panel {
        animation: none;
    }
}

.khx-panel-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: flex-start;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--khx-line);
}

.khx-panel-who {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.khx-panel-name {
    font-size: 18px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.khx-panel-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 4px;
}

.khx-panel-tools {
    display: flex;
    flex: none;
    gap: 4px;
    align-items: center;
}

.khx-open-page {
    display: flex;
    align-items: center;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    color: var(--khx-link);
    font-size: 13px;
    text-decoration: none;
}

.khx-open-page:hover {
    color: var(--khx-link-hover);
}

.khx-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: var(--khx-muted);
    cursor: pointer;
    background: transparent;
    border: 0;
    border-radius: 8px;
}

.khx-icon-btn:hover {
    background: var(--khx-line);
}

.khx-panel-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--khx-line);
}

.khx-panel-actions .khx-act-main {
    grid-column: span 2;
}

.khx-panel-actions .fi-btn {
    width: 100%;
    justify-content: center;
}

.khx-panel-actions .khx-act-main .fi-btn {
    height: 44px;
    background: var(--khx-primary);
}

.khx-panel-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--khx-line);
}

.khx-panel-section h3 {
    margin: 0;
    color: var(--khx-muted);
    font-size: 12px;
    font-weight: 600;
}

.khx-panel-section.khx-timeline {
    border-bottom: 0;
}

/* The timeline and notes views are shared with the lead's own page, which lays the time beside the text. */
.khx-panel [data-timeline-entry] {
    position: relative;
    flex-direction: column;
    gap: 2px;
    padding-inline-start: 18px !important;
}

.khx-panel [data-timeline-entry]::before {
    content: '';
    position: absolute;
    inset-block-start: 0.95rem;
    inset-inline-start: 0;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--khx-dot);
}

.khx-panel [data-timeline-entry] > div:first-child {
    min-width: 0 !important;
    order: 2;
}

.khx-panel-foot {
    position: sticky;
    bottom: 0;
    padding: 10px 16px;
    background: var(--khx-card);
    border-top: 1px solid var(--khx-line);
}

.khx-next {
    width: 100%;
    height: 38px;
    color: var(--khx-text);
    font-size: 14px;
    cursor: pointer;
    background: var(--khx-field);
    border: 1px solid var(--khx-field-line);
    border-radius: 8px;
}

.khx-next:hover {
    background: var(--khx-line);
}

/* The shared dropdown ships dark; follow the page's theme inside it. */
.khx-leads .adm-dd,
.khx-leads .adm-dd-trigger,
.khx-leads .adm-dd-search input,
.khx-leads .adm-dd-option {
    color: var(--khx-text);
}

.khx-leads .adm-dd-label,
.khx-leads .adm-dd-inline-label,
.khx-leads .adm-dd-value,
.khx-leads .adm-dd-sub,
.khx-leads .adm-dd-count,
.khx-leads .adm-dd-empty,
.khx-leads .adm-dd-footer {
    color: var(--khx-muted);
}

.khx-leads .adm-dd-inline .adm-dd-value,
.khx-leads .adm-dd-trigger.is-active .adm-dd-value {
    color: var(--khx-text);
}

.khx-leads .adm-dd-trigger {
    background: var(--khx-field);
    border-color: var(--khx-field-line);

    &.is-active {
        background: var(--khx-selected);
        border-color: var(--khx-accent);
    }

    &.is-open,
    &:focus-visible {
        border-color: var(--khx-focus);
    }
}

.khx-leads .adm-dd-menu {
    background: var(--khx-card);
    border-color: var(--khx-field-line);
    box-shadow: 0 16px 40px var(--khx-shadow);
}

.khx-leads .adm-dd-search,
.khx-leads .adm-dd-footer {
    border-color: var(--khx-line);
}

.khx-leads .adm-dd-option.is-hot {
    background: var(--khx-hover);
}

.khx-leads .adm-dd-option.is-selected {
    background: var(--khx-selected);
}

.khx-leads .adm-dd-active-count,
.khx-leads .adm-dd-tick {
    color: var(--khx-link);
}

/* ---- Leads import (YON-171) ----
   The Import CSV dialog: upload or paste, match columns, review. It renders inside .khx-leads, so it uses the
   page's tokens and follows the admin's theme. */

.khx-imp-overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 48px 16px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.55);
}

.khx-imp {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 760px;
    background: var(--khx-card);
    border: 1px solid var(--khx-field-line);
    border-radius: 14px;
    box-shadow: 0 24px 64px var(--khx-shadow);
}

.khx-imp-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--khx-line);
}

.khx-imp-title {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.khx-imp-title h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.khx-imp-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 0;
    padding: 14px 20px;
    list-style: none;
    border-bottom: 1px solid var(--khx-line);
}

.khx-imp-steps li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--khx-muted);
}

.khx-imp-steps li.is-current {
    color: var(--khx-text);
    font-weight: 600;
}

.khx-imp-steps li.is-done {
    color: var(--khx-link);
}

.khx-imp-dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: var(--khx-line);
    color: var(--khx-muted);
    font-size: 12px;
    font-weight: 600;
}

.is-current > .khx-imp-dot {
    background: var(--khx-accent);
    color: #fff;
}

.is-done > .khx-imp-dot {
    background: var(--khx-selected);
    color: var(--khx-link);
}

.khx-imp-body {
    padding: 18px 20px;
}

.khx-imp-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.khx-imp-drop {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 160px;
    padding: 16px;
    color: var(--khx-link);
    text-align: center;
    cursor: pointer;
    background: var(--khx-field);
    border: 1.5px dashed var(--khx-dashed);
    border-radius: 12px;
}

.khx-imp-drop:hover,
.khx-imp-drop:focus-within {
    border-color: var(--khx-focus);
}

.khx-imp-drop-title {
    color: var(--khx-text);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.khx-imp-or {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--khx-muted);
    font-size: 12px;
}

.khx-imp-or span {
    flex: 1;
    height: 1px;
    background: var(--khx-line);
}

.khx-imp-or span:not(:first-child):not(:last-child) {
    flex: none;
    height: auto;
    background: none;
}

.khx-imp-paste {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--khx-soft);
    font-size: 13px;
}

.khx-imp-paste textarea {
    padding: 10px 12px;
    color: var(--khx-text);
    font-family: ui-monospace, monospace;
    font-size: 13px;
    resize: vertical;
    background: var(--khx-field);
    border: 1px solid var(--khx-field-line);
    border-radius: 8px;
}

.khx-imp-paste textarea:focus {
    outline: 0;
    border-color: var(--khx-focus);
    box-shadow: 0 0 0 3px rgba(28, 126, 198, 0.25);
}

.khx-imp-pair {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
    gap: 10px;
}

.khx-imp-error {
    margin: 0;
    color: var(--khx-warn);
    font-size: 13px;
}

.khx-imp-note {
    margin: 0;
    padding: 10px 12px;
    color: var(--khx-soft);
    font-size: 13px;
    background: var(--khx-head);
    border: 1px solid var(--khx-line);
    border-radius: 10px;
}

.khx-imp-map,
.khx-imp-list {
    border: 1px solid var(--khx-line);
    border-radius: 10px;
}

.khx-imp-map-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 12px;
    align-items: center;
    padding: 6px 12px;
    border-top: 1px solid var(--khx-line);
}

.khx-imp-map-row.is-head {
    padding: 8px 12px;
    color: var(--khx-muted);
    font-size: 12px;
    font-weight: 600;
    background: var(--khx-head);
    border-top: 0;
    border-radius: 10px 10px 0 0;
}

.khx-imp-map .adm-dd-trigger.is-active {
    background: var(--khx-field);
    border-color: var(--khx-field-line);
}

.khx-imp-map .adm-dd-trigger:not(.is-active) {
    background: transparent;
    border-style: dashed;
    border-color: var(--khx-dashed);
}

.khx-imp-col {
    min-width: 0;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.khx-imp-sample {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.khx-imp-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
    gap: 10px;
}

.khx-imp-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 14px;
    background: var(--khx-field);
    border: 1px solid var(--khx-line);
    border-radius: 10px;
}

.khx-imp-stat strong {
    font-size: 24px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.khx-imp-stat span {
    color: var(--khx-soft);
    font-size: 13px;
}

.khx-imp-stat.is-new strong {
    color: var(--khx-ok);
}

.khx-imp-stat.is-update strong {
    color: var(--khx-info);
}

.khx-imp-stat.is-skip strong {
    color: var(--khx-warn);
}

.khx-imp-list-head {
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    background: var(--khx-head);
    border-radius: 10px 10px 0 0;
}

.khx-imp-list-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    font-size: 13px;
    border-top: 1px solid var(--khx-line);
}

.khx-imp-link {
    display: block;
    width: 100%;
    padding: 10px 12px;
    color: var(--khx-link);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    background: transparent;
    border: 0;
    border-top: 1px solid var(--khx-line);
}

.khx-imp-stack > .khx-imp-link {
    width: auto;
    padding: 0;
    border-top: 0;
}

.khx-imp-link:hover {
    color: var(--khx-link-hover);
    text-decoration: underline;
}

.khx-imp-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--khx-line);
}

.khx-imp-spacer {
    flex: 1;
}

.khx-imp-btn {
    height: 40px;
    padding: 0 14px;
    color: var(--khx-text);
    font-size: 14px;
    cursor: pointer;
    background: transparent;
    border: 1px solid var(--khx-field-line);
    border-radius: 8px;
}

.khx-imp-btn:hover {
    background: var(--khx-hover);
}

.khx-imp-btn.is-quiet {
    color: var(--khx-soft);
    border-color: transparent;
}

.khx-imp-btn.is-primary {
    padding: 0 16px;
    color: #fff;
    font-weight: 600;
    background: var(--khx-primary);
    border-color: transparent;
}

.khx-imp-btn.is-primary:hover {
    background: var(--khx-accent);
}

.khx-imp-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.khx-imp-btn:focus-visible,
.khx-imp-link:focus-visible {
    outline: 2px solid var(--khx-focus);
    outline-offset: 1px;
}

@media (max-width: 560px) {
    .khx-imp-map-row {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .khx-imp-map-row.is-head span:nth-child(2),
    .khx-imp-sample {
        display: none;
    }

    .khx-imp-map-row .adm-dd {
        grid-column: 1 / -1;
    }
}

/* ---- Event analytics: a section still loading (YON-210) ---- */

.khx-ea-skeleton {
    display: block;
    width: 100%;
    border-radius: 6px;
    background: rgba(127, 127, 127, .12);
    animation: khx-ea-pulse 1.4s ease-in-out infinite;
}

@keyframes khx-ea-pulse {
    50% { opacity: .5; }
}

@media (prefers-reduced-motion: reduce) {
    .khx-ea-skeleton { animation: none; }
}
