:root {
    --primary: #4f46e5;
}

.container {
    font-family: 'Segoe UI', system-ui, sans-serif;
    max-width: 960px;
    margin: 0 auto;
}

.calheader {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.calendar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    padding: 10px 18px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.nav-btn {
    width: 42px;
    height: 42px;
    border: none;
    background: #f1f5f9;
    border-radius: 50%;
    font-size: 1.6rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover {
    background: #e2e8f0;
}

.month-title {
    font-size: 1.45rem;
    font-weight: 600;
    min-width: 170px;
    text-align: center;
    white-space: nowrap;
}

/* Weekday Headers - Same width and alignment as grid */
.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 8px;
    padding: 0 10px;
}

.weekday {
    text-align: center;
    font-weight: 600;
    color: #64748b;
    font-size: 0.95rem;
    padding: 8px 0;
}

/* Calendar Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    background: #e2e8f0;
    padding: 10px;
    border-radius: 24px;
}

.day-cell {
    background: white;
    border-radius: 16px;
    padding: 10px;
    min-height: 118px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.day-cell:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(79, 70, 229, 0.18);
}

.day-cell.other-month {
    opacity: 0.48;
}

.day-cell.today {
    border: 3px solid var(--primary);
}

.day-number {
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.day-cell.today .day-number {
    background: var(--primary);
    color: white;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.25rem;
}

.event-count {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--primary);
    color: white;
    font-size: 0.78rem;
    font-weight: 700;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.event-pill {
    font-size: 0.78rem;
    padding: 3px 8px;
    margin-bottom: 4px;
    border-radius: 9999px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 15px;
}

.modal {
    background: white;
    width: 100%;
    max-width: 480px;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 22px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.modal-date {
    font-size: 1.45rem;
    font-weight: 600;
    line-height: 1.2;
}

.modal-weekday {
    color: #64748b;
    font-size: 1rem;
    margin-top: 4px;
}

.modal-close {
    font-size: 1.9rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #64748b;
    margin-top: -6px;
}

.modal-events {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-event {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 16px;
    border-left: 5px solid var(--primary);
}

.event-time {
    font-family: monospace;
    font-size: 0.95rem;
    font-weight: 600;
    color: #475569;
    min-width: 65px;
}

.event-content h3 {
    margin-bottom: 6px;
    font-size: 1.08rem;
}

.event-content p {
    font-size: 0.96rem;
    color: #64748b;
    line-height: 1.45;
}

@media (max-width: 640px) {
    .calendar-grid,
    .weekdays {
        gap: 6px;
    }
    .day-cell {
        min-height: 106px;
        padding: 9px;
    }
}