:root {
    --bg-color: #f8f9fa;
    --text-color: #333;
    --accent-color: #007bff;
    --card-bg: #fff;
    --border-color: #dee2e6;
}

[data-theme="dark"] {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --accent-color: #0d6efd;
    --card-bg: #1e1e1e;
    --border-color: #333;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background 0.3s, color 0.3s;
}

#app {
    max-width: 800px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: var(--card-bg);
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 1.5rem;
}

header button {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 1rem;
    min-height: 44px;
}

nav {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
}

#menu ul {
    list-style: none;
    display: flex;
    overflow-x: auto;
}

#menu li a {
    display: block;
    padding: 1rem;
    text-decoration: none;
    color: var(--text-color);
    border-bottom: 2px solid transparent;
    transition: border-color 0.3s;
}

#menu li a:hover,
#menu li a.active {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

main {
    flex: 1;
    padding: 1rem;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page section {
    background: var(--card-bg);
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

ul {
    list-style: none;
}

li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

li button {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
}

#calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
    margin: 1rem 0;
}

.day {
    background: var(--card-bg);
    padding: 0.5rem;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
}

#progress-chart {
    max-height: 300px;
    margin: 1rem 0;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    background: var(--card-bg);
    margin: 15% auto;
    padding: 2rem;
    border-radius: 0.5rem;
    width: 80%;
    max-width: 400px;
}

.close {
    color: #aaa;
    float: left;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

#task-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#task-form input,
#task-form select,
#task-form textarea {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    background: var(--bg-color);
    color: var(--text-color);
}

@media (max-width: 768px) {
    #menu ul {
        flex-direction: column;
    }
    
    header {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 20% auto;
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #121212;
        --text-color: #e0e0e0;
    }
}