:root {
    --bg: #f3f4f6;
    --ink: #111827;
    --paper: #ffffff;
    --accent: #4f46e5;
    --dim: #6b7280;
    --line: #e5e7eb;
    --success: #10b981;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg);
    color: var(--ink);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Layout Structure */
main {
    max-width: 1024px;
    margin: 0 auto;
    padding: 40px;
    min-height: 100vh;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 32px;
}

.logo-section h1 {
    font-size: 32px;
    font-weight: 800;
    margin: 0;
    color: #1f2937;
    letter-spacing: -0.025em;
}

.logo-section p {
    color: var(--dim);
    margin: 4px 0 0 0;
    font-size: 16px;
}

.date-section {
    text-align: right;
}

#current-day {
    font-size: 24px;
    font-weight: 700;
    color: var(--ink);
    display: none; /* Layout change: using p in logo-section for date */
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--paper);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--line);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #9ca3af;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--ink);
    margin-top: 4px;
}

.stat-sub {
    font-size: 12px;
    color: var(--success);
    margin-top: 4px;
    font-weight: 500;
}

/* Main Content Card */
.main-card {
    background: var(--paper);
    border-radius: 16px;
    border: 1px solid var(--line);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Habit Form */
.add-habit-container {
    padding: 24px;
    border-bottom: 1px solid var(--line);
}

.habit-form {
    display: flex;
    gap: 12px;
    width: 100%;
}

input[type="text"] {
    flex: 1;
    background: #f9fafb;
    border: 1px solid var(--line);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 15px;
    font-family: var(--font-sans);
    outline: none;
    transition: all 0.2s ease;
}

input[type="text"]:focus {
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

button.add-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

button.add-btn:hover {
    background: #4338ca;
}

/* Habit List */
.habits-grid {
    display: flex;
    flex-direction: column;
}

.habit-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.2s ease;
}

.habit-card:hover {
    background: #fafafa;
}

.habit-card:last-child {
    border-bottom: none;
}

.habit-info-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.habit-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #e0e7ff;
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
}

.habit-text-stack {
    display: flex;
    flex-direction: column;
}

.habit-title {
    font-weight: 600;
    font-size: 16px;
    color: #374151;
}

.streak-count {
    font-size: 12px;
    color: var(--dim);
    font-weight: 500;
    margin-top: 2px;
}

.habit-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Checkbox Styling */
.check-action {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.custom-checkbox {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

input[type="checkbox"] {
    display: none;
}

input[type="checkbox"]:checked + .custom-checkbox {
    background-color: var(--accent);
    border-color: var(--accent);
    transform: scale(1.05);
}

input[type="checkbox"]:checked + .custom-checkbox::after {
    content: '✓';
    color: white;
    font-size: 20px;
}

.delete-btn {
    background: none;
    border: none;
    color: #d1d5db;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

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

/* Empty State */
.empty-state {
    padding: 60px 24px;
    text-align: center;
    color: var(--dim);
}

.empty-state p {
    font-size: 16px;
    font-weight: 500;
}

/* Responsive Overrides */
@media (max-width: 768px) {
    main {
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
}
