* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 20px;

    font-family: Arial, sans-serif;

    background: #ffffff;
}

.main-container {
    width: 100%;

    padding: 20px;

    background:
        linear-gradient(
            120deg,
            #f0f9ff,
            #e0f7fa
        );

    border: 1px solid #ccc;
    border-radius: 12px;

    box-shadow:
        2px 4px 16px
        rgba(0, 0, 0, 0.1);
}

.header {
    margin-top: 0;
    margin-bottom: 20px;

    font-size: 28px;

    color: #007acc;

    font-weight: bold;

    text-align: center;
}

.header a {
    color: #007acc;
    text-decoration: none;
}

.buttons-box {
    display: flex;

    align-items: center;

    gap: 8px;

    flex-wrap: wrap;

    margin-bottom: 15px;
}

.button {
    height: 36px;

    padding: 0 15px;

    border: 1px solid #aaa;
    border-radius: 5px;

    font-size: 14px;

    cursor: pointer;

    background: #eee;
}

.button:hover {
    filter: brightness(0.95);
}

.button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.success {
    background: #28a745;
    color: white;
}

.info {
    background: #17a2b8;
    color: white;
}

.warning {
    background: #ffc107;
    color: #222;
}

.danger {
    background: #dc3545;
    color: white;
}

.primary {
    background: #007bff;
    color: white;
}

#days {
    width: 80px;
    height: 36px;

    padding: 4px 8px;

    border: 1px solid #aaa;
    border-radius: 4px;

    font-size: 15px;
}

input[type="date"] {
    height: 36px;

    padding: 4px 8px;

    border: 1px solid #aaa;
    border-radius: 4px;

    font-size: 14px;
}

.spinner-container {
    display: none;

    justify-content: center;
    align-items: center;

    height: 52px;
}

.spinner-container.visible {
    display: flex;
}

.loader {
    border: 6px solid #f3f3f3;
    border-top: 6px solid #007acc;

    border-radius: 50%;

    width: 40px;
    height: 40px;

    animation: spin 0.8s linear infinite;
}

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

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

.spinner-label {
    display: none;

    text-align: center;

    margin-bottom: 10px;
}

.spinner-label.visible {
    display: block;
}

.chart-container {
    position: relative;

    width: 100%;

    height: 420px;

    margin-bottom: 20px;

    background: white;

    border: 1px solid #ddd;
    border-radius: 8px;

    padding: 10px;
}

#stats {
    margin-top: 5px;
}

.stats-box {
    display: flex;

    flex-wrap: wrap;

    align-items: stretch;

    gap: 8px;

    width: 100%;

    padding: 8px;

    background: rgba(255, 255, 255, 0.75);

    border: 1px solid #d8d8d8;

    border-radius: 8px;

    box-shadow:
        1px 2px 8px
        rgba(0, 0, 0, 0.06);
}

.stat-item {
    display: flex;

    flex-direction: column;

    justify-content: center;

    min-width: 170px;

    flex: 1;

    padding: 6px 10px;

    background: #f8f8f8;

    border: 1px solid #e3e3e3;

    border-radius: 6px;
}

.stat-label {
    margin-bottom: 3px;

    font-size: 11px;

    color: #777;

    white-space: nowrap;
}

.stat-value {
    font-size: 13px;

    color: #333;

    font-weight: 600;

    white-space: nowrap;
}

.error {
    color: red;
    font-weight: bold;
}

@media (max-width: 900px) {

    .buttons-box {
        justify-content: center;
    }

    .header {
        font-size: 22px;
    }

    .chart-container {
        height: 350px;
    }

    .stats-box {
        gap: 6px;
    }

    .stat-item {
        min-width: 150px;
    }
}

@media (max-width: 600px) {

    body {
        padding: 10px;
    }

    .main-container {
        padding: 12px;
    }

    .stat-item {
        min-width: 100%;

        flex: none;
    }

    .stat-value {
        white-space: normal;
    }
}