:root {
    --sidebar-w: 258px;
    --bg: #f5f3fb;
    --panel: #ffffff;
    --line: #e8e3f5;
    --text: #1e1233;
    --muted: #6b5f80;
    --brand: #6d28d9;
    --brand-dark: #5b21b6;
    --brand-soft: #f5f3ff;
    --danger: #b91c1c;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "DM Sans", "Segoe UI", Tahoma, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

.admin-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #2e1065, #1a0638);
    color: #e5e0f5;
    padding: 18px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar .brand {
    font-size: 1.2rem;
    font-weight: 700;
    padding: 6px 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    margin-bottom: 14px;
}

.sidebar .brand span {
    display: block;
    font-size: .7rem;
    font-weight: 400;
    color: #b9aee0;
    letter-spacing: .18em;
    text-transform: uppercase;
    margin-top: 4px;
}

.nav-group {
    margin-bottom: 14px;
}

.nav-group h6 {
    margin: 0 12px 8px;
    font-size: .68rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #a99fd0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 9px;
    color: #d7d0ef;
    margin-bottom: 2px;
    font-size: .92rem;
    transition: background .15s, color .15s;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, .1);
    color: #fff;
}

.nav-link.active {
    box-shadow: inset 3px 0 0 var(--brand);
}

/* Catalog setup sequence strip */
.admin-setup-steps {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 16px;
}

.admin-setup-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 10px;
}

.admin-setup-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.admin-setup-list li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.admin-setup-list li a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: inherit;
}

.admin-setup-list li .n {
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    color: var(--brand);
    font-size: 11px;
    font-weight: 800;
}

.admin-setup-list li.is-current {
    background: var(--brand);
    color: #fff;
}

.admin-setup-list li.is-current .n {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.admin-setup-list li small {
    display: none;
    font-weight: 500;
    opacity: 0.85;
}

@media (min-width: 1100px) {
    .admin-setup-list li small {
        display: inline;
        margin-left: 2px;
    }
}

.main {
    flex: 1;
    min-width: 0;
}

.topbar {
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar h1 {
    margin: 0;
    font-size: 1.25rem;
}

.topbar .who {
    color: var(--muted);
    font-size: .85rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.content {
    padding: 22px 24px 48px;
}

.cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.card-stat,
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.card-stat {
    padding: 18px;
}

.card-stat .label {
    color: var(--muted);
    font-size: .82rem;
}

.card-stat .value {
    font-size: 1.6rem;
    font-weight: 700;
    margin-top: 6px;
}

.panel {
    padding: 18px;
    /* margin-bottom: 16px; */
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.panel-header h2 {
    margin: 0;
    font-size: 1.05rem;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.btn {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    border-radius: 9px;
    padding: 9px 14px;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform .12s, box-shadow .12s, background .15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.btn-primary:hover {
    background: var(--brand-dark);
}

.btn-danger {
    color: var(--danger);
    border-color: #fecaca;
    background: #fef2f2;
}

.input,
.select {
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 9px 10px;
    font-size: .875rem;
    background: #fff;
    min-width: 180px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

th,
td {
    padding: 11px 8px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-weight: 700;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

tr:hover td {
    background: var(--brand-soft);
}

tr.drag-row {
    transition: opacity .15s;
}

tr.drag-over td {
    background: #ede9fe;
    box-shadow: inset 0 -2px 0 var(--brand);
}

.drag-card {
    transition: opacity .15s;
}

.drag-card.drag-over {
    box-shadow: inset 0 -2px 0 var(--brand);
    background: #ede9fe;
}

.drag-handle {
    font-size: 16px;
    user-select: none;
}

.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
}

.badge-ok {
    background: #d1fae5;
    color: #065f46;
}

.badge-warn {
    background: #ffedd5;
    color: #9a3412;
}

.badge-mute {
    background: #f3f0fb;
    color: #5b21b6;
}

.badge-info {
    background: #e0f2fe;
    color: #075985;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.form-grid .full {
    grid-column: 1 / -1;
}

.field {
    margin-bottom: 4px;
}

.field label {
    display: block;
    font-size: .8rem;
    color: var(--muted);
    margin-bottom: 5px;
    font-weight: 600;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 10px;
    font: inherit;
    background: #fff;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(109, 40, 217, .12);
}

.field textarea {
    min-height: 90px;
    resize: vertical;
}

.rich-editor {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 9px;
}

.rich-editor .ql-toolbar {
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 9px 9px 0 0;
}

.rich-editor .ql-container {
    border: 0;
    min-height: 220px;
    font: inherit;
}

.rich-editor .ql-editor {
    min-height: 220px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.hint {
    font-size: .78rem;
    color: var(--muted);
    margin-top: 4px;
}

.field label.check,
label.check {
    display: inline-flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    margin-bottom: 0;
    font-size: 15px;
    font-weight: 500;
    color: #4a4a68;
    cursor: pointer;
    user-select: none;
    width: auto;
}

.field input[type="checkbox"],
.check input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px !important;
    height: 18px;
    margin: 0;
    padding: 0;
    flex: 0 0 18px;
    border: 1.5px solid #c5c9d4;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    box-shadow: none;
    display: inline-grid;
    place-content: center;
}

.field input[type="checkbox"]:focus,
.check input[type="checkbox"]:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .18);
}

.field input[type="checkbox"]:checked,
.check input[type="checkbox"]:checked {
    background: #2563eb;
    border-color: #2563eb;
}

.field input[type="checkbox"]:checked::after,
.check input[type="checkbox"]:checked::after {
    content: "";
    width: 10px;
    height: 6px;
    border: 2px solid #fff;
    border-top: 0;
    border-right: 0;
    transform: rotate(-45deg) translate(1px, -1px);
}

.sku-display {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--brand-dark);
    background: var(--brand-soft);
    border: 1px dashed var(--brand);
    border-radius: 9px;
    padding: 10px 12px;
}

.sku-display.sku-pending {
    font-weight: 500;
    letter-spacing: 0;
    color: var(--muted);
    border-style: solid;
    border-color: var(--line);
    background: #faf9fc;
    font-family: inherit;
}

.split {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 16px;
    align-items: start;
}

.thumb {
    width: 46px;
    height: 46px;
    border-radius: 8px;
    background: #ece7f8;
    object-fit: cover;
    display: inline-block;
}

.actions {
    /* display: flex; */
    justify-content: flex-end;
    align-items: center;
    white-space: nowrap;
    vertical-align: middle;
}

/* Table action buttons — matches list Edit / Del style */
.btn-sm {
    padding: 6px 12px;
    font-size: .8rem;
    font-weight: 600;
    border-radius: 9px;
    line-height: 1.2;
}

.btn-sm:not(.btn-primary):not(.btn-danger) {
    background: #fff;
    border: 1px solid var(--line);
    color: var(--text);
}

.btn-sm:not(.btn-primary):not(.btn-danger):hover {
    background: var(--brand-soft);
    border-color: #ddd6fe;
}

.btn-sm.btn-danger {
    color: var(--danger);
    border: 1px solid #fecaca;
    background: #fef2f2;
    padding: 6px 12px;
}

.btn-sm.btn-danger:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

/* Actions dropdown */
.admin-actions-dropdown {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.admin-actions-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    min-width: 0;
    padding: 0;
}

.admin-actions-icon {
    display: block;
    flex-shrink: 0;
}

.admin-actions-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 156px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(91, 33, 182, 0.14);
    padding: 6px;
    z-index: 30;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .15s ease, transform .15s ease, visibility .15s;
}

.admin-actions-dropdown.is-open .admin-actions-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.admin-actions-dropdown.drop-up .admin-actions-menu {
    top: auto;
    bottom: calc(100% + 6px);
    transform: translateY(6px);
}

.admin-actions-dropdown.drop-up.is-open .admin-actions-menu {
    transform: translateY(0);
}

.admin-actions-item {
    display: flex;
    align-items: center;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    border: 0;
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .12s;
}

.admin-actions-item:hover,
.admin-actions-item:focus-visible {
    background: var(--brand-soft);
    outline: none;
}

.admin-actions-item.is-danger {
    color: var(--danger);
}

.admin-actions-item.is-danger:hover,
.admin-actions-item.is-danger:focus-visible {
    background: #fef2f2;
}

.admin-actions-form {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--line);
    margin-top: 4px;
    padding-top: 4px;
}

.table-wrap {
    overflow-x: auto;
    overflow-y: visible;
    height: calc(100vh - 320px);
}

td.actions {
    overflow: visible;
    position: relative;
}

.alert {
    border-radius: 9px;
    padding: 11px 14px;
    font-size: .86rem;
    margin-bottom: 14px;
}

.alert-ok {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.alert-err {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.alert-info {
    background: #f5f3ff;
    border: 1px solid #ddd6fe;
    color: #5b21b6;
    word-break: break-all;
}

/* ─── Admin toasts ───────────────────────────────────────── */
.admin-toast-wrap {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 4000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(380px, calc(100vw - 32px));
    pointer-events: none;
}

.admin-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-left-width: 4px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
    font-size: 0.88rem;
    font-weight: 600;
    color: #0f172a;
    animation: adminToastIn 0.3s ease;
}

.admin-toast--success {
    border-left-color: #059669;
}

.admin-toast--error {
    border-left-color: #dc2626;
}

.admin-toast-icon {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    color: #fff;
}

.admin-toast--success .admin-toast-icon {
    background: #059669;
}

.admin-toast--error .admin-toast-icon {
    background: #dc2626;
}

.admin-toast-msg {
    flex: 1 1 auto;
    padding-top: 1px;
    line-height: 1.35;
    word-break: break-word;
}

.admin-toast-close {
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    color: #94a3b8;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}

.admin-toast-close:hover {
    color: #475569;
}

.admin-toast.is-leaving {
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

@keyframes adminToastIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 720px) {
    .admin-toast-wrap {
        top: 12px;
        right: 12px;
        left: 12px;
        max-width: none;
    }
}

.pager {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 16px;
    align-items: center;
}

.pager a {
    padding: 7px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    font-weight: 600;
    font-size: .85rem;
    text-decoration: none;
    color: var(--text);
}

.pager a.active {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

.pager-nav {
    min-width: 72px;
    text-align: center;
}

.pager-ellipsis {
    padding: 7px 6px;
    color: var(--muted);
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.media-item {
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    position: relative;
}

.media-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
    background: #ece7f8;
}

.media-item video.media-thumb-video {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
    background: #000;
    pointer-events: none;
}

.media-item .media-thumb-play {
    position: absolute;
    left: 50%;
    top: 75px;
    transform: translate(-50%, -50%);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    color: var(--purple-600);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
    pointer-events: none;
}

.media-item .media-thumb-play .pdp-video-play-icon {
    border-width: 8px 0 8px 14px;
    margin-left: 3px;
}

.pdp-video-play-icon {
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 0 8px 14px;
    border-color: transparent transparent transparent currentColor;
    margin-left: 3px;
}

.media-item .cap {
    padding: 8px 10px;
    font-size: .75rem;
    color: var(--muted);
}

/* Auth (login/forgot/reset) */
.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: radial-gradient(circle at top right, rgba(167, 139, 250, .35), transparent 42%), radial-gradient(circle at bottom left, rgba(109, 40, 217, .16), transparent 45%), var(--bg);
}

.auth-box {
    width: min(420px, 100%);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 34px 30px;
    box-shadow: 0 20px 50px rgba(91, 33, 182, .18);
}

.auth-box .logo {
    text-align: center;
    margin-bottom: 6px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand-dark);
}

.auth-box .sub {
    text-align: center;
    color: var(--muted);
    font-size: .88rem;
    margin-bottom: 22px;
}

.otp-input {
    text-align: center;
    letter-spacing: .4em;
    font-size: 1.35rem;
    font-weight: 700;
}

@media (max-width: 1100px) {
    .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .split,
    .form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 860px) {
    .admin-shell {
        display: block;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        padding: 14px 16px;
    }

    .topbar h1 {
        font-size: 1.1rem;
    }

    .content {
        padding: 16px 14px 40px;
    }

    .panel {
        padding: 14px;
    }

    .admin-panel-header {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-panel-header .btn {
        width: 100%;
        justify-content: center;
    }

    .admin-table-desktop {
        display: none;
    }

    .admin-mobile-cards {
        display: flex;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }

    td.actions .btn-sm,
    td.actions form {
        display: inline-flex;
    }
}

@media (min-width: 861px) {
    .admin-mobile-cards {
        display: none;
    }
}

.admin-mobile-cards {
    display: none;
    flex-direction: column;
    gap: 12px;
}

.admin-mobile-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    background: #fff;
}

.admin-mobile-card-head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
}

.admin-mobile-card-icon {
    font-size: 1.4rem;
    line-height: 1;
    flex-shrink: 0;
}

.admin-mobile-card-title {
    flex: 1;
    min-width: 0;
}

.admin-mobile-card-title strong {
    display: block;
    margin-bottom: 2px;
    word-break: break-word;
}

.admin-mobile-card-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
    margin: 0 0 14px;
}

.admin-mobile-card-meta dt {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    margin-bottom: 3px;
}

.admin-mobile-card-meta dd {
    margin: 0;
    font-size: .875rem;
    font-weight: 600;
}

.admin-mobile-card-actions {
    display: flex;
    gap: 8px;
}

.admin-mobile-card-actions form {
    margin: 0;
    flex: 1;
}

.admin-mobile-card-actions .btn {
    flex: 1;
    justify-content: center;
}

.admin-category-page .admin-mobile-card-actions .btn-danger {
    width: 100%;
}

.swatch {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, .15);
    display: inline-block;
    vertical-align: middle;
}

.chip-pick {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    padding: 6px 0;
}

.chip-pick .check {
    margin: 0;
}

.check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px 12px;
    padding: 6px 0;
}

.check-grid .check {
    margin: 0;
    font-size: .85rem;
}

/* ─── Page loader ─────────────────────────────────────────── */
.admin-page-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    background: rgba(245, 243, 251, 0.72);
    backdrop-filter: blur(3px);
}

.admin-page-loader[hidden] {
    display: none !important;
}

.admin-loader-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 22px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(91, 33, 182, 0.14);
    font-weight: 600;
    font-size: .92rem;
}

.admin-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e9e0ff;
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: adminSpin .75s linear infinite;
}

.admin-btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: adminSpin .75s linear infinite;
    vertical-align: -2px;
    margin-right: 6px;
}

@keyframes adminSpin {
    to {
        transform: rotate(360deg);
    }
}

.btn.is-loading {
    opacity: .88;
    pointer-events: none;
}

/* ─── Off-canvas form panel ───────────────────────────────── */
.admin-offcanvas-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(30, 18, 51, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
    z-index: 1040;
}

.admin-offcanvas {
    position: fixed;
    top: 0;
    right: 0;
    width: min(520px, 100vw);
    height: 100vh;
    background: var(--panel);
    border-left: 1px solid var(--line);
    box-shadow: -12px 0 40px rgba(30, 18, 51, 0.12);
    transform: translateX(100%);
    transition: transform .28s ease;
    z-index: 1050;
    display: flex;
    flex-direction: column;
}

.admin-offcanvas.is-open {
    transform: translateX(0);
}

.admin-offcanvas.is-open+.admin-offcanvas-backdrop,
body.admin-canvas-open .admin-offcanvas-backdrop {
    opacity: 1;
    pointer-events: auto;
}

.admin-offcanvas-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.admin-offcanvas-head h2 {
    margin: 0;
    font-size: 1.05rem;
}

.admin-offcanvas-close {
    border: 1px solid var(--line);
    background: #fff;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    color: var(--muted);
}

.admin-offcanvas-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
}

.admin-list-only .split {
    grid-template-columns: 1fr;
}

.admin-form-page {
    max-width: 920px;
}

.admin-form-page .panel {
    margin-bottom: 0;
}

.admin-canvas-source {
    display: none !important;
}

/* ─── Admin error page ───────────────────────────────────── */
.admin-error-panel {
    max-width: 560px;
    margin: 40px auto;
    text-align: center;
}

.admin-error-inner {
    padding: 12px 8px 4px;
}

.admin-error-icon {
    font-size: 48px;
    line-height: 1;
    margin-bottom: 8px;
}

.admin-error-code {
    font-size: 56px;
    font-weight: 700;
    color: var(--brand);
    margin: 0 0 8px;
    line-height: 1;
}

.admin-error-title {
    margin: 0 0 12px;
    font-size: 1.35rem;
}

.admin-error-message {
    color: var(--muted);
    margin: 0 0 10px;
    font-size: 1rem;
}

.admin-error-detail {
    color: var(--muted);
    margin: 0;
    font-size: .92rem;
    line-height: 1.55;
}

/* Featured product picker (homepage sections) */
.featured-picker-bar {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.featured-picker-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.featured-selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.featured-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand-dark);
    font-size: .75rem;
    font-weight: 600;
}

.featured-canvas-search {
    margin-bottom: 10px;
}

.featured-canvas-search .input {
    width: 100%;
    min-width: 0;
}

.featured-canvas-hint {
    margin: 0 0 10px;
}

.featured-product-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: min(60vh, 420px);
    overflow-y: auto;
}

.featured-product-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    cursor: pointer;
    transition: background .12s, border-color .12s;
}

.featured-product-row:hover {
    background: var(--brand-soft);
    border-color: #ddd6fe;
}

.featured-product-row.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.featured-product-row.is-disabled:hover {
    background: #fff;
    border-color: var(--line);
}

.featured-product-row input {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    accent-color: var(--brand);
}

.featured-product-thumb {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #ece7f8;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    font-size: 1rem;
}

.featured-product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.featured-product-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.featured-product-info strong {
    font-size: .85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.featured-product-info .hint {
    font-size: .72rem;
}
/* Nested category tree */
.cat-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin: 0 0 16px;
    padding: 12px 14px;
    background: var(--surface-2, #f8fafc);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
}
.cat-toolbar-search {
    flex: 1 1 220px;
    min-width: 180px;
}
.cat-toolbar-search input {
    width: 100%;
    margin: 0;
}
.cat-toolbar select {
    min-width: 140px;
    margin: 0;
}
.cat-toolbar-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.cat-toolbar-count {
    margin-left: auto;
    white-space: nowrap;
}
.cat-name-cell {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.cat-toggle {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 4px;
    background: #fff;
    color: var(--muted);
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
}
.cat-toggle:hover {
    border-color: var(--brand);
    color: var(--brand);
}
.cat-toggle-spacer {
    display: inline-block;
    width: 22px;
    flex-shrink: 0;
}
.cat-branch {
    color: var(--muted);
    font-weight: 700;
    line-height: 1.4;
}
.cat-icon {
    flex-shrink: 0;
}
.cat-row.cat-match .cat-label,
.cat-card.cat-match .cat-label {
    background: #fef3c7;
    box-decoration-break: clone;
    border-radius: 3px;
    padding: 0 2px;
}
.cat-row.cat-dim,
.cat-card.cat-dim {
    opacity: 0.55;
}
.cat-empty-msg {
    padding: 16px 0;
}
.cat-tree-table .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}
@media (max-width: 899px) {
    .cat-toolbar-count {
        margin-left: 0;
        width: 100%;
    }
}
.cat-parent-select {
    width: 100%;
    min-height: 180px;
    font-family: inherit;
}
#cat_parent_filter {
    margin-bottom: 8px;
}

/* Searchable select (search inside dropdown) */
.ss-select {
    position: relative;
    width: 100%;
    z-index: 1;
}
.ss-select.is-open {
    z-index: 50;
}
.admin-form-page .field:has(.ss-select) {
    overflow: visible;
}
.admin-form-page .panel:has(.ss-select.is-open) {
    overflow: visible;
}
.ss-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    background: #fff;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.ss-trigger:hover,
.ss-select.is-open .ss-trigger {
    border-color: var(--brand);
}
.ss-trigger-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ss-chevron {
    color: var(--muted);
    font-size: 0.85rem;
    flex-shrink: 0;
}
.ss-select.is-open .ss-chevron {
    transform: rotate(180deg);
}
.ss-panel {
    position: absolute;
    z-index: 80;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    background: #fff;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
    overflow: hidden;
}
.ss-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border, #e2e8f0);
    background: var(--surface-2, #f8fafc);
}
.ss-search-wrap .bi-search {
    color: var(--muted);
    font-size: 0.9rem;
}
.ss-search {
    flex: 1;
    width: auto !important;
    min-width: 0;
    margin: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none;
    padding: 4px 0 !important;
    min-height: 28px;
}
.ss-panel[hidden] {
    display: none !important;
}
.ss-list {
    list-style: none;
    margin: 0;
    padding: 6px;
    max-height: 260px;
    overflow: auto;
}
.ss-option {
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.92rem;
}
.ss-option.ss-hide,
.ss-empty-msg.ss-hide {
    display: none !important;
}
.ss-option:hover,
.ss-option:focus {
    background: var(--brand-soft, #ede9fe);
    outline: none;
}
.ss-option.is-selected {
    background: var(--brand-soft, #ede9fe);
    color: var(--brand);
    font-weight: 600;
}
.ss-empty-msg {
    padding: 12px 10px;
    color: var(--muted);
    font-size: 0.85rem;
}

/* Dynamic icon picker (Font Awesome + image URL + color) */
.icon-picker-field {
    grid-column: 1 / -1;
}
.icon-picker-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}
.icon-picker-preview {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    background: #faf9fc;
    font-size: 1.25rem;
    flex-shrink: 0;
    overflow: hidden;
    color: var(--icon-color, #5b21b6);
}
.icon-picker-preview img {
    width: 26px;
    height: 26px;
    object-fit: contain;
}
.icon-picker-preview i {
    color: inherit;
}
.icon-picker-input {
    flex: 1;
    margin: 0 !important;
}
.icon-picker-color-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0 4px;
    flex-wrap: wrap;
}
.icon-picker-color-row label {
    margin: 0;
    font-size: 13px;
}
.icon-picker-color-row input[type="color"] {
    width: 36px;
    height: 32px;
    padding: 2px;
    border: 1px solid var(--border, #ddd);
    border-radius: 8px;
    cursor: pointer;
}
.icon-picker-color-input {
    flex: 1;
    min-width: 140px;
    margin: 0 !important;
}
.icon-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 6px;
    max-height: 180px;
    overflow: auto;
    padding: 8px;
    margin-top: 8px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    background: #faf9fc;
    color: var(--icon-color, #5b21b6);
}
.icon-picker-opt {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    color: inherit;
    padding: 0;
}
.icon-picker-opt:hover,
.icon-picker-opt.is-active {
    border-color: var(--icon-color, #7c3aed);
    background: color-mix(in srgb, var(--icon-color, #7c3aed) 12%, #fff);
}
.icon-picker-opt i {
    font-size: 1.05rem;
}
.admin-mobile-card-icon .dyn-icon,
.cat-icon .dyn-icon {
    font-size: 1.15em;
    line-height: 1;
    color: inherit;
}
.admin-mobile-card-icon,
.cat-icon {
    color: var(--icon-color, inherit);
}
