/* This rule keeps padding and borders inside each element's width. */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 24px;
    background-color: #ffffff;
    color: #111111;
    font-family: Arial, sans-serif;
}

/* Desktop: calendar on the left and today's habits on the right. */
.page {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(250px, 1fr);
    gap: 28px;
    max-width: 1400px;
    margin: 0 auto;
}

.tracker {
    min-width: 0;
    padding-right: 28px;
    border-right: 3px solid #111111;
}

h1,
h2,
h3 {
    font-family: Georgia, "Times New Roman", serif;
}

h1 {
    margin: 0 0 22px;
    font-size: 36px;
}

/* Light-grey buttons with square-ish, simple corners. */
.button {
    padding: 10px 18px;
    border: 2px solid #999999;
    border-radius: 6px;
    background-color: #eeeeee;
    color: #111111;
    font-size: 18px;
    cursor: pointer;
}

.button:hover {
    background-color: #e2e2e2;
}

.top-buttons {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.habit-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.month-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.month-label {
    padding: 7px 12px;
    border: 2px solid #999999;
    border-radius: 5px;
    background-color: #eeeeee;
    font-size: 17px;
}

.month-label span {
    margin-left: 6px;
}

/* Seven equal columns keep the dates in a real calendar grid. */
.calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    width: 100%;
    border-top: 1px solid #333333;
    border-left: 1px solid #333333;
}

.weekday,
.day {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 58px;
    padding: 6px 2px;
    border-right: 1px solid #333333;
    border-bottom: 1px solid #333333;
    text-align: center;
}

.weekday {
    min-height: 44px;
    background-color: #eeeeee;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 17px;
    font-weight: bold;
}

.day {
    font-size: 21px;
    font-weight: bold;
}

.completed {
    background-color: #b9f0b6;
}

.empty {
    background-color: #ffffff;
}

.today-panel {
    min-width: 0;
    padding: 0 8px;
}

.today-panel h2 {
    margin: 0 0 8px;
    font-size: 32px;
}

.day-count {
    margin: 0 0 30px;
    font-size: 19px;
}

.today-panel h3 {
    margin: 0 0 18px;
    font-size: 22px;
}

.habit-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.habit-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    cursor: pointer;
}

.habit-item input {
    width: 22px;
    height: 22px;
    accent-color: #83d77e;
    cursor: pointer;
}

.form-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
}

.reminder {
    margin-top: 24px;
    padding: 14px;
    border-radius: 5px;
    background-color: #eeeeee;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 18px;
    font-weight: bold;
    line-height: 1.5;
}

/* Tablet and phone: put the Today panel underneath the calendar. */
@media (max-width: 850px) {
    body {
        padding: 18px;
    }

    .page {
        grid-template-columns: minmax(0, 1fr);
        gap: 22px;
    }

    .tracker {
        padding-right: 0;
        padding-bottom: 22px;
        border-right: 0;
        border-bottom: 3px solid #111111;
    }

    .today-panel {
        padding: 0;
    }
}

/* Small phones: keep all seven calendar columns visible. */
@media (max-width: 480px) {
    body {
        padding: 12px;
    }

    h1 {
        margin-bottom: 16px;
        font-size: 30px;
    }

    .top-buttons {
        align-items: flex-start;
        justify-content: flex-start;
    }

    .button {
        padding: 8px 12px;
        font-size: 16px;
    }

    .add-button {
        margin-left: auto;
    }

    .month-label {
        padding: 6px 9px;
        font-size: 15px;
    }

    .weekday {
        min-height: 38px;
        padding: 4px 0;
        font-size: 12px;
    }

    .day {
        min-height: 44px;
        padding: 3px 0;
        font-size: 16px;
    }

    .today-panel h2 {
        font-size: 28px;
    }

    .today-panel h3 {
        font-size: 20px;
    }

    .day-count,
    .habit-item {
        font-size: 18px;
    }

    .reminder {
        font-size: 16px;
    }
}

/* Extra-small phones: make weekday labels and dates a little tighter. */
@media (max-width: 360px) {
    .weekday {
        font-size: 11px;
    }

    .day {
        min-height: 40px;
        font-size: 15px;
    }
}
