:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-subtle: #f8fafc;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text: #0f172a;
    --text-muted: #64748b;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-soft: #eef2ff;
    --success: #059669;
    --success-soft: #ecfdf5;
    --amber: #d97706;
    --amber-soft: #fffbeb;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 4px 10px -6px rgba(15, 23, 42, 0.05);
}

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

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }

/* Auth Gate */
.auth-gate {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: radial-gradient(circle at top right, #e0e7ff 0%, var(--bg) 55%);
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 36px;
    box-shadow: var(--shadow-md);
    text-align: center;
}

.auth-card h1 {
    margin: 16px 0 8px;
    font-size: 22px;
    font-weight: 700;
}

.auth-actions {
    margin-top: 24px;
    display: flex;
    justify-content: center;
}

.config-help {
    margin-top: 20px;
    text-align: left;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    font-size: 12.5px;
}

.config-help pre {
    margin: 8px 0 0;
    padding: 10px;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 12px;
}

/* Brand & Topbar */
.brand-logo {
    display: block;
    height: 60px;
    width: auto;
    margin: 0 auto;
    object-fit: contain;
}

.brand-logo.sm {
    height: 38px;
    margin: 0;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #fff;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.brand-badge.sm {
    width: 34px;
    height: 34px;
    font-size: 12px;
    border-radius: 9px;
}

.app-shell:not(.hidden) {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    flex-shrink: 0;
    background: #000000;
    color: #f8fafc;
    border-bottom: 1px solid #262626;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.topbar-left, .topbar-right {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.brand-mark {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-title { font-weight: 700; font-size: 15px; line-height: 1.2; color: #ffffff; }
.brand-sub { font-size: 11.5px; color: #a1a1aa; }

.nav-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.nav-tab {
    border: 1px solid transparent;
    background: transparent;
    color: #d4d4d8;
    padding: 8px 13px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s ease;
}

.nav-tab:hover { background: rgba(255, 255, 255, 0.09); color: #ffffff; }
.nav-tab.active {
    background: rgba(251, 221, 0, 0.14);
    color: #fbdd00;
    border-color: rgba(251, 221, 0, 0.42);
}

.topbar .pill-neutral { background: #27272a; color: #e4e4e7; }
.topbar .nav-tab.active .pill-neutral { background: rgba(251, 221, 0, 0.22); color: #fef08a; }
.topbar .pill-amber { background: rgba(217, 119, 6, 0.22); color: #fcd34d; border-color: rgba(245, 158, 11, 0.45); }
.topbar .pill-green { background: rgba(5, 150, 105, 0.22); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.45); }

.user-pill {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 4px 10px 4px 6px;
    border-radius: 999px;
    background: #141414;
    border: 1px solid #27272a;
}

.user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
}

.user-meta { display: flex; flex-direction: column; line-height: 1.15; }
.user-name { font-weight: 600; font-size: 12.5px; color: #f8fafc; }
.user-email { font-size: 11px; color: #a1a1aa; }

.topbar .btn {
    background: #18181b;
    border-color: #3f3f46;
    color: #f8fafc;
}
.topbar .btn:hover { background: #27272a; }
.topbar .btn-ghost {
    background: transparent;
    border-color: transparent;
    color: #d4d4d8;
}
.topbar .btn-ghost:hover { background: rgba(255, 255, 255, 0.1); color: #ffffff; }

/* Layout */
.main-content {
    flex: 1;
    min-height: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.tab-panel { display: none; }
.tab-panel.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 0;
}

#tab-export.tab-panel.active {
    display: block;
    overflow-y: auto;
    padding: 18px 20px 32px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.tab-panel.active > .card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    box-shadow: none;
}

#tab-export .card {
    flex: initial;
    display: block;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.card-header {
    flex-shrink: 0;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.card-header > div:first-child {
    flex: 1 1 360px;
    min-width: 0;
}

.card-header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    flex-shrink: 0;
    margin-left: auto;
}

.header-pagination {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 13px;
}

.card-body { padding: 20px; }

.section-title { margin: 0; font-size: 17px; font-weight: 700; }
.section-sub { margin: 2px 0 0; font-size: 13px; color: var(--text-muted); }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
}

.stat-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-hint { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Toolbar & Inputs */
.toolbar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 18px;
    background: var(--surface-subtle);
    border-bottom: 1px solid var(--border);
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

input[type="text"], input[type="email"], input[type="search"], input[type="number"], input[type="url"], select, textarea {
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 7px 11px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.14);
}

.search-input { min-width: 260px; }

.checkbox-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 11px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}

/* Buttons & Pills */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}

.btn:hover { background: var(--surface-subtle); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-icon-only { padding: 5px 7px; min-width: 28px; }

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-success {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}
.btn-success:hover { background: #047857; }

.btn-danger {
    background: var(--danger-soft);
    border-color: #fecaca;
    color: var(--danger);
}
.btn-danger:hover { background: #fee2e2; }

.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-subtle); }

.btn-icon {
    border: none;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 6px;
}
.btn-icon:hover { background: var(--surface-subtle); color: var(--text); }

.pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

.pill-neutral { background: #e2e8f0; color: #334155; }
.pill-amber { background: var(--amber-soft); color: var(--amber); border: 1px solid #fde68a; }
.pill-green { background: var(--success-soft); color: var(--success); border: 1px solid #a7f3d0; }
.pill-indigo { background: var(--primary-soft); color: var(--primary); border: 1px solid #c7d2fe; }
.pill-red { background: var(--danger-soft); color: var(--danger); border: 1px solid #fecaca; }

/* Tables */
.table-wrap {
    overflow: auto;
    max-height: 68vh;
}

.tab-panel.active > .card > .table-wrap {
    flex: 1;
    min-height: 0;
    max-height: none;
}

table.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.data-table th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f8fafc;
    color: #334155;
    font-weight: 700;
    font-size: 12px;
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    user-select: none;
}

.data-table th.sortable { cursor: pointer; }
.data-table th.sortable:hover { background: #eef2ff; color: var(--primary); }

.data-table td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: var(--surface);
}

.data-table tbody tr:hover td { background: #f8fafc; }
.data-table tbody tr.row-staged td { background: #fffdf5; }
.data-table tbody tr.row-staged:hover td { background: #fef9e7; }

.sticky-col {
    position: sticky;
    left: 0;
    z-index: 2;
    border-right: 1px solid var(--border);
    box-shadow: 2px 0 6px rgba(15, 23, 42, 0.04);
}
.data-table th.sticky-col { z-index: 5; }

.sticky-sku {
    position: sticky;
    left: var(--sticky-sku-left, 128px);
    z-index: 1;
    border-right: 1px solid var(--border-strong);
    box-shadow: 2px 0 6px rgba(15, 23, 42, 0.06);
    font-weight: 600;
}
.data-table th.sticky-sku { z-index: 4; }

.sticky-col-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.sticky-col-wrap input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--primary);
}

.sticky-col-wrap input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.pill-no-export {
    color: #64748b;
    background: #f1f5f9;
    border: 1px solid var(--border);
}

.row-open-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border-radius: 6px;
    border: 1px solid #c7d2fe;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
}
.row-open-btn:hover { background: var(--primary); color: #fff; }

.row-open-icon-btn {
    width: 26px;
    height: 26px;
    padding: 0;
    justify-content: center;
    flex-shrink: 0;
}

.pagination-bar {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--border);
    background: var(--surface-subtle);
    flex-wrap: wrap;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-dialog {
    width: 100%;
    max-width: 960px;
    max-height: 92vh;
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-dialog.wide { max-width: 1240px; }

.modal-header {
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h2 { margin: 0; font-size: 17px; font-weight: 700; }

.modal-body {
    padding: 20px 22px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border);
    background: var(--surface-subtle);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

/* Modal Form Tabs & Grid */
.sub-tabs {
    display: flex;
    gap: 6px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.sub-tab {
    border: none;
    background: transparent;
    padding: 8px 12px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    cursor: pointer;
}
.sub-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field.span-2 { grid-column: span 2; }
.form-field.span-full { grid-column: 1 / -1; }
.form-field label { font-size: 12px; font-weight: 600; color: #334155; }
.form-field textarea { min-height: 90px; resize: vertical; }
.input-currency-wrap {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    overflow: hidden;
}
.input-currency-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.input-currency-prefix {
    display: inline-flex;
    align-items: center;
    padding: 0 10px;
    background: #f8fafc;
    border-right: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
    user-select: none;
}
.input-currency-wrap input {
    flex: 1;
    min-width: 0;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

.derived-box {
    background: var(--primary-soft);
    border: 1px solid #c7d2fe;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 12.5px;
    color: #1e1b4b;
}

/* Alerts & Toasts */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 14px;
}
.alert-error { background: var(--danger-soft); border: 1px solid #fecaca; color: var(--danger); }
.alert-info { background: var(--primary-soft); border: 1px solid #c7d2fe; color: #3730a3; }
.alert-warn { background: var(--amber-soft); border: 1px solid #fde68a; color: #92400e; }

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 80;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: #0f172a;
    color: #fff;
    padding: 11px 16px;
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    font-size: 13px;
    font-weight: 500;
    max-width: 380px;
}
.toast.toast-success { background: #065f46; }
.toast.toast-warn { background: #92400e; }
.toast.toast-error { background: #991b1b; }

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 18px;
}

/* Invited Users & Access Control Modal */
.users-info-banner {
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 13.5px;
    color: var(--text);
    margin-bottom: 16px;
}

.invite-user-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.invite-user-row input[name="email"] {
    flex: 1.4 1 240px;
}

.invite-user-row input[name="name"] {
    flex: 1 1 190px;
}

.invite-user-row select[name="role"] {
    flex: 0 0 118px;
}

.users-table-wrap {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: auto;
    max-height: 50vh;
}

.users-table th {
    background: var(--surface-subtle);
}

.users-table td {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    max-width: none;
    padding: 12px 14px;
    vertical-align: middle;
}

.users-table tbody tr:last-child td {
    border-bottom: none;
}

.user-submeta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.mono-muted {
    font-size: 12.5px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap !important;
}

.user-actions-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.btn-pill {
    border-radius: 999px;
    padding: 5px 14px;
}

.btn-dark {
    background: #0f172a;
    border-color: #0f172a;
    color: #fff;
    border-radius: 999px;
    padding: 8px 18px;
}
.btn-dark:hover {
    background: #1e293b;
}

.btn-danger-solid {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}
.btn-danger-solid:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

@media (max-width: 900px), (max-height: 540px) {
    .app-shell:not(.hidden) {
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .tab-panel.active > .card > .table-wrap {
        min-height: 55vh;
        max-height: 70vh;
    }
}

/* Edit Timeline & Date Range Filter */
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--primary-soft);
    border: 1px solid #c7d2fe;
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
}

.filter-chip-clear {
    border: none;
    background: transparent;
    color: var(--primary);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}

.history-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.history-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.history-range-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.history-date-field {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
}

.history-date-field input[type="datetime-local"] {
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 6px 9px;
}

.timeline-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-subtle);
    padding: 12px 14px 10px;
    margin-bottom: 12px;
}

.timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.timeline-title {
    font-size: 13px;
    font-weight: 700;
}

.timeline-legend {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    flex-wrap: wrap;
}

.legend-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 2px;
}
.legend-added { background: var(--success); }
.legend-edited { background: var(--primary); margin-left: 6px; }

.timeline-track {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    overflow-x: auto;
    padding: 4px 2px 6px;
    min-height: 128px;
}

.timeline-node {
    flex: 0 0 auto;
    min-width: 56px;
    padding: 6px 6px 4px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.timeline-node:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
}

.timeline-node.in-range {
    background: var(--surface);
    border-color: #c7d2fe;
    box-shadow: var(--shadow-sm);
}

.timeline-node.out-range {
    opacity: 0.45;
}

.timeline-count {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.timeline-bar-slot {
    width: 24px;
    height: 64px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.timeline-bar {
    width: 100%;
    border-radius: 5px 5px 2px 2px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background: var(--primary);
}

.timeline-seg-edited {
    width: 100%;
    background: var(--primary);
}

.timeline-seg-added {
    width: 100%;
    background: var(--success);
}

.timeline-tick {
    width: 100%;
    height: 2px;
    background: var(--border-strong);
    position: relative;
}

.timeline-node.in-range .timeline-tick {
    background: var(--primary);
}

.timeline-label {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

.history-summary-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 13px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-subtle);
    margin-bottom: 12px;
}

.history-table-wrap {
    max-height: 38vh;
    border: 1px solid var(--border);
    border-radius: 10px;
}

/* Save & Restore Database State Modal */
.state-info-banner {
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 13.5px;
    color: var(--text);
    margin-bottom: 14px;
    line-height: 1.55;
}

.state-info-banner code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
    background: #eef2f7;
    padding: 1px 5px;
    border-radius: 4px;
}

.state-controls-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.state-controls-row input[type="text"] {
    flex: 1.6 1 280px;
}

.btn-pill-lg {
    border-radius: 999px;
    padding: 8px 18px;
}

.state-seed-status {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-bottom: 14px;
    font-variant-numeric: tabular-nums;
}

.state-table-wrap {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: auto;
    max-height: 46vh;
}

.state-table th {
    background: var(--surface-subtle);
}

.state-table td {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    max-width: none;
    padding: 12px 14px;
    vertical-align: middle;
}

.state-table tbody tr:last-child td {
    border-bottom: none;
}

.state-saved-at {
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.state-filename {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
}

.state-note-cell {
    max-width: 280px !important;
    word-break: break-word;
}

.state-submeta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.state-row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

/* Inline Cell Editing, Label Pills, & StartInfinity-Style Column Config */
.col-has-menu {
    cursor: pointer;
}

.col-type-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
    margin-right: 6px;
    vertical-align: middle;
}

.col-menu-caret {
    margin-left: 5px;
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.6;
}
th.col-has-menu:hover .col-menu-caret {
    opacity: 1;
    color: var(--primary);
}

.col-header-menu {
    position: fixed;
    z-index: 95;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.col-menu-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 8px 10px;
    border-radius: 7px;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
}
.col-menu-item:hover {
    background: var(--surface-subtle);
    color: var(--primary);
}
.col-menu-item.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}
.col-menu-icon {
    width: 16px;
    text-align: center;
    color: var(--text-muted);
}
.col-menu-sep {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}
.col-menu-empty {
    padding: 8px 10px;
    font-size: 12.5px;
}

td.cell-editable {
    cursor: pointer;
    transition: box-shadow 0.1s ease;
}
td.cell-editable:hover {
    box-shadow: inset 0 0 0 1.5px #a5b4fc;
}
td.cell-editing {
    padding: 3px 6px !important;
    overflow: visible !important;
}
td.cell-saving {
    opacity: 0.6;
    pointer-events: none;
}
.cell-placeholder {
    color: #cbd5e1;
}
.cell-currency {
    font-variant-numeric: tabular-nums;
}
.cell-currency-symbol {
    color: var(--text-muted);
    margin-right: 1px;
    user-select: none;
}

.cell-inline-input {
    width: 100%;
    min-width: 110px;
    padding: 5px 8px !important;
    font-size: 13px;
    border: 1.5px solid var(--primary) !important;
    border-radius: 6px;
}

.cell-pills-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
}

.label-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
}

.label-color-blue { background: #dbeafe; color: #1e40af; }
.label-color-green { background: #dcfce7; color: #166534; }
.label-color-pink { background: #fce7f3; color: #9d174d; }
.label-color-purple { background: #ede9fe; color: #5b21b6; }
.label-color-amber { background: #fef3c7; color: #92400e; }
.label-color-teal { background: #ccfbf1; color: #115e59; }
.label-color-indigo { background: #e0e7ff; color: #3730a3; }
.label-color-red { background: #fee2e2; color: #991b1b; }
.label-color-slate { background: #e2e8f0; color: #1e293b; }
.label-color-gray { background: #f1f5f9; color: #475569; }

.cell-popover {
    position: fixed;
    z-index: 95;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cell-popover-head {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-subtle);
}

.cell-popover-search {
    width: 100%;
    padding: 6px 9px !important;
    font-size: 13px;
}

.cell-popover-list {
    max-height: 260px;
    overflow-y: auto;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cell-pop-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 6px 8px;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
}
.cell-pop-option:hover {
    background: var(--surface-subtle);
}
.cell-pop-option.selected {
    background: var(--primary-soft);
}
.cell-pop-check {
    color: var(--primary);
    font-weight: 700;
    font-size: 13px;
}
.cell-pop-lookup {
    align-items: flex-start;
}
.cell-pop-sub {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 3px;
    white-space: normal;
    line-height: 1.3;
}
.cell-pop-create {
    color: var(--primary);
    border-top: 1px dashed var(--border);
    margin-top: 4px;
    padding-top: 8px;
}
.cell-pop-empty {
    padding: 12px;
    text-align: center;
    font-size: 12.5px;
}

.cell-popover-foot {
    padding: 8px 10px;
    border-top: 1px solid var(--border);
    background: var(--surface-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.cell-pop-foot-left {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cell-popover-textarea {
    width: 100%;
    font: inherit;
    font-size: 13px;
    resize: vertical;
}

/* Column Label Configuration Modal */
.colcfg-top-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 14px;
    margin-bottom: 16px;
}

.colcfg-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.colcfg-toggles {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.colcfg-switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13.5px;
    user-select: none;
}

.colcfg-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.colcfg-switch-track {
    width: 36px;
    height: 20px;
    border-radius: 999px;
    background: #cbd5e1;
    position: relative;
    transition: background 0.15s ease;
    flex-shrink: 0;
}
.colcfg-switch-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: transform 0.15s ease;
}
.colcfg-switch input:checked + .colcfg-switch-track {
    background: #0ea5e9;
}
.colcfg-switch input:checked + .colcfg-switch-track::after {
    transform: translateX(16px);
}

.colcfg-labels-list {
    border: 1px solid var(--border);
    border-radius: 10px;
    max-height: 300px;
    overflow-y: auto;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--surface-subtle);
}

.colcfg-label-row {
    display: grid;
    grid-template-columns: 20px 38px 1.2fr 1fr auto;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 5px 8px;
}
.colcfg-label-row.dragging {
    opacity: 0.45;
}

.colcfg-drag-handle {
    cursor: grab;
    color: var(--text-muted);
    font-weight: 700;
    text-align: center;
    user-select: none;
}

.colcfg-color-btn {
    width: 34px;
    height: 28px;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    font-weight: 700;
    font-size: 12px;
}

.colcfg-label-row input[type="text"] {
    padding: 5px 8px;
    font-size: 13px;
}

.colcfg-row-btns {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}
.colcfg-row-btns .btn-icon {
    font-size: 15px;
    padding: 3px 5px;
}

.colcfg-add-btn {
    margin-top: 8px;
    color: var(--primary);
}

/* WordPress Export Column Indicators */
.export-legend {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-left: 10px;
    flex-wrap: wrap;
}

.legend-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
}

.legend-chip::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 3px;
    border-radius: 2px;
}

.legend-direct::before { background: var(--success); }
.legend-derived::before { background: var(--primary); }
.legend-internal::before { background: #cbd5e1; }
.legend-disabled::before { background: var(--danger); }

.data-table th.col-export-direct {
    border-top: 3px solid var(--success);
}

.data-table th.col-export-derived {
    border-top: 3px solid var(--primary);
}

.data-table th.col-export-gate {
    border-top: 3px solid var(--amber);
}

.data-table th.col-export-internal {
    border-top: 3px solid #cbd5e1;
    background: #f1f5f9;
    color: #94a3b8;
    font-weight: 600;
}

.data-table th.col-export-disabled {
    border-top: 3px solid var(--danger);
    background: #fef2f2;
    color: #991b1b;
    font-weight: 600;
}

.col-disabled-badge {
    display: inline-block;
    margin-left: 5px;
    padding: 0 5px;
    border-radius: 4px;
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 15px;
}

.data-table td.cell-internal {
    color: #64748b;
    background: #fcfdff;
}

.data-table td.cell-disabled {
    color: #94a3b8;
    background: #fafafa;
    opacity: 0.72;
    cursor: not-allowed;
}

.col-menu-toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12.5px;
    color: var(--text);
}

.col-menu-toggle-item:hover {
    background: var(--surface-subtle);
}

.col-menu-toggle-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.2;
}

.col-menu-toggle-text > span {
    font-weight: 600;
}

.col-menu-toggle-text > small {
    font-size: 11px;
    color: var(--text-muted);
}

.col-menu-switch {
    flex-shrink: 0;
}

.colcfg-disable-box {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.pill-woo-warn {
    padding: 1px 6px;
    font-size: 11px;
    line-height: 1.25;
}

.col-menu-export-badge {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 6px 8px;
}

.col-menu-export-target {
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.3;
}

/* WYSIWYG + HTML Description Editor */
.html-editor {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.html-editor:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.html-editor-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 8px;
    background: var(--surface-subtle);
    border-bottom: 1px solid var(--border);
}

.html-editor-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 3px;
}

.html-editor-toolbar.disabled {
    opacity: 0.45;
}

.html-ed-btn {
    border: 1px solid transparent;
    background: transparent;
    color: var(--text);
    border-radius: 6px;
    padding: 4px 7px;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.1;
    cursor: pointer;
    min-width: 26px;
}

.html-ed-btn:hover:not(:disabled) {
    background: var(--surface);
    border-color: var(--border);
}

.html-ed-btn.active:not(:disabled) {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: #c7d2fe;
}

.html-ed-btn:disabled {
    cursor: not-allowed;
}

.html-ed-sep {
    width: 1px;
    height: 16px;
    background: var(--border-strong);
    margin: 0 3px;
}

.html-editor-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.html-ed-revert {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 6px;
    padding: 4px 8px;
    font: inherit;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
}

.html-ed-revert:hover:not(:disabled) {
    border-color: var(--amber);
    background: var(--amber-soft);
    color: #92400e;
}

.html-ed-revert:disabled {
    opacity: 0.45;
    cursor: default;
}

.html-ed-mode {
    display: inline-flex;
    background: #e2e8f0;
    padding: 2px;
    border-radius: 7px;
    gap: 2px;
}

.html-ed-mode-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 11.5px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 5px;
    cursor: pointer;
}

.html-ed-mode-btn.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.html-ed-link-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: var(--primary-soft);
    border-bottom: 1px solid #c7d2fe;
}

.html-ed-link-input {
    flex: 1;
    min-width: 160px;
    padding: 5px 8px !important;
    font-size: 12.5px !important;
}

.html-editor-visual {
    padding: 10px 12px;
    min-height: 120px;
    overflow-y: auto;
    outline: none;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--text);
}

.html-editor-visual:empty::before {
    content: attr(data-placeholder);
    color: var(--text-muted);
    pointer-events: none;
}

.html-editor-visual p {
    margin: 0 0 8px;
}

.html-editor-visual p:last-child {
    margin-bottom: 0;
}

.html-editor-visual ul,
.html-editor-visual ol {
    margin: 4px 0 8px;
    padding-left: 22px;
}

.html-editor-visual h2 {
    margin: 6px 0 6px;
    font-size: 16px;
}

.html-editor-visual h3 {
    margin: 6px 0 6px;
    font-size: 14.5px;
}

.html-editor-visual a {
    color: var(--primary);
    text-decoration: underline;
}

.html-editor-source {
    width: 100%;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 10px 12px;
    font-size: 12.5px;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    background: #fcfdff;
    color: var(--text);
}

.html-editor-compact .html-editor-bar {
    padding: 5px 6px;
}

.html-editor-compact .html-ed-btn {
    padding: 3px 6px;
    font-size: 11.5px;
    min-width: 24px;
}

/* Session Undo / Redo & History Diff Drawer */
.undo-redo-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.hist-toggle-events {
    border: none;
    cursor: pointer;
    font: inherit;
}

.hist-toggle-events:hover {
    filter: brightness(0.95);
}

.hist-action-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.hist-events-row > td {
    background: var(--surface-subtle);
    padding: 10px 14px !important;
    white-space: normal !important;
}

.hist-events-drawer {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hist-event-row {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hist-event-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12.5px;
}

.hist-event-meta .hist-revert-btn {
    margin-left: auto;
}

.hist-diff-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
}

.hist-diff-item {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px;
    line-height: 1.4;
}

.hist-diff-field {
    font-weight: 600;
    color: var(--text);
}

.hist-diff-old {
    background: var(--danger-soft);
    color: #991b1b;
    padding: 1px 6px;
    border-radius: 4px;
    max-width: 340px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hist-diff-arrow {
    color: var(--text-muted);
}

.hist-diff-new {
    background: var(--success-soft);
    color: #065f46;
    padding: 1px 6px;
    border-radius: 4px;
    max-width: 340px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Spreadsheet Cell Range Selection */
#prod-tbody.is-cell-selecting,
#prod-tbody.is-cell-selecting td {
    user-select: none;
    -webkit-user-select: none;
}

.data-table tbody td.cell-selected:not(.cell-editing),
.data-table tbody tr:hover td.cell-selected:not(.cell-editing),
.data-table tbody tr.row-staged td.cell-selected:not(.cell-editing),
.data-table tbody tr.row-staged:hover td.cell-selected:not(.cell-editing) {
    background: #e0e7ff;
    --sel-t: 0 0 0 transparent;
    --sel-r: 0 0 0 transparent;
    --sel-b: 0 0 0 transparent;
    --sel-l: 0 0 0 transparent;
    box-shadow: var(--sel-t), var(--sel-r), var(--sel-b), var(--sel-l);
}

.data-table tbody td.cell-selected.cell-sel-anchor:not(.cell-editing) {
    background: #eef2ff;
}

.data-table tbody td.cell-selected.cell-sel-top:not(.cell-editing) {
    --sel-t: inset 0 2px 0 0 var(--primary);
}

.data-table tbody td.cell-selected.cell-sel-right:not(.cell-editing) {
    --sel-r: inset -2px 0 0 0 var(--primary);
}

.data-table tbody td.cell-selected.cell-sel-bottom:not(.cell-editing) {
    --sel-b: inset 0 -2px 0 0 var(--primary);
}

.data-table tbody td.cell-selected.cell-sel-left:not(.cell-editing) {
    --sel-l: inset 2px 0 0 0 var(--primary);
}

.selection-chip {
    gap: 8px;
}

.selection-chip-copy {
    border: 1px solid #a5b4fc;
    background: #ffffff;
    color: var(--primary);
    font: inherit;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.2;
    padding: 2px 7px;
    border-radius: 999px;
    cursor: pointer;
}

.selection-chip-copy:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

/* Fixed-layout Products Table & Resizable Columns */
table.products-table {
    table-layout: fixed;
}

.products-table th {
    overflow: hidden;
    padding-right: 16px;
}

.products-table th .th-content {
    display: flex;
    align-items: center;
    min-width: 0;
    overflow: hidden;
}

.products-table th.sticky-col .th-content {
    display: flex;
}

.products-table th .th-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.products-table th .col-type-dot,
.products-table th .col-menu-caret {
    flex-shrink: 0;
}

.products-table td {
    max-width: none;
}

.products-table td.cell-editing .cell-inline-input {
    min-width: 0;
}

.col-resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 8px;
    cursor: col-resize;
    z-index: 2;
    touch-action: none;
}

.col-resize-handle::after {
    content: '';
    position: absolute;
    top: 6px;
    bottom: 6px;
    right: 2px;
    width: 2px;
    border-radius: 2px;
    background: transparent;
    transition: background 0.12s;
}

.products-table th:hover .col-resize-handle::after {
    background: #cbd5e1;
}

.col-resize-handle:hover::after,
.col-resize-handle.active::after {
    background: var(--primary);
}

body.is-col-resizing,
body.is-col-resizing .products-table th {
    cursor: col-resize !important;
    user-select: none;
    -webkit-user-select: none;
}

.products-table th.col-header-selected,
.products-table th.col-header-selected:hover {
    background: #e0e7ff;
    color: var(--primary);
    box-shadow: inset 0 -2px 0 0 var(--primary);
}

.products-table th.col-header-selected .col-menu-caret {
    opacity: 1;
    color: var(--primary);
}

body.is-col-header-selecting,
body.is-col-header-selecting .products-table th {
    user-select: none;
    -webkit-user-select: none;
}

/* Combined Staged Filter & Queue Split Pill */
.staged-split-pill {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    overflow: hidden;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.staged-split-main,
.staged-split-caret {
    border: none;
    background: transparent;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    line-height: 1.25;
}

.staged-split-main {
    padding: 6px 10px;
    gap: 5px;
}

.staged-split-caret {
    padding: 6px 8px;
    border-left: 1px solid var(--border);
    font-size: 10px;
    color: var(--text-muted);
}

.staged-split-main:hover:not(:disabled),
.staged-split-caret:hover:not(:disabled) {
    background: var(--surface-subtle);
}

.staged-split-pill.is-empty {
    background: var(--surface-subtle);
}

.staged-split-pill.is-empty .staged-split-main,
.staged-split-pill.is-empty .staged-split-caret {
    color: var(--text-muted);
    cursor: default;
}

.staged-split-pill.has-staged {
    border-color: #f59e0b;
    background: #fffbeb;
}

.staged-split-pill.has-staged .staged-split-main {
    color: #92400e;
    font-weight: 600;
}

.staged-split-pill.has-staged .staged-split-caret {
    border-left-color: #fde68a;
    color: #b45309;
}

.staged-split-pill.has-staged .staged-split-main:hover:not(:disabled),
.staged-split-pill.has-staged .staged-split-caret:hover:not(:disabled) {
    background: #fef3c7;
}

.staged-split-pill.is-active {
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.15);
}

.staged-split-pill.is-active .staged-split-main {
    color: var(--primary);
    font-weight: 600;
}

.staged-split-pill.is-active .staged-split-caret {
    border-left-color: #c7d2fe;
    color: var(--primary);
}

.staged-split-pill.is-active .staged-split-main:hover:not(:disabled),
.staged-split-pill.is-active .staged-split-caret:hover:not(:disabled) {
    background: #e0e7ff;
}

.col-menu-item.col-menu-danger {
    color: var(--danger);
}

.col-menu-item.col-menu-danger .col-menu-icon {
    color: var(--danger);
}

.col-menu-item.col-menu-danger:hover:not(:disabled) {
    background: var(--danger-soft);
    color: var(--danger);
}

.col-menu-item:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.col-menu-item:disabled:hover {
    background: transparent;
    color: var(--text);
}

/* Google Drive Graphic Cell Indicator & Focus Preview */
.cell-graphic-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    min-width: 0;
    vertical-align: middle;
}

.cell-graphic-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 19px;
    height: 19px;
    border-radius: 5px;
    flex-shrink: 0;
}

.cell-graphic-found {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.cell-graphic-missing {
    background: #f1f5f9;
    color: #94a3b8;
    border: 1px solid #e2e8f0;
}

.cell-graphic-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.graphic-preview-popover {
    position: fixed;
    z-index: 94;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    width: 310px;
}

.graphic-preview-head {
    padding: 9px 11px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-subtle);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.graphic-preview-titles {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 2px;
}

.graphic-preview-kicker {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.graphic-preview-filename {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.graphic-preview-subpath {
    font-size: 11px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.graphic-preview-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.graphic-preview-body {
    padding: 10px;
}

.graphic-preview-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 130px;
    max-height: 230px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background-color: #f8fafc;
    background-image:
        linear-gradient(45deg, #eef2f7 25%, transparent 25%),
        linear-gradient(-45deg, #eef2f7 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #eef2f7 75%),
        linear-gradient(-45deg, transparent 75%, #eef2f7 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    overflow: hidden;
    padding: 6px;
}

.graphic-preview-img {
    display: block;
    max-width: 100%;
    max-height: 214px;
    object-fit: contain;
    cursor: zoom-in;
    border-radius: 4px;
}

.graphic-preview-loading {
    font-size: 12.5px;
    color: var(--text-muted);
    padding: 20px 12px;
    text-align: center;
}

.graphic-preview-empty {
    font-size: 12.5px;
    color: var(--text-muted);
    padding: 10px 6px;
    line-height: 1.45;
}

.graphic-preview-error {
    color: var(--danger);
}

.graphic-lightbox {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.graphic-lightbox-meta {
    font-size: 12.5px;
    color: var(--text-muted);
}

.graphic-lightbox-frame {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 260px;
    max-height: 68vh;
    padding: 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #f8fafc;
    overflow: auto;
}

.graphic-lightbox-frame img {
    max-width: 100%;
    max-height: 62vh;
    object-fit: contain;
}

.graphic-lightbox-backdrop {
    z-index: 90;
}

.modal-graphic-preview {
    margin-top: 6px;
}

.modal-graphic-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-subtle);
    overflow: hidden;
}

.modal-graphic-stage {
    width: 100%;
    border: none;
    cursor: zoom-in;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 150px;
    padding: 8px;
    background-color: #f8fafc;
    background-image:
        linear-gradient(45deg, #eef2f7 25%, transparent 25%),
        linear-gradient(-45deg, #eef2f7 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #eef2f7 75%),
        linear-gradient(-45deg, transparent 75%, #eef2f7 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.modal-graphic-img {
    max-width: 100%;
    max-height: 134px;
    object-fit: contain;
    border-radius: 4px;
}

.modal-graphic-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.modal-graphic-path {
    font-size: 11.5px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-graphic-btns {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.modal-graphic-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    padding: 7px 10px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    background: var(--surface-subtle);
}

/* Modal Colored Label Picker */
.modal-label-wrap {
    position: relative;
}

.modal-label-btn {
    width: 100%;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font: inherit;
    text-align: left;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.modal-label-btn:hover {
    border-color: #cbd5e1;
}

.modal-label-btn:focus,
.modal-label-btn[aria-expanded="true"] {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.modal-label-pills {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.modal-label-caret {
    color: var(--text-muted);
    font-size: 11px;
    flex-shrink: 0;
}

/* Catalogue JSON Export / Import Modal */
.catjson-actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.catjson-import-box {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-subtle);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.catjson-options-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 14px;
}

.catjson-options-row .form-field {
    flex: 1;
    min-width: 260px;
}

.catjson-allow-create {
    margin-bottom: 2px;
}

.catjson-upload-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.catjson-paste-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.catjson-paste-wrap textarea {
    width: 100%;
    font-size: 12px;
    resize: vertical;
}

.catjson-paste-actions {
    display: flex;
    justify-content: flex-end;
}

.catjson-preview {
    margin-top: 16px;
}

.catjson-valid-banner {
    background: var(--success-soft);
    border: 1px solid #a7f3d0;
    color: var(--success);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 10px;
}

.catjson-summary-table {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.catjson-error-list {
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    background: #fff;
}

.catjson-error-item {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid #fee2e2;
    font-size: 12.5px;
    color: #7f1d1d;
}

.catjson-error-item:last-child {
    border-bottom: none;
}

.catjson-error-path {
    font-weight: 600;
    color: #991b1b;
}

/* Edit Product Modal — JSON Tab */
.pm-json-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.pm-json-toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pm-json-editor {
    width: 100%;
    min-height: 360px;
    max-height: 55vh;
    padding: 12px;
    font-size: 12.5px;
    line-height: 1.5;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #f8fafc;
    color: var(--text);
    resize: vertical;
    tab-size: 2;
}

.pm-json-editor:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.pm-json-errors {
    margin-top: 10px;
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    background: #fff;
}

/* Search Box + Category Tree Picker + Filter Menu */
.search-tree-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.toolbar-tree-btn,
.toolbar-filter-btn {
    height: 34px;
    padding: 0 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.toolbar-tree-btn {
    min-width: 34px;
    border: 1px solid #c7d2fe;
    background: var(--primary-soft);
    color: var(--primary);
}

.toolbar-tree-btn:hover,
.toolbar-tree-btn.is-open {
    background: #e0e7ff;
    color: var(--primary-hover);
    border-color: #a5b4fc;
}

.toolbar-tree-btn.is-active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.toolbar-tree-btn.is-active:hover,
.toolbar-tree-btn.is-active.is-open {
    background: var(--primary-hover);
    color: #fff;
    border-color: var(--primary-hover);
}

.toolbar-filter-btn {
    min-width: 34px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-muted);
}

.toolbar-filter-btn:hover,
.toolbar-filter-btn.is-open {
    background: var(--surface-subtle);
    color: var(--primary);
    border-color: #a5b4fc;
}

.toolbar-filter-btn.is-active {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: #c7d2fe;
}

.toolbar-filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.filter-menu-heading {
    padding: 5px 10px 3px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.toolbar-timeline-btn {
    background: var(--primary-soft);
    border-color: #c7d2fe;
    color: var(--primary);
    gap: 6px;
    white-space: nowrap;
}

.toolbar-timeline-btn:hover {
    background: #e0e7ff;
    border-color: #a5b4fc;
    color: var(--primary-hover);
}

@media (max-width: 1080px) {
    .toolbar-timeline-btn {
        padding: 5px 8px;
        min-width: 32px;
        gap: 0;
    }

    .toolbar-timeline-btn .timeline-btn-label {
        display: none;
    }
}

.category-tree-popover {
    position: fixed;
    z-index: 95;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: 460px;
}

.cat-tree-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 12px 6px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-subtle);
}

.cat-tree-title {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text);
}

.cat-tree-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cat-tree-close-btn {
    font-size: 18px;
    padding: 2px 6px;
}

.cat-tree-search-wrap {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
}

.cat-tree-search {
    width: 100%;
    font-size: 12.5px;
    padding: 6px 9px;
}

.cat-tree-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-subtle);
}

.cat-tree-ctrl-btn {
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    border-radius: 5px;
    padding: 2px 8px;
    font: inherit;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.12s, color 0.12s, border-color 0.12s;
}

.cat-tree-ctrl-btn:hover:not(:disabled) {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: #c7d2fe;
}

.cat-tree-ctrl-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.cat-tree-list {
    overflow-y: auto;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    max-height: 320px;
}

.cat-tree-all-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 6px 10px;
    margin-bottom: 3px;
    border-radius: 6px;
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
}

.cat-tree-all-btn:hover {
    background: var(--surface-subtle);
    color: var(--primary);
}

.cat-tree-all-btn.is-selected {
    background: var(--primary-soft);
    color: var(--primary);
}

.cat-tree-row {
    display: flex;
    align-items: center;
    gap: 2px;
    border-radius: 6px;
}

.cat-tree-toggle {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.12s ease, background-color 0.12s ease, color 0.12s ease;
}

.cat-tree-toggle:hover {
    background: var(--surface-subtle);
    color: var(--text);
}

.cat-tree-toggle.is-expanded svg {
    transform: rotate(90deg);
}

.cat-tree-leaf-spacer {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
}

.cat-tree-item {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    text-align: left;
    border: none;
    background: transparent;
    padding: 5px 8px;
    border-radius: 6px;
    font: inherit;
    font-size: 12.5px;
    color: var(--text);
    cursor: pointer;
}

.cat-tree-item:hover {
    background: var(--surface-subtle);
    color: var(--primary);
}

.cat-tree-item.is-selected {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}

.cat-tree-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cat-tree-check {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 700;
}

.cat-tree-mark {
    background: #fef08a;
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
}

.cat-tree-empty {
    padding: 16px 10px;
    text-align: center;
    font-size: 12.5px;
}

/* Custom Column Tabs Bar */
.col-tabs-bar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 18px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.col-tab-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 29px;
    padding: 0 9px;
    border-radius: 7px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-muted);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.14s, color 0.14s, border-color 0.14s;
}

.col-tab-pill:hover {
    background: var(--surface-subtle);
    color: var(--text);
    border-color: #94a3b8;
}

.col-tab-pill.is-active {
    background: var(--primary-soft);
    border-color: #a5b4fc;
    color: var(--primary);
}

.col-tab-name {
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
    padding: 0;
    cursor: pointer;
    line-height: 1.2;
}

.col-tab-pill.is-active .col-tab-name {
    cursor: text;
}

.col-tab-pill.is-active .col-tab-name:hover {
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
}

.col-tab-pill .col-tab-count {
    font-size: 11px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #475569;
    line-height: 1.2;
}

.col-tab-pill.is-active .col-tab-count {
    background: #c7d2fe;
    color: var(--primary-hover);
}

.col-tab-edit-btn {
    border: none;
    background: transparent;
    color: inherit;
    opacity: 0.65;
    padding: 2px 3px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.12s, background-color 0.12s;
}

.col-tab-edit-btn:hover {
    opacity: 1;
    background: rgba(79, 70, 229, 0.12);
}

.col-tab-rename-input {
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--primary);
    border-radius: 4px;
    padding: 1px 6px !important;
    height: 22px;
    min-width: 76px;
    max-width: 220px;
}

.col-tab-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: 1px dashed var(--border-strong);
    background: transparent;
    color: var(--text-muted);
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.14s, color 0.14s, border-color 0.14s;
}

.col-tab-add-btn:hover {
    background: var(--primary-soft);
    border-color: #a5b4fc;
    color: var(--primary);
}

/* Column Tab Picker Modal */
.col-tab-modal-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.col-tab-picker-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.col-tab-filter-input {
    flex: 1;
    min-width: 200px;
    font-size: 13px;
}

.col-tab-quick-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.col-tab-count {
    font-size: 12px;
    margin-left: 4px;
}

.col-tab-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
    gap: 6px;
    max-height: 46vh;
    overflow-y: auto;
    padding: 4px 2px;
}

.col-tab-option {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 500;
    user-select: none;
    transition: border-color 0.12s, background-color 0.12s;
}

.col-tab-option:hover {
    background: var(--surface-subtle);
    border-color: #cbd5e1;
}

.col-tab-option.is-checked {
    background: var(--primary-soft);
    border-color: #c7d2fe;
    color: var(--text);
}

.col-tab-option-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.col-tab-role-dot {
    flex-shrink: 0;
    width: 7px;
    height: 7px;
    border-radius: 999px;
}

.col-tab-role-direct { background: var(--success); }
.col-tab-role-derived { background: var(--primary); }
.col-tab-role-gate { background: var(--amber); }
.col-tab-role-internal { background: #cbd5e1; }

/* WPC Product Bundle (woosb) Editor inside Product Modal */
.bundle-banner-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.bundle-summary-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.bundle-stat {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-subtle);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.bundle-stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    font-weight: 600;
}

.bundle-stat-val {
    font-size: 15px;
    color: var(--text);
}

.bundle-picker-box {
    margin-bottom: 12px;
}

.bundle-picker-box label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text);
}

.bundle-search-wrap {
    position: relative;
}

.bundle-search-wrap input {
    width: 100%;
    padding: 8px 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.bundle-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 30;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.14);
    max-height: 240px;
    overflow-y: auto;
}

.bundle-search-item {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    text-align: left;
    cursor: pointer;
    font-size: 12.5px;
}

.bundle-search-item:last-child {
    border-bottom: 0;
}

.bundle-search-item:hover {
    background: var(--surface-subtle);
}

.bundle-search-item > div:first-child {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.bundle-search-item > div:first-child span {
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bundle-search-item-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.bundle-search-empty {
    padding: 12px;
    text-align: center;
    font-size: 12.5px;
}

.bundle-items-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin-bottom: 14px;
}

.bundle-items-table {
    margin: 0;
    font-size: 12.5px;
}

.bundle-items-table td,
.bundle-items-table th {
    padding: 7px 8px;
    vertical-align: middle;
}

.bundle-order-btns {
    display: flex;
    gap: 2px;
}

.bundle-item-title {
    font-weight: 600;
    color: var(--text);
}

.bundle-item-meta {
    font-size: 11.5px;
    color: var(--muted);
}

.bundle-num-input {
    width: 62px;
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12.5px;
}

.bundle-settings-details {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    background: var(--surface-subtle);
}

.bundle-settings-details summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    user-select: none;
}

.bundle-settings-grid {
    margin-top: 12px;
}

#pm-bundle-tab-count {
    margin-left: 5px;
    font-size: 11px;
    padding: 1px 6px;
}

/* Button Loading Spinner & WooCommerce Sync Progress */
@keyframes lvw-spin {
    to { transform: rotate(360deg); }
}

.btn-spinner {
    display: inline-block;
    width: 13px;
    height: 13px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: -2px;
    animation: lvw-spin 0.65s linear infinite;
}

.btn .btn-spinner {
    flex-shrink: 0;
}

.woo-sync-progress {
    background: var(--primary-soft);
    border: 1px solid #c7d2fe;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 12px;
}

.woo-sync-progress-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 7px;
}

.woo-progress-track {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: #e0e7ff;
    overflow: hidden;
}

.woo-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--primary);
    transition: width 0.2s ease;
}

.woo-help-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.woo-help-step {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    background: var(--surface-subtle);
}

.woo-help-step h4 {
    margin: 0 0 5px;
    font-size: 13.5px;
    color: var(--text);
}

.woo-help-step p,
.woo-help-step ul {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
}

.woo-help-step ul {
    padding-left: 18px;
    margin-top: 4px;
}
