/* Batch 5 focused school overview, classes and settings pages. */

.r2-school-data-page {
    display: grid;
    gap: var(--r2-space-6);
    width: min(100%, 1180px);
    margin-inline: auto;
}

.r2-school-data-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--r2-space-5);
    padding-block: var(--r2-space-2) var(--r2-space-4);
    border-bottom: 1px solid var(--r2-border);
}

.r2-school-data-header h1 {
    margin: var(--r2-space-1) 0 var(--r2-space-2);
    color: var(--r2-text);
    font-size: clamp(1.65rem, 2vw, 2.15rem);
    line-height: var(--r2-line-tight);
}

.r2-school-data-header p {
    max-width: 58rem;
    margin: 0;
    color: var(--r2-text-secondary);
}

.r2-school-data-context {
    color: var(--r2-primary) !important;
    font-size: var(--r2-font-size-xs);
    font-weight: var(--r2-weight-medium);
}

.r2-school-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-block: 1px solid var(--r2-border);
}

.r2-school-summary > div {
    display: flex;
    min-width: 0;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--r2-space-3);
    padding: var(--r2-space-3) var(--r2-space-4);
}

.r2-school-summary > div + div {
    border-left: 1px solid var(--r2-border);
}

.r2-school-summary span {
    color: var(--r2-text-muted);
    font-size: var(--r2-font-size-sm);
}

.r2-school-summary strong {
    overflow: hidden;
    color: var(--r2-text);
    font-size: var(--r2-font-size-lg);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.r2-school-data-section {
    min-width: 0;
    padding-block: var(--r2-space-4);
    border-block: 1px solid var(--r2-border);
    background: transparent;
}

.r2-school-data-section + .r2-school-data-section {
    margin-top: calc(var(--r2-space-2) * -1);
}

.r2-school-data-section__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--r2-space-4);
    margin-bottom: var(--r2-space-4);
}

.r2-school-data-section__header h2 {
    margin: 0;
    color: var(--r2-text);
    font-size: var(--r2-font-size-lg);
}

.r2-school-data-section__header p {
    margin: var(--r2-space-1) 0 0;
    color: var(--r2-text-secondary);
    font-size: var(--r2-font-size-sm);
}

.r2-school-link-list,
.r2-school-section-list {
    display: grid;
}

.r2-school-link-row,
.r2-school-section-list > a {
    display: grid;
    min-width: 0;
    align-items: center;
    gap: var(--r2-space-3);
    min-height: 4rem;
    padding-block: var(--r2-space-3);
    border-top: 1px solid var(--r2-divider);
    color: inherit;
    text-decoration: none;
}

.r2-school-link-row {
    grid-template-columns: 2rem minmax(0, 1fr) auto;
}

.r2-school-section-list > a {
    grid-template-columns: minmax(0, 1fr) auto;
}

.r2-school-link-row:hover,
.r2-school-section-list > a:hover {
    background: var(--r2-surface-subtle);
}

.r2-school-link-row:focus-visible,
.r2-school-section-list > a:focus-visible,
.r2-section-tabs a:focus-visible {
    outline: none;
    box-shadow: var(--r2-focus-ring);
}

.r2-school-link-row__icon {
    display: grid;
    width: 1.75rem;
    height: 1.75rem;
    place-items: center;
}

.r2-school-link-row__icon img {
    width: 1.15rem;
    height: 1.15rem;
}

.r2-school-link-row__body,
.r2-school-section-list a > span:first-child {
    display: grid;
    min-width: 0;
    gap: 0.1rem;
}

.r2-school-link-row__body strong,
.r2-school-section-list strong {
    color: var(--r2-text);
    font-size: var(--r2-font-size-base);
}

.r2-school-link-row__body small,
.r2-school-section-list small {
    color: var(--r2-text-muted);
    font-size: var(--r2-font-size-sm);
}

.r2-school-inline-actions,
.r2-inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--r2-space-2);
}

.r2-section-tabs {
    display: flex;
    overflow-x: auto;
    border-bottom: 1px solid var(--r2-border);
    scrollbar-width: thin;
}

.r2-section-tabs a {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: var(--r2-space-2);
    min-height: 2.75rem;
    padding: var(--r2-space-2) var(--r2-space-4);
    border-bottom: 3px solid transparent;
    color: var(--r2-text-secondary);
    font-size: var(--r2-font-size-sm);
    text-decoration: none;
}

.r2-section-tabs a[aria-current="page"] {
    border-bottom-color: var(--r2-primary);
    color: var(--r2-primary);
    font-weight: var(--r2-weight-medium);
}

.r2-section-tabs small {
    color: var(--r2-text-muted);
}

.r2-class-workspace {
    display: grid;
    gap: var(--r2-space-6);
}

.r2-class-readiness {
    padding: var(--r2-space-4) var(--r2-space-5);
    border-left: 4px solid var(--r2-danger);
    background: var(--r2-danger-soft);
}

.r2-class-readiness__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--r2-space-4);
}

.r2-class-readiness h2 {
    margin: 0;
    font-size: var(--r2-font-size-lg);
}

.r2-class-readiness p {
    margin: var(--r2-space-1) 0 0;
    color: var(--r2-text-secondary);
    font-size: var(--r2-font-size-sm);
}

.r2-class-batch-form {
    display: grid;
    gap: var(--r2-space-2);
}

.r2-class-batch-form__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--r2-space-4);
}

.r2-class-batch-form__footer p {
    margin: 0;
}

.r2-draft-recovery {
    margin-bottom: var(--r2-space-4);
}

.r2-class-list {
    display: grid;
}

.r2-class-list__head,
.r2-class-row {
    display: grid;
    grid-template-columns: minmax(6rem, 0.65fr) minmax(8rem, 0.75fr) minmax(9rem, 0.9fr) minmax(13rem, 1.45fr) minmax(8.5rem, 0.75fr) 2.5rem;
    gap: var(--r2-space-3);
    align-items: center;
}

.r2-class-list__head {
    min-height: 2.5rem;
    padding-inline: var(--r2-space-2);
    border-bottom: 1px solid var(--r2-border-strong);
    color: var(--r2-text-muted);
    font-size: var(--r2-font-size-xs);
    font-weight: var(--r2-weight-medium);
}

.r2-class-row {
    min-width: 0;
    min-height: 4.5rem;
    padding: var(--r2-space-3) var(--r2-space-2);
    border-bottom: 1px solid var(--r2-divider);
}

.r2-class-row:hover {
    background: var(--r2-surface-subtle);
}

.r2-class-row__name {
    display: grid;
    min-width: 0;
    gap: 0.1rem;
}

.r2-class-row__name strong {
    overflow: hidden;
    color: var(--r2-text);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.r2-class-row__name small,
.r2-class-row__not-applicable {
    color: var(--r2-text-muted);
    font-size: var(--r2-font-size-sm);
}

.r2-class-row .r2-form-field {
    min-width: 0;
}

.r2-class-row .r2-select {
    width: 100%;
    min-width: 0;
}

.r2-class-row .r2-form-error {
    margin-top: var(--r2-space-1);
}

.r2-class-row__state {
    min-width: 0;
}

.r2-row-menu {
    position: relative;
    justify-self: end;
}

.r2-row-menu summary {
    display: grid;
    width: 2rem;
    height: 2rem;
    place-items: center;
    border: 1px solid transparent;
    border-radius: var(--r2-radius-sm);
    color: var(--r2-text-secondary);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    list-style: none;
}

.r2-row-menu summary::-webkit-details-marker {
    display: none;
}

.r2-row-menu summary:hover,
.r2-row-menu summary:focus-visible {
    border-color: var(--r2-border);
    background: var(--r2-surface);
    outline: none;
}

.r2-row-menu__panel {
    position: absolute;
    z-index: 20;
    top: calc(100% + var(--r2-space-1));
    right: 0;
    display: grid;
    width: min(18rem, 80vw);
    padding: var(--r2-space-1);
    border: 1px solid var(--r2-border);
    border-radius: var(--r2-radius-overlay);
    background: var(--r2-surface);
    box-shadow: var(--r2-shadow-menu);
}

.r2-row-menu__item {
    width: 100%;
    padding: var(--r2-space-2) var(--r2-space-3);
    border: 0;
    border-radius: var(--r2-radius-sm);
    background: transparent;
    color: var(--r2-text);
    font: inherit;
    font-size: var(--r2-font-size-sm);
    text-align: left;
    cursor: pointer;
}

.r2-row-menu__item:hover:not(:disabled),
.r2-row-menu__item:focus-visible:not(:disabled) {
    background: var(--r2-surface-muted);
    outline: none;
}

.r2-row-menu__item:disabled {
    color: var(--r2-text-disabled);
    cursor: not-allowed;
}

.r2-row-menu__item--danger {
    color: var(--r2-danger);
}

.r2-hidden-form {
    display: none;
}

.r2-settings-form {
    display: grid;
    gap: var(--r2-space-5);
}

.r2-settings-form__status {
    position: sticky;
    z-index: 5;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--r2-space-2);
    min-height: 2.5rem;
    padding-block: var(--r2-space-1);
    background: var(--r2-bg);
}

.r2-settings-switches {
    display: grid;
    max-width: 50rem;
}

.r2-settings-switches .r2-form-error {
    margin: calc(var(--r2-space-2) * -1) 0 var(--r2-space-2);
}

.r2-settings-note {
    max-width: var(--r2-readable-max);
    margin: var(--r2-space-3) 0 0;
    color: var(--r2-text-muted);
    font-size: var(--r2-font-size-sm);
}

.r2-danger-disclosure {
    margin-top: var(--r2-space-4);
    border-top: 1px solid var(--r2-danger-border);
}

.r2-danger-disclosure > summary {
    padding-block: var(--r2-space-4);
    color: var(--r2-danger);
    font-weight: var(--r2-weight-medium);
    cursor: pointer;
}

.r2-danger-disclosure__body {
    display: grid;
    gap: var(--r2-space-3);
    max-width: 38rem;
    padding: var(--r2-space-4);
    border-left: 4px solid var(--r2-danger);
    background: var(--r2-danger-soft);
}

.r2-danger-disclosure__body h2,
.r2-danger-disclosure__body p {
    margin: 0;
}

.r2-danger-disclosure__body form {
    display: grid;
    gap: var(--r2-space-3);
}

@media (max-width: 960px) {
    .r2-class-list__head {
        display: none;
    }

    .r2-class-row {
        grid-template-columns: minmax(7rem, 0.7fr) minmax(8rem, 0.8fr) minmax(12rem, 1.4fr) minmax(8rem, 0.7fr) 2.5rem;
    }
}

@media (max-width: 760px) {
    .r2-school-data-header,
    .r2-class-readiness__head,
    .r2-class-batch-form__footer {
        align-items: stretch;
        flex-direction: column;
    }

    .r2-school-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .r2-school-summary > div:nth-child(3) {
        border-top: 1px solid var(--r2-border);
        border-left: 0;
    }

    .r2-school-summary > div:nth-child(4) {
        border-top: 1px solid var(--r2-border);
    }

    .r2-class-row {
        grid-template-columns: minmax(0, 1fr) 2.5rem;
        gap: var(--r2-space-2) var(--r2-space-3);
        align-items: start;
    }

    .r2-class-row__name,
    .r2-class-row .r2-form-field,
    .r2-class-row__state {
        grid-column: 1;
    }

    .r2-row-menu {
        grid-column: 2;
        grid-row: 1;
    }
}


/* School day profiles ---------------------------------------------------- */
.r2-day-profiles-page {
    width: min(100%, 1540px);
}

.r2-day-profiles-header {
    margin-bottom: 0;
}

.r2-day-profile-picker {
    min-width: 0;
}

.r2-day-profile-picker__scroll {
    display: flex;
    gap: var(--r2-space-3);
    padding: 2px 2px var(--r2-space-2);
    overflow-x: auto;
    scrollbar-width: thin;
}

.r2-day-profile-card,
.r2-day-profile-add-card {
    flex: 0 0 260px;
    min-height: 84px;
    padding: 14px 16px;
    border: 1px solid var(--r2-border);
    border-radius: var(--r2-radius-lg, 14px);
    background: var(--r2-surface, #fff);
    color: var(--r2-text);
    text-align: left;
    cursor: pointer;
}

.r2-day-profile-card {
    position: relative;
}

.r2-day-profile-card::before {
    position: absolute;
    top: -1px;
    right: 12px;
    left: 12px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: transparent;
    content: "";
}

.r2-day-profile-card:hover,
.r2-day-profile-add-card:hover {
    border-color: var(--r2-primary-border, #f1b987);
    background: var(--r2-surface-subtle, #f8fafc);
}

.r2-day-profile-card.is-active {
    border-color: var(--r2-primary-border, #f1b987);
    background: #fffaf5;
    box-shadow: 0 0 0 1px rgba(234, 122, 32, 0.06);
}

.r2-day-profile-card.is-active::before {
    background: var(--r2-primary, #ea7a20);
}

.r2-day-profile-card__top {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: var(--r2-space-2);
}

.r2-day-profile-card__top strong {
    overflow: hidden;
    font-size: var(--r2-font-size-base);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.r2-day-profile-card__top small {
    flex: 0 0 auto;
    padding: 3px 7px;
    border-radius: 999px;
    background: #fff1e6;
    color: #9a4b0d;
    font-size: 0.7rem;
    font-weight: 650;
    white-space: nowrap;
}

.r2-day-profile-card__meta {
    display: block;
    margin-top: 8px;
    color: var(--r2-text-muted, #667085);
    font-size: var(--r2-font-size-sm);
    white-space: nowrap;
}

.r2-day-profile-add-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--r2-space-2);
    border-style: dashed;
    color: var(--r2-text-secondary);
    text-align: center;
}

.r2-day-profile-add-card span {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 50%;
    background: var(--r2-surface-subtle, #f7f8fa);
    color: var(--r2-primary, #ea7a20);
    font-size: 1.25rem;
}

.r2-day-profile-workspace {
    min-width: 0;
    border: 1px solid var(--r2-border);
    border-radius: var(--r2-radius-lg, 16px);
    background: var(--r2-surface, #fff);
    overflow: hidden;
}

.r2-day-profile-workspace__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--r2-space-5);
    padding: 20px 22px;
    border-bottom: 1px solid var(--r2-divider, #edf0f3);
}

.r2-day-profile-title-block {
    min-width: 0;
    flex: 1 1 auto;
}

.r2-day-profile-title-line {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: var(--r2-space-3);
}

.r2-day-profile-title-line h2 {
    margin: 0;
    color: var(--r2-text);
    font-size: clamp(1.25rem, 1.5vw, 1.55rem);
}

.r2-day-profile-summary {
    display: flex;
    flex-wrap: wrap;
    gap: var(--r2-space-2);
    margin-top: var(--r2-space-3);
}

.r2-day-profile-summary span {
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--r2-surface-subtle, #f7f8fa);
    color: var(--r2-text-muted, #667085);
    font-size: var(--r2-font-size-xs, .78rem);
    white-space: nowrap;
}

.r2-day-profile-summary strong {
    color: var(--r2-text);
}

.r2-day-profile-head-actions {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--r2-space-2);
    max-width: 620px;
}

.r2-day-profile-head-actions .r2-button {
    white-space: nowrap;
}

.r2-day-profile-rename {
    margin-top: var(--r2-space-3);
    max-width: 620px;
}

.r2-day-profile-rename__row {
    display: flex;
    align-items: center;
    gap: var(--r2-space-2);
    margin-top: var(--r2-space-2);
}

.r2-day-profile-modebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--r2-space-4);
    padding: 14px 22px;
    border-bottom: 1px solid var(--r2-divider, #edf0f3);
    background: var(--r2-surface-subtle, #f8fafc);
}

.r2-day-profile-link-toggle {
    display: flex;
    align-items: flex-start;
    gap: var(--r2-space-3);
    cursor: pointer;
}

.r2-day-profile-link-toggle input {
    margin-top: 3px;
}

.r2-day-profile-link-toggle span {
    display: grid;
    gap: 2px;
}

.r2-day-profile-link-toggle strong {
    color: var(--r2-text);
    font-size: var(--r2-font-size-sm);
}

.r2-day-profile-link-toggle small,
.r2-day-profile-mode-note {
    color: var(--r2-text-muted);
    font-size: var(--r2-font-size-xs);
}

.r2-day-profile-mode-note {
    text-align: right;
}

.r2-day-profile-week-shell {
    min-width: 0;
    overflow-x: auto;
    padding: 20px 22px 24px;
}

.r2-day-profile-week {
    min-width: 0;
}

.r2-day-week-grid {
    --day-columns: 5;
    display: grid;
    grid-template-columns: 52px repeat(var(--day-columns), minmax(178px, 1fr));
    min-width: calc(52px + var(--day-columns) * 178px);
    border: 1px solid var(--r2-border);
    border-radius: var(--r2-radius-lg, 14px);
    overflow: hidden;
    background: var(--r2-surface);
}

.r2-day-week-grid.is-linked {
    grid-template-columns: 72px minmax(300px, 540px);
    min-width: min(100%, 612px);
    width: min(100%, 612px);
}

.r2-day-week-corner,
.r2-day-week-day-head,
.r2-day-week-row-label,
.r2-day-week-cell,
.r2-day-week-break-label,
.r2-day-week-break-cell,
.r2-day-week-add-cell {
    min-width: 0;
    border-right: 1px solid var(--r2-divider, #edf0f3);
}

.r2-day-week-day-head:last-child,
.r2-day-week-cell:nth-child(6n),
.r2-day-week-break-cell:nth-child(6n) {
    border-right: 0;
}

.r2-day-week-corner,
.r2-day-week-day-head {
    min-height: 72px;
    padding: 12px;
    border-bottom: 1px solid var(--r2-border);
    background: var(--r2-surface-subtle, #f8fafc);
}

.r2-day-week-corner {
    display: grid;
    place-items: center;
    color: var(--r2-text-muted);
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.r2-day-week-day-head {
    display: grid;
    align-content: center;
    gap: 3px;
}

.r2-day-week-day-head strong {
    color: var(--r2-text);
    font-size: var(--r2-font-size-sm);
}

.r2-day-week-day-head > span {
    color: var(--r2-text-muted);
    font-size: var(--r2-font-size-xs);
}

.r2-day-week-copy {
    width: max-content;
    max-width: 100%;
    margin-top: 3px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--r2-primary, #c86518);
    font-size: .72rem;
    cursor: pointer;
    white-space: nowrap;
}

.r2-day-week-row-label,
.r2-day-week-cell {
    min-height: 86px;
    border-bottom: 1px solid var(--r2-divider, #edf0f3);
}

.r2-day-week-row-label {
    display: grid;
    place-items: center;
    background: var(--r2-surface-subtle, #fafbfc);
    color: var(--r2-text-secondary);
}

.r2-day-week-row-label strong {
    font-size: var(--r2-font-size-base);
}

.r2-day-week-cell {
    padding: 7px;
}

.r2-day-week-lesson {
    display: grid;
    width: 100%;
    height: 100%;
    min-height: 70px;
    align-content: center;
    gap: 3px;
    padding: 10px 11px;
    border: 1px solid #d9e2ee;
    border-left: 3px solid #9fbde0;
    border-radius: 9px;
    background: #f4f7fb;
    color: var(--r2-text);
    text-align: left;
    cursor: pointer;
}

.r2-day-week-lesson:hover:not(:disabled) {
    border-color: #9fbde0;
    background: #edf3fa;
}

.r2-day-week-lesson:focus-visible,
.r2-day-week-break:focus-visible,
.r2-day-profile-card:focus-visible,
.r2-day-profile-add-card:focus-visible {
    outline: none;
    box-shadow: var(--r2-focus-ring);
}

.r2-day-week-lesson strong {
    font-size: var(--r2-font-size-sm);
}

.r2-day-week-lesson span {
    color: var(--r2-text-secondary);
    font-size: var(--r2-font-size-xs);
}

.r2-day-week-lesson small {
    margin-top: 2px;
    color: var(--r2-primary, #c86518);
    font-size: .69rem;
    opacity: 0;
    transition: opacity .12s ease;
}

.r2-day-week-lesson:hover small,
.r2-day-week-lesson:focus-visible small {
    opacity: 1;
}

.r2-day-week-break-label,
.r2-day-week-break-cell {
    min-height: 38px;
    border-bottom: 1px solid var(--r2-divider, #edf0f3);
    background: #fff;
}

.r2-day-week-break-label {
    display: grid;
    place-items: center;
    padding: 4px;
    color: var(--r2-text-muted);
    font-size: .62rem;
    text-transform: uppercase;
}

.r2-day-week-break-cell {
    display: grid;
    align-items: center;
    padding: 5px 7px;
}

.r2-day-week-break {
    width: 100%;
    min-height: 26px;
    padding: 4px 8px;
    border: 1px dashed #d5dbe4;
    border-radius: 7px;
    background: #fff;
    color: var(--r2-text-muted);
    font-size: .72rem;
    cursor: pointer;
}

.r2-day-week-break:hover:not(:disabled) {
    border-color: var(--r2-primary-border, #f1b987);
    background: #fffaf5;
    color: var(--r2-text-secondary);
}

.r2-day-week-break--long,
.r2-day-week-break--lunch {
    border-style: solid;
    background: #fff8ef;
    color: #8a4b16;
}

.r2-day-week-empty {
    display: grid;
    height: 100%;
    place-items: center;
    color: var(--r2-text-muted);
}

.r2-day-week-add-cell {
    display: flex;
    min-height: 58px;
    align-items: center;
    padding: 9px;
    background: var(--r2-surface-subtle, #fafbfc);
}

.r2-day-week-add-cell .r2-button {
    width: 100%;
    justify-content: center;
    white-space: nowrap;
}

.r2-day-profile-editor__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--r2-space-4);
    padding: 16px 22px;
    border-top: 1px solid var(--r2-divider, #edf0f3);
}

.r2-day-profile-editor__footer .r2-form-help {
    margin: 0;
}

.r2-day-profile-editor__footer .r2-form-help[data-state="error"],
.r2-day-dialog-fields .r2-form-help[data-state="error"] {
    color: #b42318;
}

.r2-day-profile-editor__footer .r2-form-help[data-state="saved"] {
    color: #067647;
}

.r2-day-profile-editor__footer .r2-form-help[data-state="dirty"] {
    color: #b54708;
}

.r2-button--danger-text {
    color: #b42318;
}

/* Day-profile dialogs */
.r2-day-editor-dialog,
.r2-day-assign-dialog {
    width: min(calc(100vw - 32px), 560px);
    max-height: min(88vh, 820px);
    padding: 0;
    overflow: auto;
    border: 1px solid var(--r2-border);
    border-radius: var(--r2-radius-lg, 16px);
    background: var(--r2-surface, #fff);
    color: var(--r2-text);
    box-shadow: var(--r2-shadow-dialog, 0 20px 55px rgba(16, 24, 40, .18));
}

.r2-day-assign-dialog {
    width: min(calc(100vw - 32px), 920px);
}

.r2-day-editor-dialog::backdrop,
.r2-day-assign-dialog::backdrop {
    background: rgba(16, 24, 40, .34);
}

.r2-day-editor-dialog form,
.r2-day-assign-dialog form {
    margin: 0;
    padding: 20px;
}

.r2-day-dialog-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--r2-space-4);
    padding-bottom: 16px;
    border-bottom: 1px solid var(--r2-divider, #edf0f3);
}

.r2-day-dialog-head h2 {
    margin: 2px 0 0;
    font-size: 1.25rem;
}

.r2-day-dialog-head p:not(.r2-school-data-context) {
    margin: 6px 0 0;
    color: var(--r2-text-secondary);
    font-size: var(--r2-font-size-sm);
}

.r2-day-dialog-fields {
    display: grid;
    gap: 16px;
    padding: 18px 0;
}

.r2-day-dialog-fields > label {
    display: grid;
    gap: 6px;
}

.r2-input-with-suffix {
    position: relative;
    display: block;
}

.r2-input-with-suffix .r2-input {
    width: 100%;
    padding-right: 46px;
}

.r2-input-with-suffix small {
    position: absolute;
    top: 50%;
    right: 12px;
    color: var(--r2-text-muted);
    transform: translateY(-50%);
    pointer-events: none;
}

.r2-day-dialog-actions {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: var(--r2-space-2);
    padding-top: 16px;
    border-top: 1px solid var(--r2-divider, #edf0f3);
}

.r2-day-assign-toolbar,
.r2-day-profile-class-group__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--r2-space-3);
}

.r2-day-assign-toolbar {
    margin: 16px 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--r2-surface-subtle, #f8fafc);
}

.r2-day-profile-class-groups {
    display: grid;
    gap: 20px;
    max-height: 52vh;
    padding-right: 4px;
    overflow-y: auto;
}

.r2-day-profile-class-group__head {
    margin-bottom: 8px;
}

.r2-day-profile-class-group__head > div {
    display: flex;
    align-items: baseline;
    gap: var(--r2-space-2);
}

.r2-day-profile-class-group__head span {
    color: var(--r2-text-muted);
    font-size: var(--r2-font-size-xs);
}

.r2-day-profile-class-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    gap: 7px;
}

.r2-day-profile-class-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    min-height: 58px;
    padding: 9px 10px;
    border: 1px solid var(--r2-border);
    border-radius: 10px;
    background: var(--r2-surface);
    cursor: pointer;
}

.r2-day-profile-class-row:hover:not(.is-current) {
    background: var(--r2-surface-subtle, #f8fafc);
}

.r2-day-profile-class-row.is-current {
    background: #f4fbf7;
    cursor: default;
}

.r2-day-profile-class-row__body {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.r2-day-profile-class-row__body strong,
.r2-day-profile-class-row__body small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.r2-day-profile-class-row__body strong {
    font-size: var(--r2-font-size-sm);
}

.r2-day-profile-class-row__body small {
    color: var(--r2-text-muted);
    font-size: var(--r2-font-size-xs);
}

.r2-day-assign-actions {
    grid-template-columns: 1fr auto;
    margin-top: 18px;
}

.r2-empty-action {
    display: flex;
    justify-content: center;
}

@media (max-width: 1100px) {
    .r2-day-profile-workspace__head {
        flex-direction: column;
    }

    .r2-day-profile-head-actions {
        justify-content: flex-start;
        max-width: none;
    }

    .r2-day-profile-modebar {
        align-items: flex-start;
        flex-direction: column;
    }

    .r2-day-profile-mode-note {
        text-align: left;
    }
}

@media (max-width: 700px) {
    .r2-day-profile-card,
    .r2-day-profile-add-card {
        flex-basis: 220px;
    }

    .r2-day-profile-workspace__head,
    .r2-day-profile-modebar,
    .r2-day-profile-week-shell,
    .r2-day-profile-editor__footer {
        padding-right: 14px;
        padding-left: 14px;
    }

    .r2-day-profile-head-actions,
    .r2-day-profile-rename__row,
    .r2-day-profile-editor__footer {
        align-items: stretch;
        flex-direction: column;
    }

    .r2-day-profile-head-actions .r2-button,
    .r2-day-profile-rename__row .r2-button,
    .r2-day-profile-editor__footer .r2-button {
        width: 100%;
        justify-content: center;
    }

    .r2-day-dialog-actions {
        grid-template-columns: 1fr 1fr;
    }

    .r2-day-dialog-actions > span {
        display: none;
    }

    .r2-day-dialog-actions [data-day-item-delete] {
        grid-column: 1 / -1;
        justify-self: start;
    }

    .r2-day-assign-actions {
        grid-template-columns: 1fr;
    }
}

/* Day profiles v2.2: isolate the editor from the legacy orange button defaults. */
body.has-app-shell .r2-day-profiles-page button[type="button"],
body.has-app-shell .r2-day-profiles-page button[type="submit"] {
    transform: none;
    box-shadow: none;
}

body.has-app-shell .r2-day-profiles-page .r2-day-profile-card[type="button"] {
    min-height: 78px;
    padding: 13px 15px;
    border: 1px solid var(--r2-border, #d9dee7);
    border-radius: 12px;
    background: var(--r2-surface, #fff);
    color: var(--r2-text, #172033);
    box-shadow: none;
}

body.has-app-shell .r2-day-profiles-page .r2-day-profile-card[type="button"]:hover {
    transform: none;
    border-color: var(--r2-primary-border, #9eb3d3);
    background: var(--r2-surface-subtle, #f8fafc);
}

body.has-app-shell .r2-day-profiles-page .r2-day-profile-card[type="button"].is-active {
    border-color: var(--r2-primary, #234f93);
    background: var(--r2-primary-soft, #e9eff8);
    color: var(--r2-text, #172033);
    box-shadow: inset 0 0 0 1px rgba(35, 79, 147, .08);
}

body.has-app-shell .r2-day-profiles-page .r2-day-profile-card[type="button"].is-active::before {
    background: var(--r2-primary, #234f93);
}

body.has-app-shell .r2-day-profiles-page .r2-day-profile-card__top small {
    background: #eef3fb;
    color: #234f93;
}

body.has-app-shell .r2-day-profiles-page .r2-day-profile-add-card[type="button"] {
    min-height: 78px;
    padding: 13px 16px;
    border: 1px dashed var(--r2-border-strong, #b8c1ce);
    border-radius: 12px;
    background: transparent;
    color: var(--r2-text-secondary, #475467);
    box-shadow: none;
}

body.has-app-shell .r2-day-profiles-page .r2-day-profile-add-card[type="button"]:hover {
    transform: none;
    border-color: var(--r2-primary-border, #9eb3d3);
    background: var(--r2-primary-soft, #e9eff8);
    color: var(--r2-primary-hover, #1b427d);
}

body.has-app-shell .r2-day-profiles-page .r2-day-profile-add-card span {
    background: #eef3fb;
    color: var(--r2-primary, #234f93);
}

body.has-app-shell .r2-day-profiles-page .r2-button[type="button"],
body.has-app-shell .r2-day-profiles-page .r2-button[type="submit"] {
    min-height: var(--r2-control-height, 40px);
    padding: .55rem var(--r2-space-4, 16px);
    border-radius: var(--r2-radius-md, 8px);
    font-size: var(--r2-font-size-sm, .875rem);
    font-weight: var(--r2-weight-medium, 600);
    line-height: 1.2;
    box-shadow: none;
}

body.has-app-shell .r2-day-profiles-page .r2-button--secondary[type="button"],
body.has-app-shell .r2-day-profiles-page .r2-button--secondary[type="submit"] {
    border: 1px solid var(--r2-border-strong, #b8c1ce);
    background: var(--r2-surface, #fff);
    color: var(--r2-text, #172033);
}

body.has-app-shell .r2-day-profiles-page .r2-button--secondary[type="button"]:hover,
body.has-app-shell .r2-day-profiles-page .r2-button--secondary[type="submit"]:hover {
    transform: none;
    border-color: var(--r2-primary-border, #9eb3d3);
    background: var(--r2-primary-soft, #e9eff8);
    color: var(--r2-primary-hover, #1b427d);
}

body.has-app-shell .r2-day-profiles-page .r2-button--quiet[type="button"],
body.has-app-shell .r2-day-profiles-page .r2-button--quiet[type="submit"] {
    border: 1px solid transparent;
    background: transparent;
    color: var(--r2-primary, #234f93);
}

body.has-app-shell .r2-day-profiles-page .r2-button--quiet[type="button"]:hover,
body.has-app-shell .r2-day-profiles-page .r2-button--quiet[type="submit"]:hover {
    transform: none;
    background: var(--r2-primary-soft, #e9eff8);
    color: var(--r2-primary-hover, #1b427d);
}

body.has-app-shell .r2-day-profiles-page .r2-button--primary[type="button"],
body.has-app-shell .r2-day-profiles-page .r2-button--primary[type="submit"] {
    border: 1px solid var(--r2-primary, #234f93);
    background: var(--r2-primary, #234f93);
    color: #fff;
}

body.has-app-shell .r2-day-profiles-page .r2-button--primary[type="button"]:hover,
body.has-app-shell .r2-day-profiles-page .r2-button--primary[type="submit"]:hover {
    transform: none;
    border-color: var(--r2-primary-hover, #1b427d);
    background: var(--r2-primary-hover, #1b427d);
    color: #fff;
}

body.has-app-shell .r2-day-profiles-page .r2-button--small[type="button"],
body.has-app-shell .r2-day-profiles-page .r2-button--small[type="submit"] {
    min-height: var(--r2-control-height-sm, 32px);
    padding: .35rem var(--r2-space-3, 12px);
    font-size: var(--r2-font-size-xs, .78rem);
}

body.has-app-shell .r2-day-profiles-page .r2-day-week-lesson[type="button"] {
    display: grid;
    width: 100%;
    height: 100%;
    min-height: 68px;
    align-content: center;
    justify-content: stretch;
    gap: 3px;
    padding: 10px 11px;
    border: 1px solid #d8e1ee;
    border-left: 3px solid #7f9fc8;
    border-radius: 8px;
    background: #f5f8fc;
    color: var(--r2-text, #172033);
    text-align: left;
    box-shadow: none;
}

body.has-app-shell .r2-day-profiles-page .r2-day-week-lesson[type="button"]:hover {
    transform: none;
    border-color: #9eb3d3;
    border-left-color: var(--r2-primary, #234f93);
    background: #edf3fa;
    color: var(--r2-text, #172033);
}

body.has-app-shell .r2-day-profiles-page .r2-day-week-break[type="button"] {
    width: 100%;
    min-height: 26px;
    padding: 4px 8px;
    border: 1px dashed #cdd5df;
    border-radius: 6px;
    background: #fff;
    color: var(--r2-text-muted, #667085);
    font-size: .72rem;
    font-weight: 600;
    box-shadow: none;
}

body.has-app-shell .r2-day-profiles-page .r2-day-week-break[type="button"]:hover {
    transform: none;
    border-color: #9eb3d3;
    background: #f7f9fc;
    color: var(--r2-text-secondary, #475467);
}

body.has-app-shell .r2-day-profiles-page .r2-day-week-break--long[type="button"] {
    border-style: solid;
    border-color: #b6c7df;
    background: #eef4fb;
    color: #294f80;
}

body.has-app-shell .r2-day-profiles-page .r2-day-week-break--lunch[type="button"] {
    border-style: solid;
    border-color: #c8d1db;
    background: #f3f5f7;
    color: #475467;
}

body.has-app-shell .r2-day-profiles-page .r2-day-week-copy[type="button"] {
    min-height: auto;
    width: max-content;
    max-width: 100%;
    margin-top: 3px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--r2-primary, #234f93);
    font-size: .72rem;
    font-weight: 600;
    box-shadow: none;
}

body.has-app-shell .r2-day-profiles-page .r2-day-week-copy[type="button"]:hover {
    transform: none;
    background: transparent;
    color: var(--r2-primary-hover, #1b427d);
    text-decoration: underline;
}

.r2-day-profile-picker__scroll {
    gap: 10px;
}

.r2-day-profile-card,
.r2-day-profile-add-card {
    flex-basis: 235px;
}

.r2-day-profile-workspace {
    margin-top: 8px;
}

.r2-day-profile-modebar {
    background: #f8fafc;
}

.r2-day-profile-link-toggle input {
    accent-color: var(--r2-primary, #234f93);
}

.r2-day-profile-mode-note {
    max-width: 620px;
}

.r2-day-profile-week-shell {
    padding: 18px 20px 22px;
}

.r2-day-week-grid,
.r2-day-week-grid.is-linked {
    grid-template-columns: 62px repeat(5, minmax(168px, 1fr));
    width: 100%;
    min-width: 960px;
}

.r2-day-week-day-head.is-linked small {
    color: var(--r2-text-muted, #667085);
    font-size: .68rem;
    font-weight: 500;
}

.r2-day-week-cell {
    padding: 6px;
}

.r2-day-week-row-label,
.r2-day-week-cell {
    min-height: 82px;
}

.r2-day-week-break-label,
.r2-day-week-break-cell {
    min-height: 34px;
}

.r2-day-week-add-cell {
    min-height: 54px;
}

.r2-day-profile-title-line [data-day-profile-default-badge] {
    border-color: #b7c8e0;
    background: #eef3fb;
    color: #234f93;
}

@media (max-width: 1180px) {
    .r2-day-week-grid,
    .r2-day-week-grid.is-linked {
        min-width: 920px;
    }
}

/* Additional activities reuse the standard school catalogue and editor patterns. */
.r2-additional-editor-dialog {
    width: min(68rem, calc(100vw - 2rem));
}

.r2-additional-editor-table {
    min-width: 680px;
}

.r2-additional-editor-table input[type="number"] {
    width: 7rem;
}

.r2-additional-editor-table select {
    min-width: 13rem;
}


.r2-additional-editor-dialog .r2-choice-row,
.r2-additional-editor-dialog .r2-choice-row > span {
    color: var(--r2-text);
}

.r2-additional-editor-dialog .r2-choice-row:hover,
.r2-additional-editor-dialog .r2-choice-row:hover > span {
    color: var(--r2-text);
}

/* Additional activities — classless group scheduling */
.r2-additional-field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.r2-additional-section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.r2-additional-section-head h2,
.r2-additional-group-card h3 {
    margin: 0;
}

.r2-additional-section-head p {
    margin: 5px 0 0;
    color: var(--r2-text-muted, #667085);
}

.r2-additional-generation-table td {
    vertical-align: middle;
}

.r2-additional-enrolment-form {
    display: grid;
    grid-template-columns: minmax(92px, 120px);
    gap: 4px;
}

.r2-additional-count-input {
    min-width: 92px;
}

.r2-additional-inline-save {
    min-height: 16px;
    font-size: 12px;
}

.r2-additional-preview-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 18px;
    padding: 16px 18px;
    border: 1px solid var(--r2-border, #e4e7ec);
    border-radius: 14px;
    background: var(--r2-surface-subtle, #f8fafc);
}

.r2-additional-preview-actions > div {
    display: grid;
    gap: 3px;
}

.r2-additional-preview-actions span {
    color: var(--r2-text-muted, #667085);
    font-size: 13px;
}

.r2-additional-preview-grid {
    margin-top: 14px;
}

.r2-additional-current-section {
    margin-top: 22px;
}

.r2-additional-current-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}

.r2-additional-group-card {
    padding: 16px;
    border: 1px solid var(--r2-border, #e4e7ec);
    border-radius: 14px;
    background: var(--r2-surface, #fff);
}

.r2-additional-group-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--r2-border, #e4e7ec);
}

.r2-additional-group-size {
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.r2-additional-session-list {
    display: grid;
    gap: 9px;
    padding-top: 12px;
}

.r2-additional-session-list > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
}

.r2-additional-session-list span {
    color: var(--r2-text-muted, #667085);
    text-align: right;
}

@media (max-width: 760px) {
    .r2-additional-field-grid { grid-template-columns: 1fr; }
    .r2-additional-section-head,
    .r2-additional-preview-actions { align-items: stretch; flex-direction: column; }
    .r2-additional-current-grid { grid-template-columns: 1fr; }
}

/* Batch 9 rooms: first-class registry controls */
.r2-room-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 58px;
    padding: 10px 0;
    border-bottom: 1px solid var(--r2-divider, #e4e7ec);
    cursor: pointer;
}

.r2-room-toggle-control {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.r2-room-toggle-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.r2-room-toggle-track {
    position: relative;
    width: 48px;
    height: 26px;
    flex: 0 0 auto;
    border: 1px solid #c7ced8;
    border-radius: 999px;
    background: #d7dde6;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.r2-room-toggle-track::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.22);
    content: "";
    transition: transform .15s ease;
}

.r2-room-toggle-input:checked + .r2-room-toggle-track {
    border-color: #fd8201;
    background: #fd8201;
    box-shadow: 0 0 0 3px rgba(253, 130, 1, 0.13);
}

.r2-room-toggle-input:checked + .r2-room-toggle-track::after {
    transform: translateX(22px);
}

.r2-room-toggle-input:focus-visible + .r2-room-toggle-track {
    outline: 2px solid #fd8201;
    outline-offset: 3px;
}

.r2-room-toggle-input:disabled + .r2-room-toggle-track,
.r2-room-toggle-row:has(.r2-room-toggle-input:disabled) {
    opacity: .58;
    cursor: not-allowed;
}

.r2-room-toggle-state {
    min-width: 76px;
    color: var(--r2-text-muted, #667085);
    font-size: 13px;
    font-weight: 750;
}

.r2-room-toggle-state.is-enabled {
    color: #d96f00;
}

.r2-room-create-grid {
    display: grid;
    grid-template-columns: minmax(150px, .75fr) minmax(240px, 1.5fr) minmax(105px, .45fr) auto;
    gap: 14px;
    align-items: end;
}

.r2-room-create-grid__action {
    min-width: 168px;
}

.r2-room-create-grid__action-label {
    visibility: hidden;
}

.r2-room-create-grid__action .r2-button {
    width: 100%;
}

.r2-room-advanced {
    grid-column: 1 / -1;
    margin-top: 2px;
    border-top: 1px solid var(--r2-divider, #e4e7ec);
    padding-top: 12px;
}

.r2-room-advanced > summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--r2-text, #12284c);
    font-size: 14px;
    font-weight: 750;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.r2-room-advanced > summary::-webkit-details-marker {
    display: none;
}

.r2-room-advanced > summary::after {
    content: "+";
    color: var(--r2-text-muted, #667085);
    font-size: 18px;
    font-weight: 500;
    line-height: 1;
}

.r2-room-advanced[open] > summary::after {
    content: "−";
}

.r2-room-advanced-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 14px;
}


.r2-room-form-error {
    grid-column: 1 / -1;
    margin: 0;
}

.r2-room-table td {
    vertical-align: middle;
}

.r2-room-table th:nth-child(1),
.r2-room-table td:nth-child(1) {
    width: 22%;
}

.r2-room-table th:nth-child(3),
.r2-room-table td:nth-child(3) {
    width: 110px;
}

.r2-room-edit-footer {
    justify-content: space-between;
}

@media (max-width: 860px) {
    .r2-room-create-grid {
        grid-template-columns: 1fr 1fr;
    }

    .r2-room-create-grid__action {
        min-width: 0;
    }

    .r2-room-advanced-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 620px) {
    .r2-room-toggle-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .r2-room-create-grid {
        grid-template-columns: 1fr;
    }

    .r2-room-advanced-grid {
        grid-template-columns: 1fr;
    }
}

.r2-room-rule-inline-form {
    display: grid;
    grid-template-columns: minmax(150px, 1.4fr) minmax(140px, 1fr) minmax(110px, .7fr) auto minmax(90px, auto);
    gap: .65rem;
    align-items: center;
}

.r2-room-rule-inline-form .r2-form-help {
    white-space: nowrap;
}

@media (max-width: 960px) {
    .r2-room-rule-inline-form {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
}

/* Batch 12 rooms: policy-aware configuration and local autosave feedback */
.r2-room-autosave-slot {
    min-height: 1.15rem;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
}

.r2-room-inline-save[hidden],
.r2-room-rule-state[hidden] {
    display: none !important;
}

.r2-room-policy-explainer {
    margin: .5rem 0 0;
    max-width: 72rem;
    color: var(--r2-text-muted, #667085);
    font-size: 13px;
}

.r2-room-rule-badge {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 1px 7px;
    border: 1px solid var(--r2-divider, #e4e7ec);
    border-radius: 999px;
    color: var(--r2-text-muted, #667085);
    background: var(--r2-surface-subtle, #f8fafc);
    font-size: 11px;
    font-weight: 650;
    line-height: 1.2;
}

.r2-room-rule-control {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(105px, auto);
    gap: .65rem;
    align-items: center;
}

.r2-room-rule-table th:first-child,
.r2-room-rule-table td:first-child {
    width: 28%;
}

.r2-room-rule-state {
    justify-self: start;
}

.r2-room-subject-rules-table th:first-child,
.r2-room-subject-rules-table td:first-child {
    width: 24%;
}

.r2-room-table th:nth-child(4),
.r2-room-table td:nth-child(4) {
    width: 190px;
}

/* Subject rules are autosaved; three controls plus transient save feedback. */
.r2-room-rule-inline-form {
    grid-template-columns: minmax(150px, 1.4fr) minmax(165px, 1fr) minmax(120px, .7fr) minmax(105px, auto);
}

@media (max-width: 960px) {
    .r2-room-rule-control,
    .r2-room-rule-inline-form {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
}
