:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #22c55e;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
}

#date-display {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 1.25rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.progress-container {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
}

.habit-input form {
    display: flex;
    gap: 0.5rem;
}

.habit-input input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.habit-input input:focus {
    border-color: var(--primary);
}

.habit-input button {
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.habit-input button:hover {
    background: var(--primary-hover);
}

#habits-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.habit-item {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.1s;
}

.habit-item:active {
    transform: scale(0.98);
}

.habit-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--primary);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.checkbox.checked {
    background: var(--primary);
}

.checkbox.checked::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.habit-name {
    font-weight: 500;
    font-size: 1rem;
}

.habit-name.completed {
    text-decoration: line-through;
    color: var(--text-muted);
}

.habit-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.streak-badge {
    font-size: 0.75rem;
    background: #fee2e2;
    color: #ef4444;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
}

.longest-streak-badge {
    font-size: 0.75rem;
    background: #e0e7ff;
    color: #4338ca;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
}

.delete-btn {
    background: none;
    border: none;
    color: #cbd5e1;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0 5px;
    transition: color 0.2s;
}

.delete-btn:hover {
    color: #ef4444;
}