.ap-month-page {
    width: min(1440px, calc(100vw - 48px));
    margin: 0 auto;
    padding: 24px 0 42px;
    color: var(--text, #172033);
}

.ap-month-toolbar,
.ap-month-detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.ap-month-toolbar h1,
.ap-month-detail-head h2 {
    margin: 0;
    font-size: 24px;
    line-height: 1.25;
}

.ap-month-toolbar p,
.ap-month-detail-head p {
    margin: 6px 0 0;
    color: #667085;
    font-size: 13px;
}

.ap-month-actions,
.ap-month-compare {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.ap-month-actions input,
.ap-month-compare input,
.ap-month-actions button,
.ap-month-compare button {
    min-height: 38px;
    border-radius: 8px;
    border: 1px solid #d0d5dd;
    background: #fff;
    padding: 0 12px;
    font-weight: 700;
}

.ap-month-actions button,
.ap-month-compare button {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff;
}

.ap-month-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 18px;
}

.ap-month-sidebar {
    display: grid;
    align-content: start;
    gap: 8px;
}

.ap-month-card {
    width: 100%;
    text-align: left;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    background: #fff;
    padding: 12px;
    color: inherit;
}

.ap-month-card.is-active {
    border-color: #1d4ed8;
    box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.12);
}

.ap-month-card strong,
.ap-month-card span,
.ap-month-card small {
    display: block;
}

.ap-month-card span,
.ap-month-card small {
    margin-top: 4px;
    color: #667085;
}

.ap-month-detail {
    min-width: 0;
}

.ap-month-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 10px;
}

.ap-month-cell {
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    background: #fff;
    padding: 12px;
    min-height: 142px;
}

.ap-month-cell-top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.ap-month-cell-top strong,
.ap-month-cell-top span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.ap-month-cell-meta {
    margin-top: 6px;
    color: #667085;
    font-size: 12px;
}

.ap-month-students {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 10px;
}

.ap-month-students span {
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    padding: 3px 7px;
    font-size: 12px;
    font-weight: 700;
}

.ap-month-students em,
.ap-month-empty,
.ap-month-error {
    color: #667085;
    font-style: normal;
}

.ap-month-error {
    color: #b42318;
    margin-bottom: 12px;
}

.ap-month-changes {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.ap-month-change-block {
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    padding: 12px;
    background: #fff;
}

.ap-month-change-block h3 {
    margin: 0 0 8px;
    font-size: 15px;
}

.ap-month-change-block p {
    margin: 6px 0;
    font-size: 13px;
}

@media (max-width: 820px) {
    .ap-month-page { width: calc(100vw - 24px); }
    .ap-month-toolbar,
    .ap-month-detail-head { align-items: stretch; flex-direction: column; }
    .ap-month-actions,
    .ap-month-compare { justify-content: flex-start; }
    .ap-month-layout,
    .ap-month-changes { grid-template-columns: 1fr; }
}

@media print {
    body.ap-month-printing * { visibility: hidden !important; }
    body.ap-month-printing .ap-month-page,
    body.ap-month-printing .ap-month-page * { visibility: visible !important; }
    body.ap-month-printing .ap-month-page {
        position: absolute;
        inset: 0;
        width: auto;
        padding: 0;
    }
    body.ap-month-printing .ap-month-sidebar,
    body.ap-month-printing .ap-month-actions,
    body.ap-month-printing .ap-month-compare,
    body.ap-month-printing #app-drawer,
    body.ap-month-printing #app-drawer-overlay { display: none !important; }
    body.ap-month-printing .ap-month-layout { display: block; }
    body.ap-month-printing .ap-month-cell { break-inside: avoid; }
}
