:root {
    --primary: #ff5757;
    --primary-dark: #d83d3d;
    --secondary: #6aab44;
    --secondary-dark: #4c8b2a;
    --accent: #3d7be0;

    --background: #edf3eb;
    --surface: rgba(255, 255, 255, 0.82);
    --surface-solid: #ffffff;
    --surface-muted: rgba(239, 245, 237, 0.92);
    --foreground: #202820;
    --muted: #647064;
    --border: rgba(45, 72, 45, 0.16);
    --shadow: 0 16px 42px rgba(33, 60, 35, 0.14);

    --radius: 16px;
    --radius-small: 10px;
    --header-height: 68px;
    --max-width: 1240px;

    font-family: "Open Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--foreground);
    background: var(--background);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background);
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    background: transparent;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid rgba(61, 123, 224, 0.4);
    outline-offset: 2px;
}

[hidden] {
    display: none !important;
}

.app-background {
    position: fixed;
    z-index: -1;
    inset: 0;
    overflow: hidden;
    background:
        radial-gradient(circle at 0% 0%, rgba(144, 210, 109, 0.38), transparent 37%),
        radial-gradient(circle at 100% 12%, rgba(255, 87, 87, 0.18), transparent 28%),
        linear-gradient(145deg, #f5f9f3 0%, #e8f0e5 52%, #edf5ea 100%);
}

.app-background::before,
.app-background::after {
    position: absolute;
    width: 38vw;
    height: 38vw;
    min-width: 360px;
    min-height: 360px;
    border-radius: 50%;
    content: "";
    filter: blur(28px);
    opacity: 0.27;
}

.app-background::before {
    top: 35%;
    left: -15%;
    background: #91d26d;
}

.app-background::after {
    top: 22%;
    right: -14%;
    background: #ff8f8f;
}

/* Header */

.app-header {
    position: sticky;
    z-index: 20;
    top: 0;
    display: flex;
    align-items: center;
    min-height: var(--header-height);
    padding: 10px clamp(14px, 3vw, 38px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 3px 18px rgba(39, 61, 41, 0.08);
    backdrop-filter: blur(18px);
}

.brand {
    display: flex;
    align-items: center;
    max-width: 155px;
}

.brand-logo {
    display: block;
    width: 100%;
    max-height: 44px;
    object-fit: contain;
}

.header-spacer {
    flex: 1;
}

.header-user {
    display: flex;
    min-width: 0;
    margin-right: 10px;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.2;
}

.header-user-name {
    max-width: 260px;
    overflow: hidden;
    font-size: 0.9rem;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-user-email {
    max-width: 260px;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.76rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-menu-wrap {
    position: relative;
}

.header-menu-button {
    width: 42px;
    height: 42px;
    color: black;
    border-color: var(--secondary-dark);
    background: var(--secondary);
    font-size: 1.25rem;
}

.header-menu {
    position: absolute;
    z-index: 30;
    top: calc(100% + 9px);
    right: 0;
    width: min(310px, calc(100vw - 28px));
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.menu-section-label {
    display: block;
    padding: 10px 12px 5px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.menu-item {
    display: block;
    width: 100%;
    padding: 10px 12px;
    color: var(--foreground);
    border: 0;
    border-radius: 8px;
    background: transparent;
    text-align: left;
}

.menu-item:hover {
    background: rgba(106, 171, 68, 0.12);
}

.menu-item.danger:hover {
    background: rgba(255, 87, 87, 0.13);
    color: #9c2222;
}

/* Main layout */

.app-main {
    width: min(100% - 28px, var(--max-width));
    min-height: calc(100vh - var(--header-height));
    margin: 0 auto;
    padding: clamp(20px, 4vw, 42px) 0 54px;
}

.page-shell {
    display: grid;
    gap: 20px;
}

.page-header {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    justify-content: space-between;
}

.page-title-group {
    min-width: 0;
}

.page-title {
    margin: 0;
    font-size: clamp(1.55rem, 3vw, 2.2rem);
    line-height: 1.15;
}

.page-subtitle {
    margin: 7px 0 0;
    color: var(--muted);
}

.page-actions,
.inline-actions,
.dialog-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.glass-card {
    padding: clamp(17px, 3vw, 26px);
    border: 1px solid rgba(255, 255, 255, 0.82);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.card-title {
    margin: 0;
    font-size: 1.12rem;
}

.card-description {
    margin: 7px 0 0;
    color: var(--muted);
    line-height: 1.55;
}

.grid {
    display: grid;
    gap: 16px;
}

.grid.two-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three-columns {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Buttons */

.button {
    display: inline-flex;
    min-height: 40px;
    padding: 9px 14px;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 9px;
    background: var(--surface-solid);
    color: var(--foreground);
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    transition: transform 0.15s ease, filter 0.15s ease, background-color 0.15s ease;
}

.button:hover:not(:disabled) {
    filter: brightness(0.98);
    transform: translateY(-1px);
}

.button.primary {
    border-color: var(--secondary-dark);
    background: var(--secondary);
    color: white;
}

.button.primary:hover:not(:disabled) {
    background: var(--secondary-dark);
}

.button.danger {
    border-color: #c84242;
    background: var(--primary);
    color: white;
}

.button.secondary {
    border-color: var(--border);
    background: rgba(255, 255, 255, 0.76);
}

.button.blue {
    border-color: #2965be;
    background: var(--accent);
    color: white;
}

.button.small {
    min-height: 33px;
    padding: 6px 10px;
    font-size: 0.82rem;
}

.icon-button {
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.72);
}

/* Forms */

.form-grid {
    display: grid;
    gap: 15px;
}

.form-grid.two-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
    display: grid;
    gap: 6px;
}

.field.full-width {
    grid-column: 1 / -1;
}

.field label,
.field-label {
    color: #354235;
    font-size: 0.88rem;
    font-weight: 750;
}

.field small {
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.4;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 10px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.86);
    color: var(--foreground);
}

.field textarea {
    min-height: 150px;
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(106, 171, 68, 0.16);
    outline: 0;
}

.checkbox-field {
    display: flex;
    gap: 9px;
    align-items: center;
    color: var(--foreground);
    cursor: pointer;
}

.checkbox-field input {
    width: 18px;
    height: 18px;
    accent-color: var(--secondary);
}

/* Login */

.auth-layout {
    display: grid;
    width: min(100%, 470px);
    margin: clamp(28px, 9vh, 100px) auto 0;
}

.auth-logo {
    display: block;
    width: min(210px, 64vw);
    margin: 0 auto 20px;
}

.auth-card {
    padding: clamp(23px, 5vw, 34px);
}

.auth-title {
    margin: 0 0 7px;
    font-size: 1.8rem;
}

.auth-text {
    margin: 0 0 24px;
    color: var(--muted);
    line-height: 1.55;
}

/* Role cards and dashboard */

.role-list,
.list-stack {
    display: grid;
    gap: 11px;
}

.role-card {
    display: flex;
    gap: 15px;
    width: 100%;
    padding: 17px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.66);
    color: var(--foreground);
    text-align: left;
}

.role-card:hover {
    border-color: rgba(106, 171, 68, 0.65);
    background: rgba(240, 250, 235, 0.92);
}

.role-icon {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 12px;
    background: rgba(106, 171, 68, 0.18);
    font-size: 1.4rem;
}

.role-card.superadmin .role-icon {
    background: rgba(151, 114, 220, 0.18);
}

.role-card.student .role-icon {
    background: rgba(61, 123, 224, 0.15);
}

.role-card-content {
    min-width: 0;
    flex: 1;
}

.role-title {
    display: block;
    font-weight: 750;
}

.role-description {
    display: block;
    overflow: hidden;
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.88rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.role-arrow {
    color: var(--muted);
    font-size: 1.3rem;
}

.status-pill {
    display: inline-flex;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(106, 171, 68, 0.17);
    color: #376c1c;
    font-size: 0.74rem;
    font-weight: 750;
}

.status-pill.warning {
    background: rgba(237, 174, 45, 0.18);
    color: #8e5b00;
}

.status-pill.danger {
    background: rgba(255, 87, 87, 0.16);
    color: #ad2c2c;
}

.stats {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.57);
}

.stat-value {
    display: block;
    font-size: 1.55rem;
    font-weight: 800;
}

.stat-label {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.8rem;
}

/* Navigation tabs */

.tabs {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding: 4px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.48);
    scrollbar-width: thin;
}

.tab {
    flex: 0 0 auto;
    padding: 9px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-weight: 700;
}

.tab:hover {
    background: rgba(106, 171, 68, 0.1);
}

.tab.active {
    background: var(--surface-solid);
    color: var(--foreground);
    box-shadow: 0 3px 10px rgba(32, 50, 32, 0.1);
}

/* Lists */

.list-row {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.list-row:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.list-row:first-child {
    padding-top: 0;
}

.list-row-main {
    min-width: 0;
    flex: 1;
}

.list-row-title {
    overflow: hidden;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-row-meta {
    overflow: hidden;
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.84rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-row-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.empty-state {
    padding: 28px 16px;
    color: var(--muted);
    text-align: center;
}

.notice {
    padding: 12px 14px;
    border: 1px solid rgba(237, 174, 45, 0.4);
    border-radius: 10px;
    background: rgba(255, 244, 207, 0.76);
    color: #765200;
    line-height: 1.5;
}

.notice.danger {
    border-color: rgba(255, 87, 87, 0.4);
    background: rgba(255, 230, 230, 0.78);
    color: #922b2b;
}

/* Rating */

.rating-category {
    margin-top: 18px;
}

.rating-category:first-child {
    margin-top: 0;
}

.rating-category-title {
    margin: 0 0 10px;
    color: #365626;
    font-size: 1rem;
}

.rating-skill {
    padding: 15px 0;
    border-bottom: 1px solid var(--border);
}

.rating-skill:last-child {
    border-bottom: 0;
}

.rating-skill-name {
    display: block;
    margin-bottom: 8px;
    font-weight: 750;
}

.rating-options {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}

.rating-button {
    min-width: 48px;
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: white;
    font-weight: 800;
}

.rating-button.selected {
    border-color: var(--secondary-dark);
    background: var(--secondary);
    color: white;
}

.rating-help {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 0.8rem;
}

/* Dialog and toast */

.app-dialog {
    width: min(100% - 28px, 600px);
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 24px 70px rgba(25, 39, 25, 0.28);
}

.app-dialog::backdrop {
    background: rgba(25, 39, 25, 0.38);
    backdrop-filter: blur(4px);
}

.dialog-shell {
    padding: 20px;
}

.dialog-top {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    justify-content: space-between;
}

.dialog-title {
    margin: 0;
    font-size: 1.25rem;
}

.dialog-close {
    width: 33px;
    height: 33px;
    font-size: 1.35rem;
}

.dialog-content {
    margin-top: 17px;
}

.dialog-actions {
    justify-content: flex-end;
    margin-top: 20px;
}

.toast-container {
    position: fixed;
    z-index: 50;
    right: 16px;
    bottom: 16px;
    display: grid;
    gap: 9px;
    width: min(390px, calc(100vw - 32px));
}

.toast {
    padding: 13px 15px;
    border: 1px solid var(--border);
    border-left: 5px solid var(--secondary);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
}

.toast.error {
    border-left-color: var(--primary);
}

.toast-title {
    display: block;
    font-size: 0.84rem;
    font-weight: 800;
}

.toast-text {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.85rem;
}

/* Loading */

.loading-state {
    display: grid;
    min-height: 45vh;
    place-items: center;
}

.loading-card {
    display: grid;
    gap: 13px;
    justify-items: center;
    color: var(--muted);
}

.loading-spinner {
    width: 38px;
    height: 38px;
    border: 4px solid rgba(106, 171, 68, 0.2);
    border-top-color: var(--secondary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */

@media (max-width: 760px) {
    .app-header {
        min-height: 60px;
        padding: 8px 14px;
    }

    .brand {
        max-width: 120px;
    }

    .header-user-email {
        display: none;
    }

    .header-user-name {
        max-width: 150px;
        font-size: 0.8rem;
    }

    .grid.two-columns,
    .grid.three-columns,
    .form-grid.two-columns {
        grid-template-columns: 1fr;
    }

    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .page-header {
        flex-direction: column;
    }

    .page-actions {
        width: 100%;
    }

    .page-actions .button {
        flex: 1;
    }

    .list-row {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .list-row-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 420px) {
    .app-main {
        width: min(100% - 20px, var(--max-width));
        padding-top: 18px;
    }

    .header-user {
        display: none !important;
    }

    .stats {
        grid-template-columns: 1fr 1fr;
    }

    .role-card {
        padding: 13px;
    }

    .dialog-shell {
        padding: 16px;
    }
}

/* Student management */

.bulk-toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 18px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: rgba(239, 247, 235, 0.66);
}

.student-list,
.group-member-list,
.bulk-password-list,
.import-result-list {
    display: grid;
    gap: 8px;
}

.student-row {
    display: flex;
    gap: 12px;
    min-height: 68px;
    padding: 10px 12px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.56);
}

.student-row.selected {
    border-color: rgba(61, 123, 224, 0.55);
    background: rgba(61, 123, 224, 0.1);
}

.student-selector {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    flex: 0 0 auto;
    cursor: pointer;
}

.student-selector input {
    width: 19px;
    height: 19px;
    accent-color: var(--accent);
}

.student-row .list-row-main {
    flex: 1;
}

.student-row .list-row-actions {
    margin-left: auto;
}

.bulk-password-list {
    max-height: min(48vh, 460px);
    margin-top: 16px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Result matrix */

.result-card {
    min-width: 0;
    padding: 0;
    overflow: hidden;
}

.result-table-wrap {
    width: 100%;
    max-width: calc(100vw - 28px);
    max-height: calc(100vh - 235px);
    overflow-x: auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.result-table {
    width: 100%;
    min-width: 720px;
    border-spacing: 0;
    border-collapse: separate;
    background: rgba(255, 255, 255, 0.68);
}

.result-table th,
.result-table td {
    padding: 9px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.result-table thead th {
    position: sticky;
    z-index: 4;
    top: 0;
    background: rgba(247, 251, 245, 0.98);
    box-shadow: 0 2px 6px rgba(36, 57, 35, 0.06);
}

.result-table th:last-child,
.result-table td:last-child {
    border-right: 0;
}

.result-skill-column,
.result-skill-cell {
    position: sticky;
    z-index: 2;
    left: 0;
    min-width: 220px;
    max-width: 280px;
    background: rgba(250, 253, 249, 0.98);
    text-align: left !important;
}

.result-table thead .result-skill-column {
    z-index: 5;
}

.result-student-column {
    width: 38px;
    min-width: 38px;
    max-width: 38px;
    height: 172px;
    padding: 7px 5px !important;
    vertical-align: bottom;
    text-align: center;
}

.result-student-column span {
    display: block;
    max-height: 144px;
    margin: 0 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    transform: rotate(180deg);
    writing-mode: vertical-rl;
    white-space: nowrap;
}

.result-category-row th {
    position: sticky;
    z-index: 1;
    left: 0;
    padding: 9px 13px;
    background: var(--secondary);
    color: white;
    text-align: left;
}

.result-skill-cell {
    font-size: 0.88rem;
    font-weight: 750;
}

.result-skill-cell small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 500;
}

.result-rating-cell {
    min-width: 47px;
    font-weight: 850;
}

.result-rating-empty {
    background: rgba(150, 158, 150, 0.13);
    color: #788078;
}

.result-rating-1 {
    background: #ffb8b8 !important;
    color: #7e1515;
}

.result-rating-2 {
    background: #ffd89b !important;
    color: #7b4b00;
}

.result-rating-3 {
    background: #fff19c !important;
    color: #736400;
}

.result-rating-4 {
    background: #aeea9a !important;
    color: #245b1d;
}

.result-text-cell {
    min-width: 47px;
    background: rgba(61, 123, 224, 0.15);
    color: #20549e;
    font-size: 1.1rem;
    font-weight: 900;
}

.result-anonymous-cell {
    min-width: 160px;
    background: rgba(154, 113, 216, 0.12);
    text-align: left !important;
}

.result-anonymous-empty {
    color: var(--muted);
}

.anonymous-summary {
    display: grid;
    gap: 3px;
}

.anonymous-summary strong {
    color: #583a88;
}

.anonymous-summary small {
    color: #755a9e;
}

.result-legend {
    display: flex;
    gap: 7px;
    align-items: center;
    flex-wrap: wrap;
    margin: 0;
    padding: 14px 17px;
    color: var(--muted);
    font-size: 0.8rem;
}

.legend-item {
    display: inline-grid;
    width: 27px;
    height: 27px;
    place-items: center;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    font-weight: 800;
}

@media (max-width: 760px) {
    .bulk-toolbar .button {
        flex: 1 1 calc(50% - 8px);
    }

    .result-table-wrap {
        max-height: calc(100vh - 190px);
    }
}

@media (max-width: 430px) {
    .bulk-toolbar .button {
        flex-basis: 100%;
    }

    .student-row {
        flex-wrap: wrap;
    }

    .student-row .list-row-actions {
        width: 100%;
        margin-left: 40px;
    }
}

/* Curriculum editor */

.curriculum-toolbar {
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: space-between;
}

.curriculum-categories {
    display: grid;
    gap: 16px;
}

.curriculum-category {
    padding: 18px;
}

.curriculum-category-header {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    justify-content: space-between;
}

.curriculum-category-actions {
    margin-top: 15px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.curriculum-skill-list {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}

.curriculum-skill {
    display: flex;
    gap: 10px;
    min-width: 0;
    padding: 10px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.62);
}

.curriculum-skill-order {
    display: flex;
    gap: 4px;
    flex: 0 0 auto;
}

.curriculum-skill-order .icon-button {
    width: 30px;
    height: 30px;
}

.curriculum-skill-main {
    display: grid;
    min-width: 0;
    flex: 1;
}

.curriculum-skill-main strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.curriculum-skill-main span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.75rem;
}

.curriculum-skill-actions {
    display: flex;
    gap: 7px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.curriculum-skill-actions select {
    min-height: 33px;
    max-width: 175px;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: white;
}

/* Enabled skills editor */

.enabled-skills-global-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.enabled-skills-counter {
    margin-left: auto;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.enabled-skills-categories {
    display: grid;
    gap: 12px;
    margin-top: 15px;
}

.enabled-skills-category {
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: rgba(247, 251, 245, 0.72);
}

.enabled-skills-category-header {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.enabled-skills-category-header strong,
.enabled-skills-category-header small {
    display: block;
}

.enabled-skills-category-header small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.76rem;
}

.enabled-skills-list {
    display: grid;
    gap: 6px;
    margin-top: 11px;
}

.enabled-skill-row {
    display: flex;
    gap: 10px;
    padding: 9px;
    align-items: center;
    border-radius: 8px;
    cursor: pointer;
}

.enabled-skill-row:hover {
    background: rgba(106, 171, 68, 0.1);
}

.enabled-skill-row input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.enabled-skill-checkmark {
    display: inline-grid;
    width: 21px;
    height: 21px;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: white;
}

.enabled-skill-row input:checked+.enabled-skill-checkmark {
    border-color: var(--secondary-dark);
    background: var(--secondary);
}

.enabled-skill-row input:checked+.enabled-skill-checkmark::after {
    color: white;
    content: "✓";
    font-size: 0.83rem;
    font-weight: 900;
}

.enabled-skill-name {
    display: grid;
    min-width: 0;
}

.enabled-skill-name strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.enabled-skill-name small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.73rem;
}

@media (max-width: 760px) {

    .curriculum-toolbar,
    .curriculum-category-header {
        align-items: stretch;
        flex-direction: column;
    }

    .curriculum-skill {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .curriculum-skill-main {
        min-width: calc(100% - 84px);
    }

    .curriculum-skill-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .enabled-skills-counter {
        width: 100%;
        margin-left: 0;
    }
}

.glass-card {
    min-width: 0;
}

.result-skill-column,
.result-skill-cell {
    min-width: 170px;
    max-width: 220px;
}

.result-rating-cell {
    width: 38px;
    min-width: 38px;
    padding: 8px 4px !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    margin: -1px;
    padding: 0;
    border: 0;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.header-menu-button {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
}

.menu-icon {
    font-size: 1.45rem;
    font-weight: 850;
    line-height: 1;
}

.session-device-title {
    display: flex;
    gap: 7px;
    min-width: 0;
    align-items: center;
}

.session-device-name {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Administration and staff search */

.inline-search {
    display: flex;
    gap: 9px;
    align-items: end;
}

.inline-search .field {
    flex: 1;
}

.search-results {
    display: grid;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.54);
}

.search-results .list-row {
    padding-right: 12px;
    padding-left: 12px;
}

.new-user-details {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(239, 247, 235, 0.55);
}

.new-user-details summary {
    padding: 12px;
    cursor: pointer;
    font-weight: 750;
}

.new-user-form {
    padding: 0 12px 12px;
}

/* Feedback inbox */

.feedback-item {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.58);
}

.feedback-item-meta {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 750;
}

.feedback-item p {
    margin: 8px 0 0;
    white-space: pre-wrap;
    line-height: 1.55;
}

.feedback-pagination {
    align-items: center;
    justify-content: center;
    margin-top: 20px;
}

.feedback-page-info {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 700;
}

@media (max-width: 640px) {
    .inline-search {
        align-items: stretch;
        flex-direction: column;
    }

    .inline-search .button {
        width: 100%;
    }
}

/* Rating history */

.student-history-layout {
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(220px, 0.9fr) minmax(300px, 1.8fr) 112px;
    align-items: stretch;
}

.student-history-skills {
    min-width: 0;
}

.history-skill-categories {
    display: grid;
    gap: 16px;
    margin-top: 18px;
}

.history-skill-category h3 {
    margin: 0 0 7px;
    color: #365626;
    font-size: 0.92rem;
}

.history-skill-list {
    display: grid;
    gap: 5px;
}

.history-skill-button {
    display: grid;
    gap: 2px;
    width: 100%;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--foreground);
    text-align: left;
}

.history-skill-button:hover {
    background: rgba(106, 171, 68, 0.1);
}

.history-skill-button.selected {
    border-color: rgba(106, 171, 68, 0.55);
    background: rgba(106, 171, 68, 0.18);
}

.history-skill-button span {
    overflow: hidden;
    font-size: 0.87rem;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-skill-button small {
    color: var(--muted);
    font-size: 0.72rem;
}

.student-history-value-card {
    display: grid;
    min-height: 410px;
    grid-template-rows: auto 1fr;
}

.history-date-header,
.history-table-header {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    justify-content: space-between;
}

.history-date-badge {
    display: inline-flex;
    max-width: 220px;
    padding: 6px 9px;
    align-items: center;
    border-radius: 8px;
    background: rgba(61, 123, 224, 0.12);
    color: #245998;
    font-size: 0.79rem;
    font-weight: 750;
    line-height: 1.3;
    text-align: right;
}

.student-history-value-content {
    display: grid;
    min-height: 260px;
    place-items: center;
    padding: 24px 0;
}

.history-value-empty {
    max-width: 320px;
    color: var(--muted);
    text-align: center;
}

.history-loading {
    color: var(--muted);
    font-weight: 750;
}

.history-numeric-value {
    display: grid;
    width: min(220px, 75%);
    aspect-ratio: 1;
    place-items: center;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 24px;
    font-size: clamp(2.2rem, 7vw, 4.5rem);
    font-weight: 850;
}

.history-text-value {
    width: min(100%, 600px);
    padding: 20px;
    border: 1px solid rgba(61, 123, 224, 0.24);
    border-radius: 14px;
    background: rgba(61, 123, 224, 0.1);
    color: #204d88;
    line-height: 1.65;
    white-space: pre-wrap;
}

.history-slider-card {
    display: flex;
    gap: 12px;
    min-height: 410px;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    padding: 16px 12px;
}

.history-slider-date {
    color: #365626;
    font-size: 0.8rem;
    font-weight: 850;
    text-align: center;
}

.history-vertical-slider {
    width: 28px;
    height: 245px;
    margin: 4px 0;
    accent-color: var(--secondary);
    cursor: pointer;
    writing-mode: vertical-lr;
    direction: rtl;
}

.history-slider-labels {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 0.68rem;
    text-align: center;
}

.teacher-history-layout {
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1fr) 112px;
    align-items: stretch;
}

.teacher-history-table-card {
    min-width: 0;
}

.teacher-history-slider-card {
    min-height: 500px;
}

.history-table-header {
    padding: 18px 18px 0;
}

@media (max-width: 900px) {
    .student-history-layout {
        grid-template-columns: minmax(190px, 0.85fr) minmax(260px, 1.5fr) 95px;
    }

    .history-slider-card {
        min-width: 0;
    }
}

@media (max-width: 700px) {
    .student-history-layout {
        grid-template-columns: 1fr;
    }

    .student-history-skills {
        order: 1;
    }

    .student-history-value-card {
        order: 2;
    }

    .history-slider-card {
        order: 3;
        min-height: 130px;
        flex-direction: row;
    }

    .history-vertical-slider {
        width: min(68vw, 340px);
        height: 28px;
        writing-mode: initial;
        direction: initial;
    }

    .history-slider-labels {
        display: flex;
        gap: 12px;
        justify-content: space-between;
        width: min(68vw, 340px);
    }

    .teacher-history-layout {
        grid-template-columns: 1fr;
    }

    .teacher-history-slider-card {
        min-height: 130px;
    }

    .history-date-header,
    .history-table-header {
        flex-direction: column;
    }

    .history-date-badge {
        max-width: 100%;
        text-align: left;
    }
}

/* Compact student rating table */

.student-rating-card {
    padding: 0;
    overflow: hidden;
}

.student-rating-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.student-rating-table {
    width: 100%;
    border-spacing: 0;
    border-collapse: separate;
    table-layout: fixed;
}

.student-rating-table th,
.student-rating-table td {
    padding: 11px 14px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.student-rating-table th:last-child,
.student-rating-table td:last-child {
    border-right: 0;
}

.student-rating-table tbody tr:last-child th,
.student-rating-table tbody tr:last-child td {
    border-bottom: 0;
}

.student-rating-table thead th {
    background: rgba(247, 251, 245, 0.96);
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-align: left;
    text-transform: uppercase;
}

.student-rating-table thead th:first-child {
    width: 38%;
}

.student-rating-category-row th {
    padding: 8px 14px;
    border-right: 0;
    background: rgba(106, 171, 68, 0.16);
    color: #365f21;
    font-size: 0.86rem;
    font-weight: 800;
    text-align: left;
}

.student-rating-skill-name {
    background: rgba(250, 253, 249, 0.72);
    font-size: 0.9rem;
    font-weight: 750;
    line-height: 1.35;
    text-align: left;
}

.student-rating-skill-name span,
.student-rating-skill-name small {
    display: block;
}

.student-rating-skill-name small {
    margin-top: 3px;
    color: #755a9e;
    font-size: 0.7rem;
    font-weight: 700;
}

.student-rating-control {
    background: rgba(255, 255, 255, 0.48);
}

.student-rating-options {
    display: grid;
    gap: 7px;
    grid-template-columns: repeat(4, minmax(74px, 1fr));
}

.student-rating-options .rating-button {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    padding: 7px 8px;
    font-size: 1.06rem;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.student-rating-options .rating-button-1 {
    border-color: #e98c8c;
    background: #ffe0e0;
    color: #8c2020;
}

.student-rating-options .rating-button-2 {
    border-color: #e7ae5b;
    background: #ffe7be;
    color: #7b4b00;
}

.student-rating-options .rating-button-3 {
    border-color: #d8ca58;
    background: #fff6b7;
    color: #6f6200;
}

.student-rating-options .rating-button-4 {
    border-color: #75bd62;
    background: #ccefc0;
    color: #245b1d;
}

.student-rating-options .rating-button.selected {
    border-color: currentColor;
    box-shadow:
        0 0 0 2px rgba(255, 255, 255, 0.95),
        0 0 0 4px currentColor;
    filter: saturate(1.15);
    transform: none;
}

.student-rating-text-input {
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid rgba(61, 123, 224, 0.3);
    border-radius: 8px;
    background: rgba(61, 123, 224, 0.08);
    color: var(--foreground);
}

.student-rating-text-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(61, 123, 224, 0.14);
    outline: 0;
}

@media (max-width: 760px) {
    .student-rating-table {
        min-width: 620px;
    }

    .student-rating-table thead th:first-child {
        width: 210px;
    }

    .student-rating-options {
        grid-template-columns: repeat(4, minmax(76px, 1fr));
    }
}

/* Session device name truncation */

.session-device-title {
    display: flex;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    gap: 7px;
    align-items: center;
    overflow: hidden;
}

.session-device-name {
    display: block;
    width: 0;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    flex: 1 1 0;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.session-device-title .status-pill {
    flex: 0 0 auto;
}

.app-dialog .list-row,
.app-dialog .list-row-main,
.app-dialog .list-row-title {
    min-width: 0;
    max-width: 100%;
}

.app-dialog .list-row {
    overflow: hidden;
}

@media (max-width: 520px) {
    .app-dialog .list-row-actions {
        width: 100%;
    }
}

/* Compact result tables and interactive overflow content */

.compact-result-table-wrap {
    max-height: calc(100vh - 260px);
}

.compact-result-table th,
.compact-result-table td {
    padding: 5px 4px;
}

.compact-result-table .result-skill-column,
.compact-result-table .result-skill-cell {
    width: 170px;
    min-width: 170px;
    max-width: 170px;
}

.compact-result-table .result-student-column {
    width: 31px;
    min-width: 31px;
    max-width: 31px;
    height: 132px;
    padding: 4px 2px !important;
}

.compact-result-table .result-rating-cell,
.compact-result-table .result-text-cell {
    width: 31px;
    min-width: 31px;
    padding: 5px 2px !important;
    font-size: 0.8rem;
}

.compact-skill-label {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 2px 0;
    overflow: hidden;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 0.8rem;
    font-weight: 750;
    line-height: 1.25;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-skill-cell.is-expanded .compact-skill-label {
    overflow: visible;
    white-space: normal;
}

.compact-student-name {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
}

.compact-student-name span {
    display: block;
    max-height: 110px;
    margin: 0 auto;
    overflow: hidden;
    font-size: 0.72rem;
    text-overflow: ellipsis;
    transform: rotate(180deg);
    writing-mode: vertical-rl;
    white-space: nowrap;
}

.compact-text-value {
    display: grid;
    width: 100%;
    min-width: 25px;
    min-height: 29px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: inherit;
    font-size: 1rem;
    font-weight: 900;
}

.compact-text-value:hover,
.compact-text-value:focus-visible,
.compact-student-name:hover,
.compact-student-name:focus-visible,
.compact-skill-label:hover,
.compact-skill-label:focus-visible {
    background: rgba(61, 123, 224, 0.12);
}

/* History tabs */

.history-tabs {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding: 5px;
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.48);
    scrollbar-width: thin;
}

.history-tab {
    min-height: 40px;
    padding: 8px 14px;
    flex: 0 0 auto;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    font-weight: 750;
}

.history-tab:hover {
    background: rgba(106, 171, 68, 0.11);
}

.history-tab.active {
    border-color: rgba(106, 171, 68, 0.28);
    background: var(--surface-solid);
    color: var(--foreground);
    box-shadow: 0 4px 12px rgba(32, 50, 32, 0.09);
}

.history-tab-content {
    min-width: 0;
}

/* Horizontal date selector */

.history-date-control {
    display: grid;
    gap: 12px;
    padding: 15px 18px;
}

.history-date-control-header {
    display: flex;
    gap: 15px;
    align-items: center;
    justify-content: space-between;
}

.history-date-control-header>div {
    display: grid;
    gap: 3px;
}

.history-date-control-header strong {
    font-size: 0.92rem;
}

.history-horizontal-slider {
    width: 100%;
    height: 26px;
    margin: 0;
    accent-color: var(--secondary);
    cursor: pointer;
}

.history-horizontal-slider:disabled {
    cursor: default;
}

.history-horizontal-slider-labels {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
}

/* History overview */

.history-overview-grid,
.history-graphs-grid {
    display: grid;
    gap: 16px;
}

.history-stat-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.history-stat-card {
    display: grid;
    min-width: 0;
    padding: 17px;
    border: 1px solid rgba(255, 255, 255, 0.82);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.history-stat-card strong {
    overflow: hidden;
    color: #355f22;
    font-size: clamp(1.35rem, 3vw, 1.9rem);
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-stat-card span {
    margin-top: 7px;
    font-size: 0.84rem;
    font-weight: 750;
}

.history-stat-card small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.4;
}

.history-overview-card {
    display: grid;
    gap: 20px;
}

.history-distribution {
    display: grid;
    gap: 11px;
}

.history-distribution-row {
    display: grid;
    gap: 9px;
    grid-template-columns: 72px minmax(80px, 1fr) 34px 44px;
    align-items: center;
}

.history-distribution-label {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 750;
}

.history-distribution-track {
    position: relative;
    height: 13px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(100, 112, 100, 0.13);
}

.history-distribution-fill {
    position: absolute;
    inset: 0 auto 0 0;
    min-width: 0;
    border-radius: inherit;
    transition: width 0.25s ease;
}

.history-distribution-fill.level-0 {
    background: #e98c8c;
}

.history-distribution-fill.level-1 {
    background: #e7ae5b;
}

.history-distribution-fill.level-2 {
    background: #d8ca58;
}

.history-distribution-fill.level-3 {
    background: #75bd62;
}

.history-distribution-row strong {
    font-size: 0.84rem;
    text-align: right;
}

.history-distribution-row small {
    color: var(--muted);
    font-size: 0.72rem;
    text-align: right;
}

/* Responsive SVG graphs */

.history-graph-card {
    min-width: 0;
    padding: clamp(15px, 2.5vw, 22px);
    border: 1px solid rgba(255, 255, 255, 0.82);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.history-graph-card h3 {
    margin: 0;
    font-size: 1rem;
}

.history-graph-title-row {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    justify-content: space-between;
}

.history-graph-legend {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.history-graph-legend span {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    color: var(--muted);
    font-size: 0.69rem;
    font-weight: 700;
}

.history-graph-legend i {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.history-svg-wrap {
    width: 100%;
    margin-top: 14px;
    overflow-x: auto;
}

.history-line-graph {
    display: block;
    width: 100%;
    min-width: 500px;
    height: auto;
}

.history-graph-grid-line {
    stroke: rgba(45, 72, 45, 0.12);
    stroke-width: 1;
}

.history-graph-axis-label {
    fill: #647064;
    font-family: inherit;
    font-size: 11px;
    font-weight: 650;
}

/* History state */

.history-state-card {
    min-width: 0;
}

.history-state-empty {
    color: var(--muted);
    font-size: 0.8rem;
}

.history-state-rating {
    display: flex;
    min-height: 40px;
    padding: 7px 10px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0, 0, 0, 0.09);
    border-radius: 8px;
    font-weight: 800;
    letter-spacing: 0.03em;
}

.history-text-value-button {
    display: grid;
    gap: 3px;
    width: 100%;
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid rgba(61, 123, 224, 0.25);
    border-radius: 8px;
    background: rgba(61, 123, 224, 0.08);
    color: #204d88;
    text-align: left;
}

.history-text-value-button span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-text-value-button small {
    color: #52739e;
    font-size: 0.68rem;
}

.history-full-text {
    max-height: min(58vh, 520px);
    overflow-y: auto;
    padding: 16px;
    border: 1px solid rgba(61, 123, 224, 0.24);
    border-radius: 11px;
    background: rgba(61, 123, 224, 0.08);
    color: #204d88;
    line-height: 1.65;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

/* Anonymous text response reader */

.anonymous-summary-button {
    width: 100%;
    padding: 7px 9px;
    border: 1px solid rgba(131, 86, 183, 0.2);
    border-radius: 8px;
    background: rgba(131, 86, 183, 0.08);
    text-align: left;
}

.anonymous-summary-button:hover,
.anonymous-summary-button:focus-visible {
    border-color: rgba(131, 86, 183, 0.5);
    background: rgba(131, 86, 183, 0.14);
}

.anonymous-text-response-list {
    display: grid;
    gap: 9px;
    max-height: min(58vh, 520px);
    overflow-y: auto;
    padding-right: 3px;
}

.anonymous-text-response {
    padding: 13px;
    border: 1px solid rgba(131, 86, 183, 0.2);
    border-radius: 10px;
    background: rgba(131, 86, 183, 0.08);
}

.anonymous-text-response strong {
    color: #583a88;
    font-size: 0.75rem;
}

.anonymous-text-response p {
    margin: 7px 0 0;
    color: var(--foreground);
    line-height: 1.55;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

/* History responsive adjustments */

@media (max-width: 760px) {

    .history-date-control-header,
    .history-graph-title-row {
        align-items: stretch;
        flex-direction: column;
    }

    .history-date-badge {
        align-self: flex-start;
    }

    .history-graph-legend {
        justify-content: flex-start;
    }

    .history-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .history-line-graph {
        min-width: 560px;
    }

    .compact-result-table-wrap {
        max-height: calc(100vh - 210px);
    }
}

@media (max-width: 480px) {
    .history-tabs {
        width: 100%;
    }

    .history-tab {
        flex: 1 0 auto;
        padding-right: 10px;
        padding-left: 10px;
        font-size: 0.78rem;
    }

    .history-stat-grid {
        grid-template-columns: 1fr 1fr;
    }

    .history-stat-card {
        padding: 13px;
    }

    .history-stat-card strong {
        font-size: 1.25rem;
    }

    .history-distribution-row {
        gap: 6px;
        grid-template-columns: 62px minmax(55px, 1fr) 25px 37px;
    }

    .history-line-graph {
        min-width: 520px;
    }
}

/* Compact group tags in the student list */

.student-meta-line {
    display: flex;
    min-width: 0;
    gap: 7px;
    align-items: center;
}

.student-email {
    min-width: 0;
    overflow: hidden;
    flex: 0 1 auto;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.student-group-tags {
    display: flex;
    min-width: 0;
    gap: 4px;
    overflow: hidden;
    flex: 1 1 auto;
    align-items: center;
    white-space: nowrap;
}

.student-group-tag {
    display: inline-flex;
    max-width: 100px;
    padding: 1px 6px;
    overflow: hidden;
    flex: 0 0 auto;
    border-radius: 999px;
    background: rgba(106, 171, 68, 0.15);
    color: #376c1c;
    font-size: 0.67rem;
    font-weight: 750;
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.student-row.selectable {
    cursor: pointer;
    transition:
        border-color 0.15s ease,
        background-color 0.15s ease,
        transform 0.15s ease;
}

.student-row.selectable:hover {
    border-color: rgba(61, 123, 224, 0.42);
    background: rgba(61, 123, 224, 0.07);
}

.student-row.selectable.selected:hover {
    background: rgba(61, 123, 224, 0.14);
}

.student-row.selectable:focus-visible {
    outline: 3px solid rgba(61, 123, 224, 0.4);
    outline-offset: 2px;
}

/* Fullscreen results view */

.app-main.fullscreen-results {
    width: 100%;
    height: calc(100dvh - var(--header-height));
    min-height: calc(100dvh - var(--header-height));
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.fullscreen-results-page {
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 0;
    gap: 0;
    flex-direction: column;
}

.fullscreen-results-page>.page-header {
    padding: 9px 14px;
    flex: 0 0 auto;
    align-items: center;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
}

.fullscreen-results-page>.page-header .page-title {
    font-size: clamp(1rem, 2vw, 1.35rem);
}

.fullscreen-results-page>.page-header .page-subtitle {
    margin-top: 2px;
    font-size: 0.78rem;
}

.fullscreen-results-page>.notice {
    margin: 8px 12px;
    flex: 0 0 auto;
}

.fullscreen-result-card {
    display: flex;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.fullscreen-result-card .result-table-wrap {
    min-height: 0;
    max-width: 100vw;
    max-height: none;
    flex: 1 1 auto;
}

.fullscreen-result-card .result-legend {
    flex: 0 0 auto;
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.94);
}

/* Result table header: condensed by default, expanded when tapped */

.result-header-condensed .result-student-column {
    height: 38px;
    transition: height 0.2s ease;
}

.result-header-condensed .compact-student-name span {
    width: 25px;
    max-width: 25px;
    max-height: none;
    overflow: hidden;
    margin: 0 auto;
    font-size: 0.67rem;
    line-height: 1.2;
    text-overflow: ellipsis;
    transform: none;
    writing-mode: horizontal-tb;
    white-space: nowrap;
}

.result-header-condensed.is-header-expanded .result-student-column {
    height: 158px;
}

.result-header-condensed.is-header-expanded .compact-student-name span {
    width: auto;
    max-width: none;
    max-height: 138px;
    overflow: hidden;
    font-size: 0.72rem;
    text-overflow: ellipsis;
    transform: rotate(180deg);
    writing-mode: vertical-rl;
    white-space: nowrap;
}

/* History playback */

.history-date-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* Skill bar graph */

.history-skill-bars-card {
    display: grid;
    min-width: 0;
    gap: 18px;
}

.history-skill-bargraph {
    display: grid;
    min-width: 0;
    grid-template-columns: 38px minmax(0, 1fr);
}

.history-skill-bar-axis {
    display: flex;
    height: 310px;
    padding: 0 7px 0 0;
    flex-direction: column;
    justify-content: space-between;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 750;
    text-align: right;
}

.history-skill-bars {
    display: flex;
    width: 100%;
    min-width: 0;
    height: 310px;
    gap: 0;
    align-items: stretch;
    border-bottom: 1px solid rgba(45, 72, 45, 0.28);
    background:
        repeating-linear-gradient(to top,
            transparent 0,
            transparent calc(25% - 1px),
            rgba(45, 72, 45, 0.11) calc(25% - 1px),
            rgba(45, 72, 45, 0.11) 25%),
        rgba(255, 255, 255, 0.36);
}

.history-skill-bar {
    position: relative;
    display: block;
    min-width: 0;
    height: 100%;
    padding: 0;
    overflow: hidden;
    flex: 1 1 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.history-skill-bar::after {
    position: absolute;
    z-index: 2;
    inset: 0;
    background: transparent;
    content: "";
    pointer-events: none;
}

.history-skill-bar:hover::after,
.history-skill-bar:focus-visible::after {
    background: rgba(61, 123, 224, 0.15);
    box-shadow: inset 0 0 0 2px rgba(61, 123, 224, 0.55);
}

.history-skill-bar:focus-visible {
    outline: 0;
}

.history-skill-bar-fill {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    min-height: 0;
    transition:
        height 0.55s ease,
        background-color 0.25s ease;
    pointer-events: none;
}

.history-skill-bar-legend {
    display: flex;
    gap: 9px 14px;
    align-items: center;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
}

.history-skill-bar-legend span {
    display: inline-flex;
    gap: 5px;
    align-items: center;
}

.history-skill-bar-legend i {
    display: inline-block;
    width: 10px;
    height: 10px;
    flex: 0 0 auto;
    border-radius: 3px;
}

.history-skill-bar-legend .level-empty {
    background: #c8cec8;
}

.history-skill-bar-legend .level-0 {
    background: #d83d3d;
}

.history-skill-bar-legend .level-1 {
    background: #e49a26;
}

.history-skill-bar-legend .level-2 {
    background: #c6ad20;
}

.history-skill-bar-legend .level-3 {
    background: #4c8b2a;
}

.history-skill-bar-legend .level-text {
    background: #3d7be0;
}

.history-skill-detail-value {
    display: grid;
    gap: 5px;
    padding: 16px;
    border-left: 7px solid var(--skill-color);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.72);
}

.history-skill-detail-value strong {
    font-size: 1.1rem;
}

.history-skill-detail-value small {
    color: var(--muted);
}

@media (max-width: 760px) {
    :root {
        --header-height: 60px;
    }

    .fullscreen-results-page>.page-header {
        flex-direction: row;
    }

    .fullscreen-results-page>.page-header .page-title-group {
        min-width: 0;
        flex: 1;
    }

    .fullscreen-results-page>.page-header .page-title,
    .fullscreen-results-page>.page-header .page-subtitle {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .fullscreen-results-page>.page-header .page-actions {
        width: auto;
        flex: 0 0 auto;
    }

    .fullscreen-results-page>.page-header .page-actions .button {
        min-height: 34px;
        padding: 6px 9px;
        flex: 0 0 auto;
        font-size: 0.75rem;
    }

    .history-date-actions {
        justify-content: flex-start;
    }

    .history-skill-bargraph {
        grid-template-columns: 32px minmax(0, 1fr);
    }

    .history-skill-bar-axis,
    .history-skill-bars {
        height: 260px;
    }
}

@media (max-width: 520px) {
    .student-meta-line {
        align-items: flex-start;
        flex-direction: column;
    }

    .student-group-tags {
        width: 100%;
        max-width: 100%;
    }

    .fullscreen-results-page>.page-header .page-title-group {
        display: none;
    }

    .fullscreen-results-page>.page-header .page-actions {
        width: 100%;
    }

    .fullscreen-results-page>.page-header .page-actions .button {
        flex: 1 1 auto;
    }

    .history-skill-bar-axis,
    .history-skill-bars {
        height: 230px;
    }
}