:root {
    --lulus-yellow: #2596be;
    --lulus-green: #2596be;
    --lulus-dark-green: #1a7396;
    --lulus-light-yellow: #e3f2f9;
    --primary: #2596be;
    --primary-dark: #1a7396;
    --secondary: #2596be;
    --success: #2596be;
    --warning: #2596be;
    --danger: #dc3545;
    --background: #f8f9fa;
    --surface: #ffffff;
    --text: #212529;
    --text-secondary: #6c757d;
    --border: #dee2e6;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px;
}

header {
    background: var(--surface);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

header.toolbar {
    padding: 12px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 8px;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-icon {
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: var(--lulus-green);
    color: white;
    border-color: var(--lulus-green);
}

.toolbar-logo {
    height: 32px !important;
    width: auto !important;
    object-fit: contain !important;
    cursor: pointer;
}

.toolbar-title {
    font-size: 1.2rem !important;
    color: var(--lulus-green) !important;
    margin: 0 !important;
    font-weight: 600 !important;
}

.user-menu {
    position: relative;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--lulus-green);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.user-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 220px;
    padding: 15px;
    display: none;
    z-index: 1000;
}

.user-dropdown.show {
    display: block;
}

.user-info {
    margin-bottom: 10px;
}

.user-info strong {
    display: block;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 4px;
}

.user-info small {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.user-dropdown hr {
    margin: 10px 0;
    border: none;
    border-top: 1px solid #e0e0e0;
}

.dropdown-btn {
    width: 100%;
    padding: 10px;
    background: var(--lulus-green);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.dropdown-btn:hover {
    background: #1f8838;
    transform: translateY(-1px);
}

header h1 {
    font-size: 1.8rem;
    color: var(--lulus-green);
    margin-bottom: 0;
    font-weight: 700;
}

header img {
    height: 18px;
    width: auto;
    max-width: 100px;
    object-fit: contain;
}

.logo-img {
    height: 18px;
    width: auto;
    max-width: 100px;
    object-fit: contain;
    max-height: 18px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.auth-status {
    display: flex;
    align-items: center;
    gap: 15px;
}

#userInfo {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Dashboard Navigation */
.dashboard-nav {
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
    overflow-x: auto;
    background: var(--surface);
    padding: 18px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    flex-wrap: wrap;
}

.nav-item {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s;
    white-space: nowrap;
    display: inline-block;
}

.nav-item:hover {
    background: var(--background);
    transform: translateY(-2px);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--lulus-green) 0%, #20c997 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.2);
}

/* Role-based colored nav items */
.nav-item[href*="sales"]:not(.active):hover {
    background: rgba(40, 167, 69, 0.1);
    color: var(--lulus-green);
}

.nav-item[href*="merchandising"]:not(.active):hover {
    background: rgba(255, 215, 0, 0.1);
    color: #d4a400;
}

.nav-item[href*="manufacturing"]:not(.active):hover {
    background: rgba(23, 162, 184, 0.1);
    color: #17a2b8;
}

.nav-item[href*="inventory"]:not(.active):hover {
    background: rgba(111, 66, 193, 0.1);
    color: #6f42c1;
}

.nav-item[href*="accounting"]:not(.active):hover {
    background: rgba(253, 126, 20, 0.1);
    color: #fd7e14;
}

.nav-item[href*="hr"]:not(.active):hover {
    background: rgba(232, 62, 140, 0.1);
    color: #e83e8c;
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    overflow-x: auto;
    background: var(--surface);
    padding: 15px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s;
    white-space: nowrap;
}

.tab-btn:hover {
    background: var(--background);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
}

.tab-content {
    display: none;
    background: var(--surface);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    animation: fadeIn 0.3s;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

h2 {
    color: var(--text);
    margin-bottom: 25px;
    font-size: 1.75rem;
    font-weight: 600;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 12px;
}

h3 {
    color: var(--text);
    margin-bottom: 15px;
    font-size: 1.25rem;
    font-weight: 600;
}

.section {
    background: var(--surface);
    padding: 32px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 36px;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.card {
    background: linear-gradient(135deg, var(--lulus-green) 0%, var(--lulus-dark-green) 100%);
    padding: 25px;
    border-radius: 12px;
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
    cursor: pointer;
}

.card:nth-child(2) {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #333;
}

.card:nth-child(3) {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.card:nth-child(4) {
    background: linear-gradient(135deg, #FFD700 0%, #28a745 100%);
    color: #333;
}

.card:hover {
    transform: translateY(-5px);
}

.card h3 {
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: 10px;
    color: white;
}

.metric {
    font-size: 2rem;
    font-weight: 700;
    margin: 10px 0;
}

.change {
    font-size: 0.85rem;
    opacity: 0.85;
}

.change.positive {
    color: #86efac;
}

.change.negative {
    color: #fca5a5;
}

.section {
    margin-bottom: 30px;
    background: var(--surface);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.toolbar {
    display: flex;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
    align-items: center;
    padding: 16px 18px;
    background: var(--background);
    border-radius: 8px;
}

.search-box {
    flex: 1;
    min-width: 200px;
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
}

.filter-select {
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    background: white;
    cursor: pointer;
}

/* Export menu styles */
.btn-group {
    position: relative;
    display: inline-block;
}

.export-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 5px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 150px;
}

.export-menu button {
    display: block;
    width: 100%;
    padding: 12px 20px;
    border: none;
    background: white;
    text-align: left;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.2s;
}

.export-menu button:first-child {
    border-radius: 8px 8px 0 0;
}

.export-menu button:last-child {
    border-radius: 0 0 8px 8px;
}

.export-menu button:hover {
    background: var(--lulus-light-yellow);
    color: var(--primary);
}

.export-menu button:not(:last-child) {
    border-bottom: 1px solid var(--border);
}


.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    padding: 22px;
    background: var(--background);
    border-radius: 8px;
}

.metric-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.metric-item .label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.metric-item .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95rem;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Polished refresh pill */
.refresh-button {
    border-radius: 9999px;
    padding: 10px 18px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    font-weight: 600;
}
.refresh-button.loading {
    opacity: 0.85;
    pointer-events: none;
}

/* Generic badge styling */
.badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
    transform: translateY(-2px);
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
    flex-wrap: wrap;
}

.search-box {
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    min-width: 250px;
    transition: border-color 0.3s;
}

.search-box:focus {
    outline: none;
    border-color: var(--primary);
}

.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-top: 24px;
    background: white;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

thead {
    background: linear-gradient(135deg, var(--lulus-green) 0%, var(--lulus-dark-green) 100%);
    color: white;
}

th {
    padding: 16px 22px;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
    border-bottom: none;
}

td {
    padding: 14px 22px;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: rgba(40, 167, 69, 0.05);
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 50px !important;
    font-size: 1rem;
}

footer {
    margin-top: 40px;
    padding: 25px;
    background: var(--surface);
    border-radius: 12px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    box-shadow: var(--shadow);
}

footer a {
    color: var(--primary);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.hidden {
    display: none;
}

#apiStatus {
    font-weight: 600;
}

#apiStatus.online {
    color: var(--success);
}

#apiStatus.offline {
    color: var(--danger);
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .cards {
        grid-template-columns: 1fr;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        width: 100%;
    }
}

/* Dashboard Navigation */
.dashboard-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    overflow-x: auto;
    background: var(--surface);
    padding: 15px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.nav-item {
    padding: 12px 20px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.nav-item:hover {
    background: var(--lulus-light-yellow);
    border-color: var(--lulus-yellow);
}

.nav-item.active {
    background: var(--lulus-green);
    color: white;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content.large {
    max-width: 800px;
}

.close {
    float: right;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--lulus-green);
}

/* Report Cards */
.report-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.report-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 26px;
    border-radius: 12px;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: var(--shadow);
}

/* Panels: large content blocks with comfortable spacing */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 28px;
}
.panel .card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}
.panel .card-body {
    padding: 22px;
}

.report-card:hover {
    border-color: var(--lulus-green);
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(40, 167, 69, 0.25);
}

.report-card h4 {
    color: var(--lulus-green);
    margin-bottom: 12px;
    font-size: 1.1rem;
    font-weight: 600;
}

.report-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.report-card .report-count {
    font-size: 2rem;
    font-weight: 700;
    color: var(--lulus-green);
    margin: 0;
}

.report-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}
