:root {
    --font-family-sans-serif: 'Inter', system-ui, -apple-system, sans-serif;
    
    /* Cores Premium (Tema Wix WH-1071 - Consultoria & Tech) */
    --wix-navy: #16163F;
    --wix-violet: #9E3FFD;
    --wix-violet-rgb: 158, 63, 253;
    --wix-lilac: #F8F0FF;
    
    --bs-primary: #9E3FFD; /* Violeta Elétrico Wix WH-1071 */
    --bs-primary-rgb: 158, 63, 253;
    
    --bs-body-bg: #f8f6fd; /* Fundo Lilás Ultra Suave */
    --bs-body-color: #16163F; /* Azul Marinho Profundo Wix */
    
    --bs-card-bg: #ffffff;
    --bs-card-border-radius: 12px;
}

[data-bs-theme="dark"] {
    /* Cores Premium (Dark Mode Wix WH-1071) */
    --bs-primary: #af5cff;
    --bs-primary-rgb: 175, 92, 255;
    
    --bs-body-bg: #0c0d22; /* Midnight Navy Dark Background */
    --bs-body-color: #f8f0ff;
    --bs-body-tertiary-bg: #08081a;
    --bs-secondary-bg: #16163f;
    
    --bs-card-bg: #16163f; /* Card Navy Wix */
}

body {
    font-family: var(--font-family-sans-serif);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 0.8125rem; /* 13px - Compact SaaS Density */
    line-height: 1.4;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Custom Card */
.card {
    border-radius: var(--bs-card-border-radius);
    background-color: var(--bs-card-bg);
}

.card-body {
    padding: 0.85rem !alignment;
}

.shadow-sm {
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02) !important;
}

[data-bs-theme="dark"] .shadow-sm {
    box-shadow: 0 2px 4px rgba(0,0,0,0.3) !important;
    border: 1px solid #333 !important;
}

/* Form Inputs & Selects - Compact Fit */
.form-control, .form-select {
    border-radius: 5px;
    padding: 0.3rem 0.6rem;
    font-size: 0.8125rem;
    transition: all 0.2s;
    border-color: #e3e8ee;
    max-width: 100%;
}

.form-control:focus, .form-select:focus {
    box-shadow: 0 0 0 2px rgba(var(--bs-primary-rgb), 0.15);
    border-color: var(--bs-primary);
}

[data-bs-theme="dark"] .form-control, [data-bs-theme="dark"] .form-select {
    background-color: #2a2a2a;
    border-color: #444;
    color: #fff;
}

/* Buttons - Minimalist Pill Style (Wix WH-1071 Inspired) */
.btn {
    border-radius: 50px;
    font-weight: 600;
    padding: 0.3rem 0.85rem;
    font-size: 0.8125rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-sm {
    padding: 0.2rem 0.65rem;
    font-size: 0.775rem;
    border-radius: 50px;
}

.btn-primary {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(158, 63, 253, 0.25);
}

.btn-primary:hover {
    background-color: #8825eb;
    border-color: #8825eb;
    color: #ffffff;
    transform: translateY(-1.5px);
    box-shadow: 0 4px 14px rgba(158, 63, 253, 0.4);
}

[data-bs-theme="dark"] .btn-primary {
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(175, 92, 255, 0.3);
}

[data-bs-theme="dark"] .btn-primary:hover {
    background-color: #9c3df5;
    border-color: #9c3df5;
}

/* Badges Pill Compact (Wix WH-1071) */
.badge {
    border-radius: 50px;
    font-size: 0.73rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
}

/* Table Density Compact & Fit */
.table-responsive {
    -webkit-overflow-scrolling: touch;
    border-radius: 6px;
    margin-bottom: 0;
}

.table {
    margin-bottom: 0;
}

.table th, .table td {
    padding: 0.35rem 0.55rem;
    font-size: 0.8125rem;
    vertical-align: middle;
}

.table th {
    font-size: 0.775rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Headings Compact */
h2, .h2 {
    font-size: 1.25rem !important;
}

h3, .h3 {
    font-size: 1.1rem !important;
}

h4, .h4 {
    font-size: 1rem !important;
}

h5, .h5 {
    font-size: 0.92rem !important;
}

/* ==========================================================
   APP SHELL (Ultra Compact Layout - No Horizontal Scrollbar)
   ========================================================== */

.app-body {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    background-color: var(--bs-body-bg);
}

/* Sidebar (Wix WH-1071 Deep Midnight Navy Theme) */
.sidebar {
    width: 240px;
    background-color: #16163F !important;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 15px rgba(22, 22, 63, 0.15);
    overflow-x: hidden;
}

.sidebar-header {
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-header .brand-text {
    color: #ffffff !important;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.sidebar-menu {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.5rem;
}

.menu-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 700;
    color: #9292bd;
    margin-bottom: 0.35rem;
    margin-top: 0.85rem;
    padding-left: 0.5rem;
    letter-spacing: 0.6px;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 0.42rem 0.75rem;
    color: #d6d6f5 !important;
    text-decoration: none;
    border-radius: 50px;
    margin-bottom: 3px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
}

.menu-item i {
    font-size: 0.95rem;
    margin-right: 8px;
    color: #a4a4d4;
    transition: color 0.2s ease;
}

.menu-item:hover {
    background-color: rgba(158, 63, 253, 0.18) !important;
    color: #ffffff !important;
    transform: translateX(2px);
}

.menu-item:hover i {
    color: #9E3FFD;
}

.menu-item.active {
    background-color: #9E3FFD !important;
    color: #ffffff !important;
    font-weight: 600;
    box-shadow: 0 3px 12px rgba(158, 63, 253, 0.4);
}

.menu-item.active i {
    color: #ffffff !important;
}

.sidebar-footer {
    padding: 0.7rem 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background-color: rgba(0, 0, 0, 0.15);
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    margin-left: 240px;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-x: hidden;
}

/* Topbar */
.topbar {
    height: 48px;
    background-color: var(--bs-body-bg);
    border-bottom: 1px solid #e3e8ee;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

[data-bs-theme="dark"] .topbar {
    border-bottom-color: #333;
}

.search-btn {
    background-color: var(--bs-card-bg);
    border: 1px solid #e3e8ee;
    padding: 0.25rem 0.75rem;
    border-radius: 5px;
    color: #8792a2;
    font-size: 0.8rem;
    min-width: 180px;
    text-align: left;
    transition: all 0.2s;
}

[data-bs-theme="dark"] .search-btn {
    border-color: #444;
}

.search-btn:hover {
    border-color: #cbd5e1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

/* Command Palette */
.command-palette-modal {
    border-radius: 8px;
    overflow: hidden;
}

.command-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    color: var(--bs-body-color);
    border-radius: 5px;
    margin-bottom: 2px;
    font-size: 0.82rem;
}

.command-item.active, .command-item:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.05);
}

/* Content Wrapper */
.content-wrapper {
    padding: 0.85rem 1rem !important;
}

/* ==========================================================
   AUTO-RESPONSIVE BREAKPOINTS (Tablets, Smartphones, Notebooks)
   ========================================================== */

/* Tablets & Smaller Displays (< 992px) */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 4px 0 15px rgba(0,0,0,0.15);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0,0,0,0.4);
        z-index: 1035;
        display: none;
    }

    .sidebar.show + .sidebar-overlay {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }
    
    .topbar {
        padding: 0 0.85rem;
    }

    .search-btn {
        min-width: 120px;
    }
}

/* Smartphones & Small Mobile Devices (< 576px) */
@media (max-width: 575.98px) {
    body {
        font-size: 0.8rem;
    }

    .content-wrapper {
        padding: 0.6rem 0.65rem !important;
    }

    h2, .h2 {
        font-size: 1.15rem !important;
    }

    .topbar {
        height: 44px;
        padding: 0 0.6rem;
    }

    .search-btn span:not(.bi) {
        display: none;
    }

    .search-btn {
        min-width: auto;
        padding: 0.25rem 0.5rem;
    }

    .dropdown-menu {
        max-width: calc(100vw - 20px) !important;
    }

    .btn {
        padding: 0.25rem 0.6rem;
        font-size: 0.78rem;
    }
}
