:root {
    --font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    --primary-color: #007BFF;
    --primary-hover: #0056b3;
    --primary-disabled: #d3d3d3;
    --bg-light: #fafafa;
    --text-dark: #333;
    --box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    --radius: 6px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    padding: 20px;
    margin: 0;
    background-color: #eef5fb;
    color: var(--text-dark);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1 {
    text-align: center;
    margin-bottom: 10px;
    font-weight: 700;
    color: #222;
}

.main-layout {
    display: flex;
    width: 100%;
    margin-top: 20px;
    gap: 40px;
    align-items: flex-start;
}

.tabs-container {
    border: 1px solid #ccc;
    border-radius: var(--radius);
    padding: 15px;
    background-color: #fff;
    box-shadow: var(--box-shadow);
}

.tabs {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 150px;
}

.tabs button,
button {
    padding: 10px 16px;
    font-size: 1em;
    cursor: pointer;
    border: 1px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    border-radius: 4px;
    transition: background-color 0.3s, color 0.3s;
    user-select: none;
    width: 220px;
    text-align: left;
}

.tabs button:hover:not(.active),
button:hover:not(:disabled):not(.active) {
    background-color: #e6f0ff;
}

.tabs button.active,
button.active {
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: default;
}

button:disabled {
    background-color: var(--primary-disabled) !important;
    color: white;
    cursor: not-allowed;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px auto 40px auto;
    background: white;
    box-shadow: var(--box-shadow);
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 0.95em;
    white-space: nowrap;
    display: block;
}

th,
td {
    border: 1px solid #ddd;
    padding: 10px 12px;
    text-align: left;
    white-space: nowrap;
    text-overflow: ellipsis;
    vertical-align: middle;
}

th {
    background-color: #f7f7f7;
    font-weight: 600;
    user-select: none;
}

#logOutBtn,
#logOutBtnMobile {
    background-color: #f44336;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 1em;
    transition: background-color 0.3s ease;
}

#logOutBtn:hover,
#logOutBtnMobile:hover {
    background-color: #d32f2f;
}

#dashboardSection img {
    width: 500px;
    height: auto;
    display: block;
}

.chartContainer {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

#debtsChart {
    max-width: 100%;
    max-height: 350px;
}

.dashboard-charts-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: space-between;
    margin-top: 20px;
}

.dashboard-charts-row .chartContainer {
    flex: 1 1 48%;
    max-height: 500px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#companyLogo {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    margin: auto;
    padding: 1rem;
}

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.6);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
}

.loading-box {
    background-color: white;
    border-radius: 10px;
    padding: 3rem 4rem;
    min-width: 300px;
    min-height: 200px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.25);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.loading-text {
    margin-top: 1.5rem;
    font-size: 1.5rem;
    color: #333;
}

.spinner {
    border: 6px solid #eee;
    border-top: 6px solid #666;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    animation: spin 0.8s linear infinite;
}

.mobile-only {
    display: none;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #eef5fb;
    z-index: 1000;
    padding: 0px 0;
    padding-top: 0px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

body {
    padding-top: 80px;
}

@media (max-width: 1024px) {
    .main-layout {
        flex-direction: column;
        margin-top: 0;
        gap: 0;
        align-items: normal;
    }

    .tabs-container {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: #fff;
        border-top: 1px solid #ddd;
        padding: 0;
    }

    .tabs {
        flex-direction: row;
        gap: 0;
        width: 100%;
    }

    .tabs button {
        flex: 1;
        width: auto;
        border: none;
        border-radius: 0;
        padding: 12px 6px;
        font-size: 0.85em;
        text-align: center;
        border-top: 2px solid transparent;
    }

    .tabs button.active {
        border-top: 2px solid var(--primary-color);
        background: #f0f6ff;
        color: var(--primary-color);
    }

    .mobile-only {
        display: block;
        width: 100%;
        margin-bottom: 0;
        padding: 10px;
        font-size: 1em;
        border: 1px solid #ccc;
        border-radius: 4px;
        background-color: white;
        color: var(--primary-color);
    }

    th,
    td {
        font-size: 0.85em;
        padding: 6px 8px;
    }

    #dashboardSection,
    #debtTable,
    #usersTable,
    #groupsTable,
    #activitiesTable,
    #settingsSection {
        margin-top: 0;
    }

    .mobile-divider {
        display: block;
    }

    #switchEnvironmentBtnMobile {
        margin-top: 10px;
        margin-bottom: 10px;
    }
}

@media (min-width: 1024px) {
    #switchEnvironmentBtnMobile {
        display: none !important;
    }
}

@media (max-width: 1024px) {
    .chartContainer {
        padding: 10px;
        height: auto;
    }
}

@media (max-width: 1024px) {
    .content {
        padding-bottom: 80px;
    }

    #logOutBtnMobile {
        margin-top: 10px;
    }
}