body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    margin: 0;
    padding: 1rem;
    max-width: 100vw;
    box-sizing: border-box;
    background-color: #222;
    color: #fff;
    transition: background-color 0.3s, color 0.3s;
}

body.dark-theme {
    background-color: #222;
    color: #fff;
}

body.light-theme {
    background-color: #fff;
    color: #333;
}

@media (prefers-color-scheme: dark) {
    body.light-theme {
        background-color: #fff;
        color: #333;
    }
    body.dark-theme {
        background-color: #222;
        color: #fff;
    }
}

.notification {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 1000;
    max-width: 90%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.notification.hidden {
    display: none;
}

.notification.success {
    background-color: #4CAF50;
}

.notification.error {
    background-color: #F44336;
}

.notification button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.25rem;
}

.notification button:hover {
    color: #ddd;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.button-group {
    display: flex;
    gap: 0.5rem;
}

h1 {
    font-size: 1.5rem;
    margin: 0;
}

.controls {
    margin-bottom: 1rem;
}

.form-container, .list-container, .chart-container {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-container.hidden {
    display: none;
}

.form-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

label {
    font-weight: bold;
    font-size: 1rem;
    flex: 0 0 120px;
}

input, select, button {
    padding: 0.75rem;
    margin: 0.25rem 0;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 0.25rem;
    box-sizing: border-box;
    touch-action: manipulation;
}

.form-row input {
    flex: 1;
}

button {
    background-color: #007bff;
    color: white;
    border: none;
    cursor: pointer;
}

button:hover {
    background-color: #0056b3;
}

.toggle-form-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.refresh-btn, .theme-toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.9rem;
    width: auto;
}

.delete-btn {
    background-color: #ff6666;
    color: white;
    border: none;
    padding: 0.3rem 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

body.light-theme .delete-btn {
    background-color: #ff4444;
}

body.light-theme .delete-btn:hover {
    background-color: #cc0000;
}

body.dark-theme .delete-btn {
    background-color: #ff6666;
}

body.dark-theme .delete-btn:hover {
    background-color: #cc3333;
}

.chart-container {
    position: relative;
    width: 100%;
    height: 50vh;
    min-height: 300px;
}

.chart-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.tooltip {
    position: absolute;
    background-color: #333;
    border: 1px solid #555;
    padding: 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.9rem;
    pointer-events: none;
    display: none;
    z-index: 10;
}

body.light-theme .tooltip {
    background-color: #fff;
    color: #333;
    border-color: #ccc;
}

.vertical-line {
    position: absolute;
    width: 2px;
    background-color: #fff;
    top: 0;
    bottom: 30px;
    display: none;
    z-index: 5;
}

body.light-theme .vertical-line {
    background-color: #333;
}

.positive {
    color: #28a745;
}

.negative {
    color: #dc3545;
}

.footer {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    font-size: 0.9rem;
    color: #bbb;
}

.footer a {
    color: #1e90ff;
    text-decoration: none;
}

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

@media (max-width: 600px) {
    h1 {
        font-size: 1.2rem;
    }
    input, select, button {
        font-size: 0.9rem;
        padding: 0.5rem;
    }
    label {
        font-size: 0.9rem;
    }
    .form-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .form-row label {
        flex: none;
    }
    .form-row input {
        width: 100%;
    }
    .toggle-form-btn, .refresh-btn, .theme-toggle-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }
    .tooltip {
        font-size: 0.8rem;
        padding: 0.3rem;
    }
    .footer {
        font-size: 0.8rem;
        bottom: 0.5rem;
        right: 0.5rem;
    }
}

@media (max-width: 400px) {
    .form-container, .list-container, .chart-container {
        padding: 0.5rem;
    }
    .chart-container {
        height: 40vh;
    }
    .header {
        flex-wrap: wrap;
    }
    .button-group {
        flex-direction: column;
        gap: 0.3rem;
    }
}