:root {
    --cx-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

    --cx-bg: #f2f4fb;
    --cx-surface: #ffffff;
    --cx-text: #1c2333;
    --cx-muted: #7c8494;
    --cx-border: #e7e9f2;

    --cx-primary: #4f5bd5;
    --cx-primary-dark: #3c46b8;
    --cx-primary-soft: #eef0fd;

    --cx-sidebar-from: #1b1f3b;
    --cx-sidebar-to: #2d2f6b;
    --cx-sidebar-text: #b7bce0;
    --cx-sidebar-text-active: #ffffff;

    --cx-success: #1fa971;
    --cx-warning: #e2a13a;
    --cx-danger: #e0526a;

    --cx-radius: 14px;
    --cx-radius-sm: 10px;
    --cx-shadow: 0 8px 24px rgba(29, 33, 70, 0.06);
    --cx-shadow-lg: 0 20px 45px rgba(29, 33, 70, 0.16);
}
body {
    font-family: var(--cx-font);
    background: var(--cx-bg);
    color: var(--cx-text);
}

a {
    text-decoration: none;
}

.btn {
    border-radius: var(--cx-radius-sm);
}

.btn-primary {
    background: var(--cx-primary);
    border-color: var(--cx-primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--cx-primary-dark);
    border-color: var(--cx-primary-dark);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--cx-primary);
    box-shadow: 0 0 0 0.2rem rgba(79, 91, 213, 0.15);
}

.page-link {
    color: var(--cx-primary);
}

.page-item.active .page-link {
    background: var(--cx-primary);
    border-color: var(--cx-primary);
}
.cx-shell {
    display: flex;
    min-height: 100vh;
}

.cx-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--cx-sidebar-from), var(--cx-sidebar-to));
    color: var(--cx-sidebar-text);
    padding: 20px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;

    /* Subtle scrollbar: hidden until you hover the sidebar or scroll it. */
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
    transition: scrollbar-color 0.2s ease;
}

.cx-sidebar:hover {
    scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

.cx-sidebar::-webkit-scrollbar {
    width: 8px;
}

.cx-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.cx-sidebar::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.cx-sidebar:hover::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.28);
}

.cx-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.45);
}

.cx-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20, 22, 48, 0.45);
    z-index: 15;
}

.cx-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-weight: 700;
    font-size: 1.15rem;
    padding: 8px 10px 24px;
    text-decoration: none;
}

.cx-sidebar__brand:hover {
    color: #fff;
    opacity: 0.9;
}

.cx-sidebar__brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
}

.cx-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.cx-topbar {
    height: 64px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 28px;
    background: var(--cx-surface);
    border-bottom: 1px solid var(--cx-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.cx-topbar__title {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.cx-topbar__toggle {
    border: none;
    background: none;
    font-size: 1.4rem;
    color: var(--cx-text);
}

.cx-content {
    padding: 28px;
    flex: 1;
}

@media (max-width: 991.98px) {
    .cx-sidebar {
        position: fixed;
        left: -280px;
        z-index: 20;
        transition: left 0.2s ease;
        box-shadow: var(--cx-shadow-lg);
    }

    .cx-sidebar.is-open {
        left: 0;
    }

    .cx-backdrop.is-visible {
        display: block;
    }
}

/* Global refined scrollbar for the rest of the app (light surfaces). */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(124, 132, 148, 0.35) transparent;
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: rgba(124, 132, 148, 0.28);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
    background: rgba(124, 132, 148, 0.5);
    background-clip: content-box;
}

/* The sidebar keeps its own (light-on-dark) rules above. */
.cx-sidebar {
    scrollbar-color: transparent transparent;
}
.cx-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cx-nav__group-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(183, 188, 224, 0.55);
    padding: 16px 10px 6px;
}

.cx-nav__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--cx-radius-sm);
    color: var(--cx-sidebar-text);
    font-size: 0.92rem;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}

.cx-nav__link i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
}

.cx-nav__link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--cx-sidebar-text-active);
}

.cx-nav__link.is-active {
    background: rgba(255, 255, 255, 0.12);
    color: var(--cx-sidebar-text-active);
}
.cx-card {
    background: var(--cx-surface);
    border: 1px solid var(--cx-border);
    border-radius: var(--cx-radius);
    box-shadow: var(--cx-shadow);
    margin-bottom: 24px;
    /* Clip inner content (tables, pagination footers) to the card's rounded
       corners so the last table row's bottom corners aren't square. */
    overflow: hidden;
}

.cx-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--cx-border);
}

.cx-card__header h2 {
    font-size: 1.02rem;
    font-weight: 600;
    margin: 0;
}

.cx-card__body {
    padding: 22px;
}

.cx-stat {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--cx-surface);
    border: 1px solid var(--cx-border);
    border-radius: var(--cx-radius);
    box-shadow: var(--cx-shadow);
    padding: 18px 20px;
    height: 100%;
}

.cx-stat__icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #fff;
    background: var(--cx-primary);
    flex-shrink: 0;
}

.cx-stat--warning .cx-stat__icon { background: var(--cx-warning); }
.cx-stat--danger .cx-stat__icon { background: var(--cx-danger); }
.cx-stat--success .cx-stat__icon { background: var(--cx-success); }

.cx-stat__label {
    color: var(--cx-muted);
    font-size: 0.82rem;
    margin-bottom: 2px;
}

.cx-stat__value {
    font-size: 1.35rem;
    font-weight: 700;
}

.cx-timeline-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cx-primary-soft);
    color: var(--cx-primary);
    font-size: 1rem;
}
.cx-user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--cx-primary-soft);
    border: none;
    border-radius: 999px;
    padding: 6px 14px 6px 6px;
    color: var(--cx-text);
    font-weight: 500;
    font-size: 0.9rem;
}

.cx-user-pill__avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--cx-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}
.cx-table thead th {
    color: var(--cx-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
    border-bottom-width: 1px;
    padding: 8px 16px;
    white-space: nowrap;
}

.cx-table td {
    padding: 7px 16px;
    vertical-align: middle;
    font-size: 0.9rem;
}

.cx-table tbody tr:hover {
    background: var(--cx-primary-soft);
}

/* Small square thumbnail in list rows */
.cx-row-thumb {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    object-fit: cover;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--cx-primary-soft);
    color: var(--cx-muted);
    border: 1px solid var(--cx-border);
}

.cx-row-thumb--empty {
    font-size: 1rem;
}

/* Product image tiles on the edit form */
.cx-product-thumb {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: var(--cx-radius-sm);
    overflow: hidden;
    border: 2px solid var(--cx-border);
    background: var(--cx-primary-soft);
}

.cx-product-thumb.is-primary {
    border-color: var(--cx-primary);
}

.cx-product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cx-product-thumb__actions {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
    padding: 4px;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.55), transparent);
}
.cx-auth-body {
    min-height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top left, #3c46b8 0%, #1b1f3b 55%, #141630 100%);
    position: relative;
    overflow: hidden;
}

.cx-auth-decor {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.08), transparent 40%),
                radial-gradient(circle at 15% 85%, rgba(255, 255, 255, 0.06), transparent 45%);
}

.cx-auth-card {
    position: relative;
    z-index: 1;
    background: var(--cx-surface);
    border-radius: var(--cx-radius);
    box-shadow: var(--cx-shadow-lg);
    padding: 40px 36px;
    width: 100%;
    max-width: 380px;
}

.cx-auth-card__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.3rem;
    margin-bottom: 4px;
}

.cx-auth-card__brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--cx-primary-soft);
    color: var(--cx-primary);
}

.cx-auth-card__subtitle {
    color: var(--cx-muted);
    font-size: 0.88rem;
    margin-bottom: 24px;
}
