:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --background: #f8fafc;
    --text: #1e293b;
    --success: #22c55e;
    --error: #ef4444;
    --border: #e2e8f0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    line-height: 1.6;
    padding: 2rem 1rem;
    background: var(--background);
    color: var(--text);
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 2.5rem;
    border-radius: 1.5rem;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
}

.header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.header h1 {
    font-size: 2.25rem;
    margin-bottom: 0.75rem;
    color: var(--primary);
    font-weight: 700;
}

.description {
    max-width: 600px;
    margin: 0 auto 2rem;
    color: #64748b;
    font-size: 1.1rem;
    line-height: 1.8;
}

.habit-grid {
    display: grid;
    gap: 1.75rem;
    margin-bottom: 2rem;
}

.habit-card {
    padding: 1.75rem;
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    background: white;
    transition: transform 0.2s, box-shadow 0.2s;
}

.habit-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 12px -2px rgba(99, 102, 241, 0.1);
}

.habit-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.habit-name input {
    font-size: 1.125rem;
    font-weight: 600;
    border: 2px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.75rem 1.25rem;
    width: 100%;
    transition: all 0.2s;
    background: #fff;
    color: var(--text);
}

.habit-name input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.days-container {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.day-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.day-checkbox {
    appearance: none;
    width: 2.75rem;
    height: 2.75rem;
    border: 2px solid #cbd5e1;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.day-checkbox:checked::after {
    content: "✓";
    color: white;
    font-size: 1.25rem;
    font-weight: bold;
}

.day-label {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
}

.progress-container {
    margin-top: 1.75rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.progress-bar {
    height: 12px;
    flex-grow: 1;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    transition: width 0.3s ease;
}

.progress-text {
    font-weight: 700;
    color: var(--primary);
    min-width: 90px;
    text-align: right;
}

.button {
    padding: 0.875rem 1.75rem;
    border-radius: 0.875rem;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.primary-btn {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.2);
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(99, 102, 241, 0.3);
}

.print-btn {
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    width: 100%;
    justify-content: center;
    padding: 1.25rem;
    font-size: 1.125rem;
    margin-top: 2rem;
}

.remove-btn {
    background: none;
    color: var(--error);
    padding: 0.625rem 1.25rem;
    border: 1px solid var(--error);
    border-radius: 0.75rem;
    flex-shrink: 0;
}

.remove-btn:hover {
    background: #fee2e2;
}

.add-habit-btn {
    width: 100%;
    margin-bottom: 2rem;
    font-size: 1.125rem;
}

@media (max-width: 640px) {
    .container {
        padding: 1.5rem;
        border-radius: 1rem;
    }
    
    .day-item {
        flex-basis: calc(50% - 0.5rem);
    }
    
    .habit-header {
        flex-direction: column;
        align-items: stretch;
    }
}

@media print {
    body {
        background: white !important;
        padding: 0.5in !important;
        font-size: 12pt;
    }
    
    .container {
        box-shadow: none !important;
        padding: 0 !important;
        border-radius: 0 !important;
    }
    
    .print-btn,
    .add-habit-btn,
    .remove-btn {
        display: none !important;
    }
    
    .description,
    .progress-text:empty {
        display: none !important;
    }
    
    .habit-card {
        border: 2px solid #ddd !important;
        margin-bottom: 20pt;
        page-break-inside: avoid;
    }
    
    .day-checkbox {
        border-color: #666 !important;
    }
    
    .day-checkbox:checked {
        background: #666 !important;
        border-color: #666 !important;
    }
    
    .day-checkbox:checked::after {
        color: white !important;
    }
    
    .progress-fill[style*="0%"],
    .progress-text:contains("0%") {
        display: none !important;
    }
    
    .habit-name input {
        border: none !important;
        padding: 0 !important;
        font-size: 14pt !important;
        pointer-events: none;
        background: transparent !important;
    }
    
    .day-item::after {
        content: attr(data-print-status);
        font-size: 10pt;
        color: #666;
        margin-top: 2px;
    }
}