:root {
    --apple-bg: #000;
    /* Deep black for maximum contrast */
    --apple-card: #1c1c1e;
    /* Elevated slate */
    --apple-control: #2c2c2e;
    /* UI interactions */
    --apple-blue: #007aff;
    --apple-green: #30d158;
    /* Pro Green for currency-based discounts */
    --apple-red: #ff453a;
    /* Danger/Alert Red */
    --apple-text: #ffffff;
    --apple-text-muted: #a1a1a6;
    --apple-border: rgba(255, 255, 255, 0.12);
    --sidebar-w: 280px;
    --sidebar-collapsed-w: 65px;
    --br-main: 18px;
    --br-ui: 10px;
    --apple-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

body.collapsed {
    --sidebar-w: var(--sidebar-collapsed-w);
}

@media (max-width: 992px) {
    :root {
        --sidebar-collapsed-w: 0px;
        --sidebar-w: 280px;
    }

    body.collapsed {
        --sidebar-w: 0px;
    }

    body.collapsed .sidebar {
        transform: translateX(-100%);
        overflow: hidden !important;
    }

    body.collapsed .nav.flex-column {
        overflow: hidden !important;
    }
}

body {
    background: var(--apple-bg);
    color: var(--apple-text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.011em;
}

/* Sidebar - Glassmorphism Pro */
.sidebar {
    width: var(--sidebar-w);
    height: 100vh;
    background: rgba(28, 28, 30, 0.85);
    backdrop-filter: saturate(180%) blur(40px);
    border-right: 1px solid var(--apple-border);
    position: fixed;
    left: 0;
    top: 0;
    padding: 3rem 0;
    z-index: 1000;
    transition: width 0.45s var(--apple-ease), transform 0.45s var(--apple-ease);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.collapsed .sidebar {
    overflow: visible;
}

.sidebar-brand {
    height: 48px;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 0 2rem;
    margin-bottom: 3.5rem;
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.45s var(--apple-ease);
    flex-shrink: 0;
}

body.collapsed .sidebar-brand {
    padding: 0;
    justify-content: center;
    width: 100%;
}

.sidebar-brand i {
    font-size: 1.4rem;
    min-width: 32px;
    display: flex;
    justify-content: center;
}

body.collapsed .sidebar-brand span {
    opacity: 0;
    width: 0;
    margin: 0;
    pointer-events: none;
}

body.collapsed .sidebar-brand .brand-logo-full {
    display: none !important;
}

body.collapsed .sidebar-brand .brand-logo-icon {
    display: block !important;
    margin: 0 auto;
}

.nav.flex-column {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 1rem;
    display: flex !important;
    flex-direction: column;
}

body.collapsed .nav.flex-column {
    overflow: visible !important;
    padding: 0;
}

/* Custom Scrollbar for Nav */
.nav.flex-column::-webkit-scrollbar {
    width: 4px;
}

.nav.flex-column::-webkit-scrollbar-track {
    background: transparent;
}

.nav.flex-column::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.nav.flex-column::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.nav-link {
    color: var(--apple-text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    height: 48px;
    padding: 0 1rem;
    border-radius: var(--br-ui);
    margin-bottom: 6px;
    transition: all 0.3s var(--apple-ease);
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
    text-decoration: none;
    position: relative;
}

.nav-link i {
    font-size: 1.15rem;
    min-width: 24px;
    display: flex;
    justify-content: center;
    transition: transform 0.3s var(--apple-ease);
}

body.collapsed .nav-link {
    padding: 0;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-left: auto;
    margin-right: auto;
    border-radius: 12px;
    gap: 0;
}

body.collapsed .nav-link span {
    display: none;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s var(--apple-ease);
}

@media (max-width: 992px) {
    body:not(.collapsed) .sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }
}

body.collapsed .nav-link i {
    font-size: 1.3rem;
}

.nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

/* Remove default Bootstrap caret */
.dropdown-toggle::after {
    display: none !important;
}

.nav-link.active {
    color: #fff !important;
    background: var(--apple-blue);
    box-shadow: 0 8px 20px rgba(0, 122, 255, 0.3);
}

/* Submenu Styling - Premium Refinement */
.nav-item-dropdown {
    transition: background 0.3s var(--apple-ease);
    border-radius: 14px;
    width: 100%;
    display: block;
}

.nav-item-dropdown.open {
    background: rgba(255, 255, 255, 0.03);
    padding-bottom: 6px;
}

.nav-dropdown-menu {
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s var(--apple-ease);
    opacity: 0;
    padding-left: 0;
    position: relative;
}

/* Minimalist nesting line */
.nav-dropdown-menu::before {
    content: '';
    position: absolute;
    left: 2.1rem;
    top: 0;
    bottom: 12px;
    width: 1px;
    background: rgba(255, 255, 255, 0.08);
    z-index: 1;
}

.nav-item-dropdown.open .nav-dropdown-menu {
    max-height: 200px;
    opacity: 1;
    margin-top: 2px;
}

.nav-dropdown-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 1rem 9px 3rem;
    color: var(--apple-text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none !important;
    border-radius: 10px;
    margin: 1px 8px;
    transition: all 0.2s var(--apple-ease);
    position: relative;
    z-index: 2;
}

.nav-dropdown-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.nav-dropdown-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    font-weight: 600;
}

/* Active dot on nesting line */
.nav-dropdown-link.active::before {
    content: '';
    position: absolute;
    left: 1.67rem;
    top: 50%;
    width: 2px;
    height: 18px;
    background: var(--apple-blue);
    transform: translate(-50%, -50%);
}

/* Collapsed Sidebar Dropdown Behavior - Glassmorphism */
body.collapsed .nav-item-dropdown {
    position: relative;
}

body.collapsed .nav-dropdown-menu {
    position: absolute;
    left: 100%;
    top: -10px;
    width: 200px;
    background: rgba(28, 28, 30, 0.95);
    backdrop-filter: blur(25px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    margin-left: 15px;
    padding: 10px;
    z-index: 1001;
    max-height: none !important;
    display: none;
    opacity: 1;
}

body.collapsed .nav-dropdown-menu::before {
    display: none;
}

body.collapsed .nav-dropdown-link {
    padding: 10px 14px;
    margin: 4px 0;
    font-size: 0.88rem;
}

body.collapsed .nav-dropdown-link.active::before {
    left: 0;
    width: 3px;
    height: 18px;
    border-radius: 0 4px 4px 0;
}

/* Bridge to prevent menu closing on move */
body.collapsed .nav-item-dropdown::after {
    content: '';
    position: absolute;
    top: 0;
    right: -20px;
    width: 20px;
    height: 100%;
    display: none;
}

body.collapsed .nav-item-dropdown:hover::after,
body.collapsed .nav-item-dropdown:hover .nav-dropdown-menu {
    display: block;
}

body.collapsed .nav-dropdown-link span {
    display: inline !important;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-w);
    padding: 2.5rem 5rem;
    min-height: 100vh;
    transition: margin-left 0.45s var(--apple-ease), padding 0.45s var(--apple-ease);
}

@media (max-width: 1367px) {
    .main-content {
        padding: 1.75rem 1.75rem;
    }
}

@media (max-width: 992px) {
    .main-content {
        margin-left: 0 !important;
        padding: 1.5rem 1.5rem;
    }
}

.sidebar-toggle {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--apple-border);
    color: var(--apple-text-muted);
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s var(--apple-ease);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: scale(1.05);
}

.sidebar-toggle:active {
    transform: scale(0.95);
}

/* Coherent Card System */
.card {
    background: var(--apple-card);
    border: 1px solid var(--apple-border);
    border-radius: var(--br-main);
    padding: 2.25rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.page-header {
    margin-bottom: 4rem;
}

.page-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.03em;
}

.page-subtitle {
    color: var(--apple-text-muted);
    font-size: 1.25rem;
    font-weight: 400;
}

/* Unified Inputs & Buttons */
.form-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--apple-text-muted);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-control,
.form-select {
    background: var(--apple-control) !important;
    border: 1px solid var(--apple-border) !important;
    color: #fff !important;
    padding: 0.85rem 1.15rem !important;
    border-radius: var(--br-ui) !important;
    font-size: 0.95rem;
    transition: border-color 0.2s, background 0.2s;
}

.form-control:focus {
    background: #3a3a3c !important;
    border-color: var(--apple-blue) !important;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1) !important;
}

.btn {
    border-radius: var(--br-ui);
    padding: 0.85rem 1.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s;
}

.btn-primary {
    background: var(--apple-blue);
    border: none;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.2);
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-outline-light {
    border: 1px solid var(--apple-border);
    color: #fff;
    background: transparent;
}

.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #fff;
    color: #fff;
}

/* Modal Sheets - Top Consistency */
.modal-content {
    background: #1c1c1e;
    border: 1px solid var(--apple-border);
    border-radius: 28px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
}

.modal-header {
    border-bottom: 1px solid var(--apple-border);
    padding: 2rem 2.5rem;
}

.modal-body {
    padding: 3rem 2.5rem;
}

.modal-footer {
    border-top: 1px solid var(--apple-border);
    padding: 1.5rem 2.5rem;
}

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

.x-small {
    font-size: 0.75rem;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--apple-red);
    background: rgba(255, 69, 58, 0.1);
    transition: background 0.2s;
    font-size: 0.85rem;
    font-weight: 600;
}

.logout-btn:hover {
    background: rgba(255, 69, 58, 0.2);
    color: var(--apple-red);
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: rgba(28, 28, 30, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 8px;
    min-width: 180px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    display: none;
    animation: dropdownFade 0.2s ease-out;
}

@keyframes dropdownFade {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


::placeholder {
    color: var(--apple-text-muted) !important;
    font-size: .85rem !important;
    opacity: .55 !important;
}