:root {
    --ink: #172033;
    --muted: #6b7688;
    --line: rgba(23, 32, 51, 0.1);
    --panel: rgba(255, 255, 255, 0.92);
    --brand: #0f766e;
    --brand-dark: #134e4a;
    --accent: #e11d48;
    --gold: #f59e0b;
    --sky: #0284c7;
    --sidebar: #0b1720;
    --sidebar-2: #102a2d;
    --topbar: #0b1720;
    --page-bg: #edf3f6;
    --panel-solid: #ffffff;
    --hero-dark: #172033;
    --shadow: 0 18px 46px rgba(15, 23, 42, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    background: var(--page-bg);
    background:
        radial-gradient(circle at top left, color-mix(in srgb, var(--brand) 20%, transparent), transparent 34rem),
        radial-gradient(circle at top right, color-mix(in srgb, var(--sky) 18%, transparent), transparent 30rem),
        linear-gradient(135deg, color-mix(in srgb, var(--page-bg) 72%, #ffffff), var(--page-bg));
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
}

a {
    text-decoration: none;
}

.app-shell {
    min-height: 100vh;
}

.desktop-sidebar {
    position: fixed;
    inset: 16px auto 16px 16px;
    width: 278px;
    display: flex;
    flex-direction: column;
    padding: 18px;
    border-radius: 8px;
    background: linear-gradient(180deg, var(--sidebar-2), var(--sidebar));
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--sidebar-2) 96%, transparent), color-mix(in srgb, var(--sidebar) 98%, transparent)),
        linear-gradient(135deg, color-mix(in srgb, var(--brand) 18%, transparent), transparent);
    box-shadow: 0 24px 70px rgba(11, 23, 32, 0.35);
    overflow: hidden;
    z-index: 20;
}

.desktop-sidebar::before {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    pointer-events: none;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    position: relative;
    z-index: 1;
}

.brand-block:hover {
    color: #fff;
}

.brand-mark {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--brand), var(--gold));
    color: #fff;
    font-weight: 800;
    box-shadow: 0 14px 28px rgba(15, 118, 110, 0.35);
}

.brand-logo {
    width: 46px;
    height: 46px;
    object-fit: contain;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    padding: 5px;
}

.brand-block strong {
    display: block;
    font-size: 1rem;
    letter-spacing: 0;
}

.brand-block small {
    display: block;
    color: rgba(255, 255, 255, 0.68);
    margin-top: 2px;
}

.side-nav {
    display: grid;
    gap: 8px;
    margin-top: 24px;
    position: relative;
    z-index: 1;
}

.side-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 11px 12px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.72);
    font-weight: 700;
    transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.side-nav a i {
    width: 24px;
    text-align: center;
    font-size: 1.08rem;
}

.side-nav a:hover,
.side-nav a.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.92), rgba(2, 132, 199, 0.82));
    box-shadow: 0 12px 24px rgba(2, 132, 199, 0.2);
    transform: translateX(3px);
}

.sidebar-user {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    position: relative;
    z-index: 1;
}

.user-avatar {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.16);
    font-weight: 800;
}

.sidebar-user strong,
.sidebar-user a {
    display: block;
}

.sidebar-user a {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
}

.mobile-topbar {
    display: none;
}

.mobile-menu {
    background: linear-gradient(180deg, var(--sidebar-2), var(--sidebar));
    color: #fff;
}

.mobile-menu .offcanvas-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.app-main {
    margin-left: 318px;
    padding: 28px 28px 44px;
}

.page-hero {
    min-height: 150px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 20px;
    padding: 26px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--brand), var(--hero-dark));
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--brand) 95%, transparent), color-mix(in srgb, var(--hero-dark) 95%, transparent)),
        linear-gradient(90deg, color-mix(in srgb, var(--sky) 26%, transparent), transparent);
    color: #fff;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.page-hero::after {
    content: "";
    position: absolute;
    right: -70px;
    top: -80px;
    width: 260px;
    height: 260px;
    border: 34px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
}

.page-hero > * {
    position: relative;
    z-index: 1;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.83rem;
    font-weight: 800;
    text-transform: uppercase;
}

.page-hero h1 {
    margin: 0;
    font-size: clamp(1.8rem, 3vw, 2.7rem);
    font-weight: 900;
}

.page-hero p {
    margin: 8px 0 0;
    color: rgba(255, 255, 255, 0.78);
}

.hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-weight: 700;
    white-space: nowrap;
}

.card {
    border: 1px solid rgba(255, 255, 255, 0.74);
    border-radius: 8px;
    background: var(--panel-solid);
    background: color-mix(in srgb, var(--panel-solid) 92%, transparent);
    box-shadow: 0 16px 38px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(10px);
}

.card-body {
    padding: 1.25rem;
}

.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--brand), var(--gold), var(--accent));
}

.stat-card strong {
    display: block;
    margin-top: 8px;
    font-size: 1.85rem;
    font-weight: 900;
    color: var(--ink);
}

.text-muted {
    color: var(--muted) !important;
}

.btn {
    border-radius: 8px;
    font-weight: 700;
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand), var(--sky));
    border: 0;
    box-shadow: 0 10px 22px rgba(15, 118, 110, 0.22);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--brand-dark), var(--sky));
}

.btn-secondary {
    background: #5b677a;
    border-color: #5b677a;
}

.btn-outline-secondary {
    border-color: rgba(23, 32, 51, 0.2);
    color: var(--ink);
}

.form-control,
.form-select {
    border-radius: 8px;
    border-color: rgba(23, 32, 51, 0.14);
    min-height: 42px;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(15, 118, 110, 0.5);
    box-shadow: 0 0 0 0.2rem rgba(15, 118, 110, 0.13);
}

.select2-container--default .select2-selection--single {
    min-height: 42px;
    border-radius: 8px;
    border-color: rgba(23, 32, 51, 0.14);
    display: flex;
    align-items: center;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 40px;
    color: var(--ink);
    padding-left: 12px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px;
}

.select2-dropdown {
    border-color: rgba(23, 32, 51, 0.14);
    border-radius: 8px;
    overflow: hidden;
}

.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background: var(--brand);
}

.form-label {
    font-weight: 800;
    color: #334155;
}

.table-responsive {
    border-radius: 8px;
}

.table {
    min-width: 720px;
    margin-bottom: 0;
}

.table thead th {
    background: color-mix(in srgb, var(--page-bg) 70%, #ffffff);
    color: #334155;
    border-bottom: 0;
    font-size: 0.83rem;
    text-transform: uppercase;
}

.table tbody td {
    border-color: rgba(23, 32, 51, 0.08);
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-bg-type: rgba(15, 118, 110, 0.035);
}

.alert {
    border: 0;
    border-radius: 8px;
}

.settings-logo-preview {
    max-width: 220px;
    max-height: 120px;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
    border: 1px solid rgba(23, 32, 51, 0.12);
    padding: 10px;
}

.theme-preview {
    display: grid;
    grid-template-columns: 120px 1fr;
    min-height: 120px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(23, 32, 51, 0.1);
}

.preset-swatches {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    min-height: 42px;
    align-items: center;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid rgba(23, 32, 51, 0.1);
    background: rgba(255, 255, 255, 0.7);
}

.preset-swatches span {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid rgba(23, 32, 51, 0.12);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08);
}

.theme-preview-sidebar {
    background: linear-gradient(180deg, var(--sidebar-2), var(--sidebar));
}

.theme-preview-main {
    display: grid;
    gap: 12px;
    padding: 18px;
    background:
        radial-gradient(circle at top left, color-mix(in srgb, var(--brand) 18%, transparent), transparent 14rem),
        var(--page-bg);
}

.theme-preview-main div {
    height: 34px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--brand), var(--hero-dark));
}

.theme-preview-main span,
.theme-preview-main strong {
    display: block;
    border-radius: 8px;
    background: color-mix(in srgb, var(--panel-solid) 92%, transparent);
}

.theme-preview-main span {
    height: 20px;
}

.theme-preview-main strong {
    height: 34px;
}

.app-footer {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 28px;
    padding: 16px;
    color: var(--muted);
    font-weight: 700;
}

.app-footer a {
    color: var(--brand);
}

.module-nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px;
    border-radius: 8px;
    background: var(--panel-solid);
    background: color-mix(in srgb, var(--panel-solid) 66%, transparent);
    border: 1px solid rgba(23, 32, 51, 0.08);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.module-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 9px 14px;
    border-radius: 8px;
    color: var(--ink);
    font-weight: 800;
    background: color-mix(in srgb, var(--panel-solid) 72%, transparent);
    border: 1px solid rgba(23, 32, 51, 0.08);
}

.module-nav a.active,
.module-nav a:hover {
    color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--sky));
}

.sale-row {
    display: grid;
    grid-template-columns: 2fr 0.8fr 1fr 0.8fr 1fr auto;
    gap: 12px;
    padding: 12px;
    border: 1px solid rgba(23, 32, 51, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.58);
}

.totals-box {
    display: grid;
    gap: 8px;
    padding: 16px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(2, 132, 199, 0.08));
    border: 1px solid rgba(23, 32, 51, 0.08);
}

.totals-box div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.totals-box .grand {
    padding-top: 10px;
    margin-top: 4px;
    border-top: 1px solid rgba(23, 32, 51, 0.12);
    font-size: 1.15rem;
}

@media (max-width: 991.98px) {
    body {
        padding-top: 68px;
    }

    .desktop-sidebar {
        display: none;
    }

    .mobile-topbar {
        position: fixed;
        inset: 0 0 auto 0;
        height: 64px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 0 14px;
        background: var(--topbar);
        background: color-mix(in srgb, var(--topbar) 94%, transparent);
        color: #fff;
        backdrop-filter: blur(12px);
        box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
        z-index: 50;
    }

    .mobile-menu-btn,
    .mobile-logout {
        width: 42px;
        height: 42px;
        display: grid;
        place-items: center;
        border: 1px solid rgba(255, 255, 255, 0.16);
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.08);
        color: #fff;
        font-size: 1.35rem;
    }

    .mobile-brand {
        color: #fff;
        font-weight: 900;
    }

    .mobile-brand:hover,
    .mobile-logout:hover {
        color: #fff;
    }

    .app-main {
        margin-left: 0;
        padding: 14px 12px 28px;
    }

    .page-hero {
        min-height: auto;
        display: block;
        padding: 20px;
        margin-bottom: 14px;
    }

    .page-hero h1 {
        font-size: 1.8rem;
    }

    .hero-actions {
        justify-content: flex-start;
        margin-top: 14px;
    }

    .status-pill {
        font-size: 0.86rem;
    }

    .card-body {
        padding: 1rem;
    }

    .sale-row {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 992px) {
    .mobile-menu {
        display: none;
    }
}
