html, body {
    font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: #f7f8fb;
    margin: 0;
    user-select: none;
    -webkit-user-select: none;
}

input, textarea, [contenteditable="true"] { user-select: text; }

/* Descriptive text should look neutral, not like an error or action. */
.mud-typography.mud-secondary-text { color: #687385 !important; }

.app-loading { min-height: 100vh; display: grid; place-items: center; color: #687385; }
.pwa-update-banner { position: fixed; right: 1rem; bottom: 1rem; z-index: 1100; display: flex; align-items: center; gap: .75rem; max-width: min(30rem, calc(100vw - 2rem)); padding: .75rem 1rem; color: #fff; background: #29204f; border-radius: .65rem; box-shadow: 0 8px 28px rgba(25, 18, 58, .28); }
.pwa-update-banner[hidden] { display: none; }
.pwa-update-banner button { padding: .45rem .75rem; color: #29204f; font: inherit; font-weight: 600; background: #fff; border: 0; border-radius: .4rem; cursor: pointer; white-space: nowrap; }
.pwa-update-banner button:hover { background: #f0edff; }

.main-content { min-height: calc(100vh - 64px); }
.main-content-body { min-height: calc(100vh - 120px); }
.app-footer { display: block; padding: 1rem 1.5rem; text-align: center; }
.start-page { padding-top: 8vh; }
.start-page-icon { width: 7rem; height: 7rem; filter: drop-shadow(0 8px 22px rgba(120, 97, 233, 0.16)); pointer-events: none; }
.workspace-page { padding-top: 1.25rem; }
.start-actions { width: 100%; margin-top: 1rem; }
.start-card, .workspace-card { height: 100%; transition: transform .15s ease, box-shadow .15s ease; }
.start-card:hover, .workspace-card:hover { transform: translateY(-3px); }
.start-card .mud-card-content { min-height: 170px; }
.upload-button, .upload-button .mud-file-upload-button { width: 100%; }
.saved-schedule-alert.mud-alert { align-items: center; width: 100%; }
.saved-schedule-alert .mud-alert-icon { align-self: center !important; margin-top: 0 !important; }
.saved-schedule-content { display: flex; align-items: center; justify-content: space-between; gap: .75rem; width: 100%; min-width: 0; }
.saved-schedule-content .mud-typography { min-width: 0; }
.saved-schedule-delete { margin-left: auto; }
.workspace-card { cursor: pointer; }
.workspace-dashboard-hero { background: linear-gradient(135deg, rgba(68, 38, 217, .08), rgba(25, 118, 210, .03)); }
.workspace-dashboard-hero .mud-stack { min-width: 0; }
.workspace-dashboard-actions { flex-wrap: wrap; }
.workspace-stat-card { display: grid; grid-template-columns: auto 1fr; column-gap: .65rem; align-items: center; height: 100%; }
.workspace-stat-card .mud-typography-h5 { line-height: 1; }
.workspace-stat-card .mud-typography-caption { grid-column: 2; }
.workspace-next-step { border: 1px solid rgba(245, 158, 11, .3); background: rgba(245, 158, 11, .07); }
.workspace-next-step .mud-icon-root { flex: 0 0 auto; }
.solver-options-toggle { justify-content: space-between; text-transform: none; }
.solver-api-key-panel { background: rgba(25, 118, 210, .035); }
.solver-api-key-status { background: rgba(46, 125, 50, .06); }
.solver-api-key-status-content { flex-wrap: wrap; gap: .5rem; }
.solver-api-key-content { flex-wrap: wrap; gap: .75rem; }
.solver-api-key-actions { flex: 1 1 520px; justify-content: flex-end; }
.solver-api-key-input { flex: 1 1 220px; min-width: 0; }
.solver-options-content { padding: 0 1rem 1rem; }
.solver-options-checks { margin-top: .25rem; }
.solver-options-section-title { margin: .25rem 0 .5rem; }
.solver-penalties-grid { margin-top: .25rem; }
.solver-penalty-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.solver-penalty-value { min-width: 2.5rem; text-align: right; font-weight: 600; }
.solver-slider-disabled { opacity: .38; filter: grayscale(.8); }
.solver-preview-panel { min-height: 480px; min-width: 0; overflow: hidden; }
.solver-preview-empty { min-height: 390px; display: grid; place-items: center; align-content: center; gap: .75rem; padding: 2rem; text-align: center; }
.solver-preview-placeholder { min-height: 390px; display: grid; place-items: center; padding: 2rem; }
.solver-preview-header { flex-wrap: wrap; }
.solver-preview-summary { flex-wrap: wrap; justify-content: flex-end; max-width: 100%; }
.solver-preview-layout { width: 100%; max-width: 100%; margin: 0; padding: .5rem; }
.solver-preview-layout > .mud-grid-item { max-width: 100%; min-width: 0; padding: .5rem; }
.solver-preview-navigator { width: 100%; max-width: 100%; min-width: 0; max-height: calc(100vh - 260px); overflow-x: hidden; overflow-y: auto; box-sizing: border-box; }
.solver-preview-navigator .resource-mode-switch { max-width: 100%; overflow: hidden; }
.solver-preview-navigator .resource-nav-item { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.solver-preview-grid-panel { width: 100%; max-width: 100%; min-width: 0; overflow: hidden; }
.solver-preview-grid-panel .resource-schedule-grid { width: 100%; max-width: 100%; min-width: 0; overflow: hidden; }
.solver-preview-grid-panel .resource-schedule-grid-compact { padding: 0 .25rem .5rem; }
.solver-preview-grid-panel .schedule-grid-days-scroll { max-width: 100%; overflow-x: auto; }
.solver-preview-grid-panel .resource-schedule-days { gap: .45rem; }
.solver-preview-grid-panel .schedule-day-column { flex-basis: 118px; min-width: 118px; }
.solver-preview-grid-panel .schedule-slot { grid-template-columns: 34px minmax(0, 1fr); min-height: 36px; padding: .15rem; }
.solver-preview-grid-panel .schedule-slot-time { font-size: .64rem; }
.solver-preview-grid-panel .schedule-slot-status { font-size: .68rem; }
.solver-actions { flex-wrap: wrap; }
.resource-navigator { max-height: calc(100vh - 170px); overflow-y: auto; }
.resource-mode-switch { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; margin-bottom: .75rem; }
.resource-mode-switch .mud-button-root { min-width: 0; padding-left: .25rem; padding-right: .25rem; white-space: nowrap; font-size: .8rem; }
.resource-mode-switch .mud-button-root { text-transform: none; }
.resource-mode-switch .mode-button { background: transparent; color: var(--mud-palette-primary); }
.resource-mode-switch .mode-button-selected { background: var(--mud-palette-primary); color: var(--mud-palette-primary-text); }
.resource-mode-switch .mode-button-selected:hover { background: var(--mud-palette-primary-darken); }
.resource-search { margin-bottom: .5rem; }
.resource-section-title { margin: 1rem .5rem .35rem; }
.resource-nav-item { justify-content: flex-start; text-transform: none; }
.nested-resource { padding-left: 1.5rem; font-size: .9rem; }
.schedule-grid-placeholder { min-height: 540px; display: grid; gap: .75rem; place-items: center; align-content: center; text-align: center; padding: 2rem; }
.schedule-grid-panel { min-height: 540px; }
.schedule-grid-days-scroll { width: 100%; min-width: 0; overflow-x: auto; overflow-y: hidden; }
.resource-schedule-grid { width: 100%; min-width: 0; }
.resource-schedule-days { display: flex; gap: .75rem; align-items: flex-start; width: 100%; min-width: max-content; }
.schedule-day-column { flex: 1 0 150px; width: auto; min-width: 150px; }
.schedule-day-header { padding: .5rem; border-radius: .35rem; background: var(--mud-palette-primary); color: var(--mud-palette-primary-text); font-size: .85rem; font-weight: 600; text-align: center; }
.schedule-day-slots { display: grid; grid-template-columns: minmax(0, 1fr); gap: .35rem; min-width: 0; margin-top: .35rem; }
.schedule-slot { min-height: 54px; display: grid; grid-template-columns: 42px minmax(0, 1fr) 28px; gap: .25rem; align-items: center; padding: .35rem; border: 1px solid var(--mud-palette-lines-default); border-radius: .35rem; }
.schedule-slot-time { font-size: .75rem; color: var(--mud-palette-text-secondary); }
.schedule-slot-status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; }
.schedule-slot-free { background: var(--mud-palette-background-grey); }
.schedule-slot-busy { background: #e5e7eb; border-color: #9ca3af; }
.schedule-slot-another { background: #dbeafe; border-color: #93c5fd; }
.schedule-slot-lesson { background: #d1fae5; border-color: #6ee7b7; }
.schedule-slot-new { background: #86efac; border-color: #16a34a; box-shadow: inset 0 0 0 2px rgba(22, 163, 74, .28); }
.resource-schedule-grid-compact .schedule-slot { grid-template-columns: 42px minmax(0, 1fr); min-height: 42px; }
.resource-schedule-grid-compact .schedule-slot-status { grid-column: 2; }
.schedule-grid-toolbar { display: flex; flex-wrap: nowrap; gap: .5rem; align-items: center; min-height: 56px; margin-bottom: .75rem; }
.schedule-grid-header { justify-content: flex-end !important; }
.schedule-grid-bulk-label { white-space: nowrap; }
.schedule-grid-bulk-options { display: grid; grid-template-columns: minmax(150px, 180px) minmax(180px, 220px); flex: 0 1 auto; min-width: 0; gap: .5rem; align-items: center; }
.schedule-grid-bulk-options .mud-input-control { width: 100%; min-width: 0; }
.schedule-grid-clear-button { flex: 0 0 auto; white-space: nowrap; }
.schedule-day-header { display: flex; align-items: center; justify-content: space-between; }
.teacher-list-item { justify-content: flex-start; text-transform: none; }
.teacher-empty-state { min-height: 320px; display: grid; gap: .75rem; place-items: center; align-content: center; text-align: center; }
.add-student-panel { background: rgba(25, 118, 210, .035); }
.assignment-row { background: transparent; }
.assignment-section-add { width: 130px; min-width: 130px; }
.assignment-row { padding: .25rem !important; }
.assignment-row .mud-input-control { margin-top: 0; margin-bottom: 0; }
.assignment-row .mud-checkbox { min-height: 32px; margin: 0; }
.assignment-grid { align-items: center; }
.assignment-content { display: grid; grid-template-columns: minmax(0, 1fr) 110px max-content 40px; gap: .5rem; align-items: center; min-width: 0; width: 100%; }
.assignment-content > * { min-width: 0; }
.assignment-student-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assignment-add-button { width: 100%; }
.no-wrap { white-space: nowrap; }
.resource-detail-actions { flex-wrap: wrap; }
.resource-assignment-chips { flex-wrap: wrap; }
.student-assignment-add-actions { display: flex; justify-content: flex-end; }

@media (max-width: 900px) {
    .solver-title-row { flex-direction: column !important; align-items: stretch !important; gap: .75rem !important; }
    .solver-actions { width: 100%; }
    .solver-actions .mud-button-root { flex: 1 1 0; min-width: 0; }
    .solver-actions .mud-button-root:first-child { flex: 1 1 100%; width: 100%; }
    .solver-api-key-actions { width: 100%; flex-wrap: wrap; justify-content: stretch; }
    .solver-api-key-input { flex-basis: 100%; width: 100%; }
    .solver-api-key-actions .mud-button-root { flex: 1 1 0; }
    .solver-preview-header { align-items: stretch !important; }
    .solver-preview-summary { justify-content: flex-start; }
    .solver-preview-layout { padding: .25rem; }
    .solver-preview-navigator { max-height: none; }
    .saved-schedule-content { flex-wrap: wrap; }
    .saved-schedule-content .mud-button-root { margin-left: auto; }
    .schedule-grid-toolbar { flex-wrap: wrap; }
    .schedule-grid-bulk-options { flex-basis: 100%; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .schedule-grid-clear-button { width: 100%; }
    .assignment-content { grid-template-columns: minmax(0, 1fr) 86px 36px; gap: .25rem .35rem; }
    .assignment-student-name { grid-column: 1; grid-row: 1; padding-left: 32px; }
    .assignment-limit { grid-column: 2; grid-row: 1; max-width: 86px; }
    .assignment-not-count { grid-column: 1 / span 2; grid-row: 2; margin-left: -.35rem; }
    .assignment-remove { grid-column: 3; grid-row: 1; }
}

@media (max-width: 900px) {
    .assignment-section-add { width: 130px; min-width: 130px; }
    .resource-detail-header { flex-direction: column !important; align-items: stretch !important; gap: .5rem !important; }
    .assignment-section-header { flex-direction: row !important; align-items: center !important; gap: .5rem !important; }
    .resource-detail-actions { flex-direction: column !important; align-items: stretch !important; width: 100%; gap: .25rem !important; }
    .resource-detail-actions .mud-button-root { width: 100%; min-width: 0; }
    .workspace-dashboard-main { flex-direction: column !important; align-items: stretch !important; }
    .workspace-dashboard-actions { flex-direction: column !important; width: 100%; gap: .5rem !important; }
    .workspace-dashboard-actions .mud-button-root { width: 100%; min-width: 0; }
}
.workspace-placeholder { padding: 5rem 1rem; text-align: center; display: grid; gap: .75rem; place-items: center; background: transparent; }
.empty-schedule-state { width: min(100% - 2rem, 620px); margin: 4rem auto; }
.grid-editor-add-day { max-width: 620px; }
.grid-editor-add-day .mud-input-control { min-width: 220px; }
.grid-editor-day { height: 100%; }
.grid-editor-slot-list { padding-top: 0; padding-bottom: .5rem; }
.grid-editor-slot-row { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.grid-editor-slot-row .mud-icon-button { margin-left: .1rem; }

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}
