:root {
    --bg: #f1f5f9;
    --surface: #ffffff;
    --surface-strong: #f8fafc;
    --text: #1e293b;
    --muted: #64748b;
    --accent: #1f6f5f;
    --accent-strong: #154f44;
    --border: #e2e8f0;
    --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --container: 1120px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    overflow-x: hidden;
}

body {
    margin: 0;
    min-width: 320px;
    overflow-x: hidden;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(31, 111, 95, 0.14), transparent 30%),
        linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
}

.site-shell {
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
}

.container {
    width: min(100% - 2rem, var(--container));
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(14px);
    background: rgba(248, 250, 252, 0.92);
    border-bottom: 1px solid rgba(226, 232, 240, 0.7);
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
}

.brand {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.primary-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.nav-meta {
    color: var(--muted);
    font-size: 0.95rem;
}

.nav-form {
    margin: 0;
}

.language-switcher {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin-left: auto;
}

.language-switcher__label {
    color: var(--muted);
    font-size: 0.95rem;
}

.language-switcher select {
    border: 1px solid rgba(203, 213, 225, 0.8);
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
    background-color: rgba(255, 255, 255, 0.85);
    color: #475569;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    padding-right: 2rem;
}

.language-switcher select:hover {
    border-color: rgba(99, 102, 241, 0.35);
    background-color: #ffffff;
    color: #334155;
}

.language-switcher select:focus {
    outline: 2px solid rgba(99, 102, 241, 0.2);
    border-color: #6366f1;
    color: #334155;
    background-color: #ffffff;
}

.primary-nav a {
    padding: 0.7rem 1rem;
    border-radius: 999px;
    color: var(--muted);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.primary-nav a:hover,
.primary-nav a:focus-visible {
    background: rgba(31, 111, 95, 0.12);
    color: var(--accent-strong);
}

.nav-toggle {
    display: none;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 999px;
    padding: 0.65rem 0.9rem;
    font: inherit;
    cursor: pointer;
}

.page-main {
    padding: 2rem 0 3rem;
}

.hero,
.page-card {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.hero {
    padding: clamp(1.5rem, 4vw, 3rem);
    display: grid;
    gap: 2rem;
}

.hero__content {
    max-width: 48rem;
}

.page-card {
    padding: clamp(1.5rem, 4vw, 2.5rem);
}

.auth-card {
    max-width: 36rem;
    margin: 0 auto;
}

.eyebrow {
    margin: 0 0 0.75rem;
    color: var(--accent-strong);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 1rem;
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 1.05;
}

h2 {
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
}

.lead {
    margin-bottom: 0;
    max-width: 44rem;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.7;
}

.surface-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.surface-card {
    padding: 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), var(--surface-strong));
}

.surface-card:not([data-beta-lesson-editor-shell]) p,
.site-footer p {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.6;
}

.feature-panel {
    padding: 1.25rem;
}

.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.teacher-tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.flash-stack {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.flash {
    padding: 0.9rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
}

.flash--error {
    border-color: #bf6a5f;
    background: #fff1f0;
}

.auth-card {
    max-width: 42rem;
}

.form-grid {
    display: grid;
    gap: 1rem;
    margin-top: 1.5rem;
}

.field {
    display: grid;
    gap: 0.45rem;
}

.field span {
    font-weight: 600;
}

.field small,
.field-hint,
.table-note {
    color: var(--muted);
    line-height: 1.5;
}

.field-requirement {
    color: var(--muted);
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-width: 0;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text);
    font: inherit;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: 2px solid rgba(31, 111, 95, 0.18);
    border-color: var(--accent);
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.hero-actions {
    margin-top: 1.5rem;
}

.button {
    border: 0;
    border-radius: 999px;
    padding: 0.85rem 1.3rem;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
}

.button__icon {
    margin-right: 0.25rem;
}

.button:hover,
.button:focus-visible {
    background: var(--accent-strong);
}

.button--secondary {
    background: rgba(31, 111, 95, 0.12);
    color: var(--accent-strong);
}

.button--danger {
    background: #a54236;
}

.button--danger:hover,
.button--danger:focus-visible {
    background: #7f2f25;
}

.legal-card {
    max-width: 56rem;
}

.legal-list {
    display: grid;
    gap: 1rem;
    margin-top: 1.5rem;
}

.legal-list p {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.7;
}

.table-card {
    overflow-x: auto;
    margin-top: 1.5rem;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.9);
}

.table-card--stacked {
    display: grid;
    gap: 1rem;
    padding: 1rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(226, 232, 240, 0.7);
}

.data-table th {
    color: var(--muted);
    font-size: 0.92rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.subtle-card {
    margin-top: 1.5rem;
    background: rgba(248, 250, 252, 0.65);
}

.student-detail-card {
    max-width: 62rem;
}

.student-detail-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.student-detail-chat-count,
.student-detail-lesson-summary {
    margin-bottom: 1rem;
}

.student-detail-last-message-label {
    margin-bottom: 0.25rem;
}

.student-detail-last-message {
    margin-bottom: 0;
    font-size: 0.95rem;
}

.student-detail-empty-message {
    margin-bottom: 0;
}

.student-detail-timestamps {
    font-size: 0.85rem;
    line-height: 1.4;
}

.student-detail-reset-action {
    margin-top: 0.4rem;
}

.student-detail-reset-action--success {
    color: var(--success, #3aa489);
}

.student-password-generation-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.student-password-generation-row input {
    flex: 1 1 14rem;
}

.student-password-generation-row .button {
    flex: 0 0 auto;
}

.danger-card {
    margin-top: 1.5rem;
    border-color: rgba(165, 66, 54, 0.35);
    background: rgba(255, 241, 242, 0.88);
}

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

.card-form-panel {
    margin-top: 1.5rem;
}

.toolbar-form {
    padding: 0;
}

.toolbar-form--assignment {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
}

.toolbar-field {
    max-width: 28rem;
}

.toolbar-field--grow {
    flex: 1 1 18rem;
    min-width: 0;
}

.field--checkbox input {
    width: auto;
    padding: 0;
    border: 0;
    background: transparent;
    outline: none;
}

.card-image-thumb {
    display: block;
    width: 96px;
    height: 96px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    object-fit: cover;
    background: rgba(255, 255, 255, 0.7);
}

.media-link {
    display: inline-flex;
}

.empty-table-state {
    padding: 1rem;
}

.empty-table-state__icon {
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-table-state--centered {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.empty-table-state__action {
    margin-top: 0.75rem;
}

/* ── Button variants ─────────────────────────────────── */

.button--small {
    padding: 0.45rem 0.85rem;
    font-size: 0.88rem;
}

.button--compact {
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
}

.button--disabled {
    opacity: 0.4;
    pointer-events: none;
    cursor: default;
}

/* ── Cards compact toolbar ───────────────────────────── */

.cards-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem;
}

.cards-toolbar__label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 0.25rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.cards-toolbar__item {
    display: flex;
    flex-direction: column;
}

.cards-toolbar__item--grow {
    flex: 1 1 200px;
}

.cards-toolbar__actions {
    display: flex;
    align-items: flex-end;
    gap: 0.4rem;
    padding-bottom: 0; /* align with input baseline */
}

.cards-toolbar__select,
.cards-toolbar__input {
    min-width: 0;
    padding: 0.55rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text);
    font: inherit;
    font-size: 0.92rem;
}

.cards-toolbar__select--wide {
    flex: 1 1 220px;
    min-width: 180px;
}

.cards-toolbar__select:focus,
.cards-toolbar__input:focus {
    outline: 2px solid rgba(31, 111, 95, 0.18);
    border-color: var(--accent);
}

/* ── Compact data table ──────────────────────────────── */

.data-table--compact th,
.data-table--compact td {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

.data-table--compact .col-check {
    width: 2.25rem;
    text-align: center;
}

.card-table-row {
    cursor: pointer;
    transition: background-color 0.12s;
}

.card-table-row:hover {
    background: rgba(31, 111, 95, 0.04);
}

/* ── Pagination ──────────────────────────────────────── */

.cards-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.25rem 0;
}

.cards-pagination__nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cards-pagination__info {
    font-size: 0.9rem;
    color: var(--muted);
    white-space: nowrap;
}

.cards-pagination__per-page {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.9rem;
    color: var(--muted);
}

.cards-pagination__per-page select {
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    font: inherit;
    font-size: 0.9rem;
    color: var(--text);
}

/* ── Sticky selection bar ────────────────────────────── */



.card-select-bar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.card-select-bar__summary {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.95rem;
    color: var(--text);
}

.card-select-bar__badge {
    background: var(--accent);
    color: #fff;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.85rem;
}

.card-select-bar__modes {
    display: flex;
    background: rgba(31, 111, 95, 0.08);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
    gap: 0.25rem;
}

.card-select-bar__mode-tab {
    display: flex;
    align-items: center;
    padding: 0.4rem 0.85rem;
    border-radius: calc(var(--radius-sm) - 0.1rem);
    cursor: pointer;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.card-select-bar__mode-tab input {
    display: none;
}

.card-select-bar__mode-tab:has(input:checked) {
    background: #fff;
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    font-weight: 600;
}

.card-select-bar__form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(226, 232, 240, 0.5);
}

.card-select-bar__form .cards-toolbar__select,
.card-select-bar__form .cards-toolbar__input {
    background: #fff;
    border-color: var(--border);
    color: var(--text);
}

.card-select-bar__form .cards-toolbar__select::placeholder,
.card-select-bar__form .cards-toolbar__input::placeholder {
    color: var(--muted);
}

.card-select-bar__message {
    font-size: 0.88rem;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    background: rgba(31, 111, 95, 0.1);
    color: var(--accent-strong);
    text-align: center;
    font-weight: 500;
}

.card-select-bar__message--error {
    background: rgba(165, 66, 54, 0.1);
    color: #a54236;
}


/* ── Card preview modal ──────────────────────────────── */

.card-preview-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.card-preview-backdrop[hidden] {
    display: none;
}

.card-preview-modal {
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modal-in 0.18s ease;
}

@keyframes modal-in {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to   { opacity: 1; transform: scale(1)   translateY(0); }
}

.card-preview-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.card-preview-close {
    background: none;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    color: var(--muted);
    padding: 0 0.25rem;
    transition: color 0.15s;
}

.card-preview-close:hover {
    color: var(--text);
}

.import-report-card {
    margin-top: 1rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.72);
}

.import-upload-error {
    margin: 0;
}

.dictionary-upload-picker {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
    min-height: 7rem;
    padding: 1rem;
    overflow: hidden;
    border: 1px dashed #93c5fd;
    border-radius: var(--radius-md);
    background: #f8fbff;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s, background 0.2s;
}

.dictionary-upload-picker:hover,
.dictionary-upload-picker:focus-within {
    border-color: #0ea5e9;
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(14, 165, 233, 0.12);
    transform: translateY(-1px);
}

.dictionary-upload-picker[data-has-file="true"] {
    border-style: solid;
    border-color: rgba(13, 148, 136, 0.45);
    background: #f7fffb;
}

.dictionary-upload-picker__input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.dictionary-upload-picker__icon {
    display: inline-grid;
    place-items: center;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0284c7;
}

.dictionary-upload-picker__body {
    display: grid;
    gap: 0.25rem;
    min-width: 0;
}

.dictionary-upload-picker__title {
    color: #0f172a;
    font-size: 1rem;
    font-weight: 700;
}

.dictionary-upload-picker__hint,
.dictionary-upload-picker__selected {
    color: #64748b;
    font-size: 0.92rem;
    font-weight: 500;
    line-height: 1.45;
}

.dictionary-upload-picker__selected {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dictionary-upload-picker[data-has-file="true"] .dictionary-upload-picker__selected {
    color: #0f766e;
}

.dictionary-upload-picker__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: 0.65rem 1rem;
    border-radius: 999px;
    background: #0ea5e9;
    color: #ffffff;
    font-size: 0.92rem;
    font-weight: 700;
    white-space: nowrap;
}

.import-upload-progress {
    display: grid;
    gap: 0.4rem;
}

.import-upload-progress__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    color: var(--muted);
    font-size: 0.9rem;
}

.import-upload-progress__bar {
    width: 100%;
    height: 0.75rem;
    accent-color: var(--color-primary);
}

.import-language-override__hint {
    margin-bottom: 0.5rem;
    color: var(--color-danger);
}

.import-language-override__grid {
    margin-bottom: 1rem;
}

.import-language-modal {
    width: min(92vw, 380px);
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.import-language-modal::backdrop {
    background: rgba(15, 23, 42, 0.38);
}

.import-language-modal__title {
    margin-top: 0;
}

.import-language-modal__field {
    margin-bottom: var(--space-3);
}

.import-language-modal__field select {
    width: 100%;
}

.import-language-modal__actions {
    justify-content: flex-end;
}

.import-mapping-panel {
    margin-bottom: 2rem;
}

.import-mapping-panel__lead {
    margin-bottom: 1.5rem;
}

.import-mapping-table {
    width: 100%;
}

.import-mapping-table__destination {
    width: 25%;
}

.import-mapping-table__field {
    width: 30%;
}

.import-mapping-table__preview {
    width: 45%;
}

.import-mapping-preview-box {
    min-height: 2.5rem;
    max-height: 150px;
    overflow-y: auto;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    background: var(--surface-strong);
}

.import-mapping-preview-ignored {
    color: var(--muted);
    font-style: italic;
}

.import-mapping-preview-text {
    display: block;
    overflow-wrap: anywhere;
}

.import-mapping-preview-image {
    display: block;
    max-width: 100%;
    max-height: 100px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.import-mapping-preview-audio {
    display: block;
    width: 100%;
    max-width: 320px;
    margin-top: 0.35rem;
}

.assignment-panel {
    margin-top: 1.5rem;
}

.assignment-panel--spaced {
    margin-bottom: 1.5rem;
}

.cards-table-spinner,
.cards-selected-count {
    align-self: center;
    color: var(--muted);
    font-size: 0.9em;
}

.cards-table-zone--loading {
    opacity: 0.5;
    pointer-events: none;
}

.cards-form-actions {
    margin-top: 1rem;
}

.report-detail-block {
    margin-top: 0.85rem;
}

.report-list {
    margin: 0.5rem 0 0;
    padding-left: 1.25rem;
    color: var(--muted);
}

.chart-panel {
    margin-top: 1.5rem;
}

/* ── Modern Bar Chart ────────────────────────────────── */

.modern-chart-panel {
    margin-top: 1.5rem;
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 10px 40px -10px rgba(15, 23, 42, 0.06), 0 4px 12px -4px rgba(15, 23, 42, 0.04);
    border-radius: 24px;
    padding: clamp(1.5rem, 4vw, 2.5rem);
    overflow: visible;
    position: relative;
}

.modern-chart-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #0ea5e9, #6366f1, #8b5cf6);
    opacity: 0.8;
    border-radius: 24px 24px 0 0;
}

.modern-chart-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.modern-chart-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.modern-chart-container {
    position: relative;
    height: 220px;
    margin-top: 1rem;
    padding-bottom: 2rem;
}

.modern-chart-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 1;
    pointer-events: none;
}

.modern-chart-grid-line {
    width: 100%;
    border-top: 1px dashed rgba(203, 213, 225, 0.6);
}

.modern-chart-bars {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    z-index: 2;
    padding: 0 0.5rem;
    gap: 0.5rem;
}

.modern-chart-bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    height: 100%;
    flex: 1;
    position: relative;
    cursor: pointer;
}

.modern-chart-bar-track {
    position: relative;
    width: 100%;
    max-width: 48px;
    height: calc(100% - 2rem);
    background: rgba(241, 245, 249, 0.5);
    border-radius: 999px;
    display: flex;
    align-items: flex-end;
    padding: 4px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
    transition: background 0.3s ease;
}

.modern-chart-bar-group:hover .modern-chart-bar-track {
    background: rgba(226, 232, 240, 0.6);
}

.modern-chart-bar-fill {
    width: 100%;
    min-height: 12px;
    border-radius: 999px;
    background: linear-gradient(180deg, #6366f1 0%, #4f46e5 100%);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
    position: relative;
    transition: height 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s, box-shadow 0.3s;
    animation: barGrow 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes barGrow {
    from { height: 0 !important; }
}

.modern-chart-bar-group:hover .modern-chart-bar-fill {
    background: linear-gradient(180deg, #8b5cf6 0%, #7c3aed 100%);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.modern-chart-tooltip {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(8px);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.2);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    z-index: 100;
    pointer-events: none;
}

.modern-chart-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: rgba(15, 23, 42, 0.95) transparent transparent transparent;
}

.modern-chart-bar-group:hover .modern-chart-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.modern-chart-tooltip strong {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.15rem;
    display: block;
}

.modern-chart-tooltip span {
    color: #cbd5e1;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.modern-chart-date {
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    transition: color 0.2s;
}

.modern-chart-bar-group:hover .modern-chart-date {
    color: #0f172a;
}

.dashboard-activity-panel {
    overflow: hidden;
}

.dashboard-activity-panel .modern-chart-header {
    position: relative;
    z-index: 2;
    margin-bottom: 1rem;
}

.dashboard-activity-panel .modern-chart-header h2 {
    letter-spacing: 0;
}

.dashboard-activity-line {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.dashboard-activity-line__svg {
    display: block;
    width: 100%;
    max-width: 100%;
    height: clamp(8.25rem, 24vw, 11rem);
    overflow: hidden;
}

.dashboard-activity-line__grid {
    stroke: rgba(203, 213, 225, 0.66);
    stroke-width: 1;
    stroke-dasharray: 4 7;
    vector-effect: non-scaling-stroke;
}

.dashboard-activity-line__area {
    fill: rgba(99, 102, 241, 0.16);
}

.dashboard-activity-line__curve {
    fill: none;
    stroke: #4f46e5;
    stroke-width: 3;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}

.dashboard-activity-line__dot {
    fill: #ffffff;
    stroke: #4f46e5;
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
}

.dashboard-activity-line__labels {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 0.35rem;
    min-width: 0;
    margin-top: 0.35rem;
}

.dashboard-activity-line__label {
    display: grid;
    min-width: 0;
    justify-items: center;
    gap: 0.15rem;
    color: #64748b;
    font-size: 0.74rem;
    font-weight: 700;
    text-align: center;
}

.dashboard-activity-line__label strong {
    display: inline-flex;
    min-width: 1.8rem;
    min-height: 1.45rem;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #eef2ff;
    color: #4338ca;
    font-size: 0.82rem;
    line-height: 1;
}

.dashboard-activity-line__label small {
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font: inherit;
}

.student-chart-empty {
    position: relative;
    z-index: 2;
}

.modern-chart-panel--cards-stats {
    overflow: hidden;
}

.modern-chart-panel--cards-stats .modern-chart-header,
.cards-activity-chart {
    position: relative;
    z-index: 2;
}

.modern-chart-panel--cards-stats .modern-chart-header {
    margin-bottom: 1.25rem;
}

.cards-activity-chart {
    display: grid;
    gap: 0.75rem;
}

.cards-activity-chart__row {
    display: grid;
    grid-template-columns: minmax(6.5rem, 0.75fr) minmax(10rem, 2.2fr) minmax(2.75rem, auto) minmax(9rem, 1fr);
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    padding: 0.8rem 0.9rem;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.04);
}

.cards-activity-chart__date {
    min-width: 0;
    color: #475569;
    font-size: 0.88rem;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cards-activity-chart__track {
    min-width: 0;
    height: 0.8rem;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.1);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
}

.cards-activity-chart__fill {
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    border-radius: inherit;
    background: transparent;
}

.cards-activity-chart__fill::-webkit-progress-bar {
    border-radius: inherit;
    background: transparent;
}

.cards-activity-chart__fill::-webkit-progress-value {
    border-radius: inherit;
    background: linear-gradient(90deg, #0ea5e9 0%, #6366f1 58%, #8b5cf6 100%);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
}

.cards-activity-chart__fill::-moz-progress-bar {
    border-radius: inherit;
    background: linear-gradient(90deg, #0ea5e9 0%, #6366f1 58%, #8b5cf6 100%);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
}

.cards-activity-chart__total {
    display: inline-flex;
    min-width: 2.75rem;
    min-height: 2rem;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #eef2ff;
    color: #4338ca;
    font-size: 0.95rem;
    font-weight: 800;
}

.cards-activity-chart__meta {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    gap: 0.35rem 0.65rem;
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 700;
}

.cards-activity-chart__meta span {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* ── Compact cards stats row ─────────────────────────── */

.cards-stats-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

.cards-stats-item {
    display: inline-flex;
    align-items: baseline;
    gap: 0.3rem;
}

.cards-stats-item strong {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--accent-strong);
}

.cards-stats-item span {
    color: var(--muted);
    font-size: 0.82rem;
}

.cards-stats-sep {
    color: var(--border);
    font-size: 0.9rem;
    line-height: 1;
}

/* ── SVG line chart ──────────────────────────────────── */

.line-chart-wrap {
    margin-top: 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.6);
    overflow: hidden;
}

.line-chart-svg {
    display: block;
    width: 100%;
    height: 120px;
    overflow: visible;
}

.line-chart-labels {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0.5rem 0.4rem;
    border-top: 1px solid var(--border);
    background: rgba(255,255,255,0.35);
}

.line-chart-label {
    font-size: 0.72rem;
    color: var(--muted);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 3.5rem;
    cursor: default;
}

.lesson-table-card {
    margin-top: 1.5rem;
}

.lesson-bulk-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 8px;
    background: #f8fafc;
}

.lesson-bulk-toolbar--active {
    border-color: rgba(99, 102, 241, 0.24);
    background: rgba(99, 102, 241, 0.06);
}

.lesson-bulk-toolbar__status {
    display: inline-flex;
    align-items: baseline;
    gap: 0.35rem;
    color: #475569;
    font-size: 0.9rem;
}

.lesson-bulk-toolbar__status strong {
    color: #1f2937;
}

.lesson-bulk-toolbar__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.45rem;
}

.button--small {
    min-height: 2.1rem;
    padding: 0.42rem 0.65rem;
    font-size: 0.84rem;
}

.lesson-select-cell {
    width: 2.75rem;
    text-align: center;
}

.lesson-select-cell input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: #4f46e5;
}

.lesson-row--hidden {
    display: none;
}

.lesson-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.lesson-breadcrumbs__link {
    color: inherit;
    text-decoration: none;
}

.lesson-breadcrumbs [data-breadcrumb-current] {
    color: #334155;
    font-weight: 700;
}

.teacher-header-actions {
    gap: 0.5rem;
}

.teacher-lessons-search-form {
    margin-bottom: 1.25rem;
}

.lesson-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 480px;
}

.lesson-search-icon {
    position: absolute;
    left: 0.75rem;
    display: flex;
    align-items: center;
    color: #94a3b8;
    pointer-events: none;
}

.lesson-search-input {
    padding-left: 2.5rem !important;
    padding-right: 2.25rem !important;
    border-radius: 8px !important;
    transition: box-shadow 0.18s, border-color 0.18s;
}

.lesson-search-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.lesson-search-clear {
    position: absolute;
    right: 0.65rem;
    display: flex;
    align-items: center;
    padding: 0.2rem;
    border-radius: 4px;
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.15s;
}

.lesson-search-clear:hover {
    color: #ef4444;
}

.lesson-search-results-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.6rem 1rem;
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.06);
    color: #475569;
    font-size: 0.9rem;
}

.lesson-folder-back-link,
.lesson-folder-link,
.lesson-folder-pill {
    display: inline-flex;
    align-items: center;
}

.lesson-folder-back-link {
    gap: 0.5rem;
    color: #475569;
    font-weight: 500;
    text-decoration: none;
}

.lesson-folder-link {
    gap: 0.5rem;
    color: inherit;
    font-size: 1.05rem;
    text-decoration: none;
}

.lesson-folder-pill {
    gap: 0.3rem;
    color: #64748b;
    font-size: 0.85rem;
}

.lesson-folder-pill__link {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: rgba(100, 116, 139, 0.4);
}

.lesson-folder-root {
    color: #94a3b8;
    font-size: 0.85rem;
}

.lesson-actions-cell {
    width: 1%;
}

.teacher-inline-form {
    display: contents;
    margin: 0;
}

.teacher-icon-button {
    min-width: unset;
    padding: 0.4rem;
    line-height: 1;
}

.teacher-icon-button--danger {
    color: #ef4444;
}

.teacher-icon-button--deactivate {
    border-color: rgba(225, 29, 72, 0.2);
    color: #e11d48;
}

.teacher-icon-button--activate {
    border-color: rgba(13, 148, 136, 0.2);
    color: #0d9488;
}

.lesson-client-no-results {
    display: none;
    padding: 2rem 1rem;
    color: #64748b;
    text-align: center;
}

.lesson-client-no-results--visible {
    display: block;
}

.lesson-client-no-results__text {
    margin: 0;
}

.teacher-dialog {
    padding: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    width: 100%;
}

.teacher-dialog--folder {
    max-width: 400px;
}

.teacher-dialog--move {
    max-width: 440px;
}

.teacher-dialog__title {
    margin-top: 0;
}

.teacher-dialog__title--spaced {
    margin-bottom: 1rem;
}

.teacher-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

.teacher-dialog-actions--roomy {
    margin-top: 1.5rem;
}

.form-group--compact {
    margin-bottom: 0.35rem;
}

.form-label--block {
    display: block;
    margin-bottom: 0.4rem;
}

.folder-tree-picker {
    max-height: 280px;
    overflow-y: auto;
    padding: 0.35rem 0;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    background: #f8fafc;
}

.folder-tree-search {
    margin-bottom: 0.55rem;
}

.folder-tree-picker__empty {
    margin: 0.45rem 0 0;
    color: #64748b;
    font-size: 0.85rem;
}

.ftp-node {
    user-select: none;
}

.ftp-row {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 1px 4px;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.12s;
}

.ftp-row--depth-1 {
    padding-left: 1.3rem;
}

.ftp-row--depth-2 {
    padding-left: 2.1rem;
}

.ftp-row--depth-3 {
    padding-left: 2.9rem;
}

.ftp-row--depth-4 {
    padding-left: 3.7rem;
}

.ftp-row--depth-5,
.ftp-row--depth-6 {
    padding-left: 4.5rem;
}

.ftp-row:hover {
    background: rgba(99, 102, 241, 0.07);
}

.ftp-row.selected {
    background: rgba(99, 102, 241, 0.13);
    color: #4f46e5;
    font-weight: 600;
}

.ftp-toggle {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: none;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.12s, transform 0.15s;
}

.ftp-toggle:hover {
    color: #4f46e5;
}

.ftp-toggle svg {
    display: block;
    transition: transform 0.15s;
}

.ftp-toggle.open svg {
    transform: rotate(90deg);
}

.ftp-spacer {
    flex-shrink: 0;
    width: 20px;
}

.ftp-icon {
    flex-shrink: 0;
    margin-right: 6px;
}

.ftp-label {
    flex: 1;
}

.ftp-children {
    padding-left: 20px;
}

.ftp-children.collapsed {
    display: none;
}

.ftp-selected-label {
    min-height: 1.2em;
    margin-top: 0.4rem;
    color: #6366f1;
    font-size: 0.82rem;
    font-weight: 500;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.table-actions form {
    margin: 0;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
}

.status-chip--active {
    background: rgba(31, 111, 95, 0.14);
    color: var(--accent-strong);
}

.status-chip--available {
    background: rgba(54, 117, 168, 0.12);
    color: #24557d;
}

.status-chip--inactive {
    background: rgba(165, 66, 54, 0.12);
    color: #7f2f25;
}

.lesson-form {
    margin-top: 1.5rem;
}

.lesson-form-error {
    margin-top: 1rem;
}

.lesson-editor-metadata-form {
    align-items: stretch;
}

.lesson-settings-panel {
    display: grid;
    gap: 1rem;
}

.lesson-settings-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(14, 165, 233, 0.16);
    border-radius: 8px;
    background: #f8fafc;
}

.lesson-settings-save-state {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: #0f766e;
    font-size: 0.82rem;
    font-weight: 750;
    white-space: nowrap;
}

.lesson-settings-save-state::before {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: #14b8a6;
}

.lesson-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.lesson-settings-section {
    display: grid;
    align-content: start;
    gap: 0.9rem;
    min-width: 0;
    padding: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-radius: 8px;
    background: #ffffff;
}

.lesson-settings-section__header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.lesson-settings-section__header h2 {
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.2;
}

.lesson-settings-section__icon {
    display: inline-grid;
    width: 1.75rem;
    height: 1.75rem;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 8px;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 0.78rem;
    font-weight: 850;
}

.lesson-settings-toggle-field {
    align-content: start;
}

.lesson-settings-toggle {
    position: relative;
    display: inline-flex;
    width: fit-content;
}

.lesson-settings-toggle input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.lesson-settings-toggle__track {
    display: inline-flex;
    width: 3rem;
    height: 1.65rem;
    align-items: center;
    padding: 0.18rem;
    border-radius: 999px;
    background: #cbd5e1;
    transition: background 140ms ease;
}

.lesson-settings-toggle__knob {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18);
    transform: translateX(0);
    transition: transform 140ms ease;
}

.lesson-settings-toggle input:checked + .lesson-settings-toggle__track {
    background: #0ea5e9;
}

.lesson-settings-toggle input:checked + .lesson-settings-toggle__track .lesson-settings-toggle__knob {
    transform: translateX(1.35rem);
}

.lesson-settings-toggle input:focus-visible + .lesson-settings-toggle__track {
    outline: 2px solid rgba(14, 165, 233, 0.28);
    outline-offset: 2px;
}

.lesson-opening-mode-control {
    display: grid;
    grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
    gap: 0.25rem;
    padding: 0.25rem;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #f1f5f9;
}

.lesson-opening-mode-control__option {
    min-width: 0;
    min-height: 2.25rem;
    padding: 0.45rem 0.6rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #475569;
    cursor: pointer;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.2;
}

.lesson-opening-mode-control__option[aria-pressed="true"] {
    background: #fff;
    color: #0f172a;
    box-shadow: 0 1px 5px rgba(15, 23, 42, 0.14);
}

.lesson-opening-mode-control__option:focus-visible,
.lesson-dictionary-picker__filter:focus-visible,
.lesson-dictionary-picker__close:focus-visible {
    outline: 2px solid rgba(14, 165, 233, 0.28);
    outline-offset: 2px;
}

.lesson-opening-mode-enhanced .lesson-opening-mode-native,
.lesson-dictionary-picker--enhanced [data-lesson-dictionary-native] {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.lesson-folder-picker {
    display: grid;
    gap: 0.85rem;
    min-width: 0;
}

.lesson-folder-picker__summary-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid #dbe7ef;
    border-radius: 8px;
    background: #f8fafc;
}

.lesson-folder-picker__icon {
    display: inline-grid;
    width: 2rem;
    height: 2rem;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 8px;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 0.9rem;
    font-weight: 850;
}

.lesson-folder-picker__current {
    min-width: 0;
    color: #0f172a;
    font-size: 0.95rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.lesson-folder-picker__open {
    align-self: center;
    white-space: nowrap;
}

.teacher-dialog--lesson-folder,
.lesson-folder-picker__dialog {
    max-width: 440px;
}

.lesson-dictionary-picker {
    display: grid;
    gap: 0.85rem;
    min-width: 0;
}

.lesson-dictionary-picker__summary-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid #dbe7ef;
    border-radius: 8px;
    background: #f8fafc;
}

.lesson-dictionary-picker__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    min-width: 0;
}

.lesson-dictionary-chip {
    display: inline-flex;
    max-width: 100%;
    align-items: center;
    padding: 0.28rem 0.65rem;
    border: 1px solid #bae6fd;
    border-radius: 999px;
    background: #ecfeff;
    color: #075985;
    font-size: 0.82rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.lesson-dictionary-picker__open {
    align-self: start;
    white-space: nowrap;
}

.lesson-dictionary-picker__dialog {
    display: grid;
    gap: 0.85rem;
    padding: 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.14);
}

.lesson-dictionary-picker__dialog[hidden],
.lesson-dictionary-picker__row[hidden],
.lesson-dictionary-picker__empty[hidden] {
    display: none;
}

.lesson-dictionary-picker__dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.lesson-dictionary-picker__dialog-header h3 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
}

.lesson-dictionary-picker__close {
    display: inline-grid;
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #f8fafc;
    color: #334155;
    cursor: pointer;
    font: inherit;
    font-size: 1.2rem;
    line-height: 1;
}

.lesson-dictionary-picker__filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.lesson-dictionary-picker__filter {
    min-height: 2rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #f8fafc;
    color: #475569;
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
}

.lesson-dictionary-picker__filter[aria-pressed="true"] {
    border-color: #7dd3fc;
    background: #e0f2fe;
    color: #075985;
}

.lesson-dictionary-picker__list {
    display: grid;
    gap: 0.45rem;
    max-height: 18rem;
    overflow-y: auto;
    padding-right: 0.2rem;
}

.lesson-dictionary-picker__row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.65rem;
    align-items: start;
    padding: 0.65rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: #334155;
    cursor: pointer;
    font-weight: 650;
}

.lesson-dictionary-picker__row:has(input:checked) {
    border-color: #7dd3fc;
    background: #f0f9ff;
}

.lesson-dictionary-picker__row span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.lesson-dictionary-picker__row input {
    width: auto;
    margin-top: 0.2rem;
}

.lesson-dictionary-picker__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

@media (max-width: 900px) {
    .lesson-settings-summary,
    .lesson-settings-grid,
    .lesson-folder-picker__summary-row,
    .lesson-dictionary-picker__summary-row {
        grid-template-columns: 1fr;
    }

    .lesson-opening-mode-control {
        grid-template-columns: 1fr;
    }

    .lesson-dictionary-picker__dialog {
        width: 100%;
        max-width: 100%;
    }

    .lesson-dictionary-picker__actions {
        flex-direction: column-reverse;
    }

    .lesson-dictionary-picker__actions .button,
    .lesson-folder-picker__open,
    .lesson-dictionary-picker__open {
        width: 100%;
        justify-content: center;
    }
}

.lesson-editor-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.lesson-block-card {
    display: grid;
    gap: 0.85rem;
}

.lesson-block-header {
    margin-bottom: 0;
}

.lesson-preview-shell,
.lesson-preview-content {
    display: grid;
    gap: 1rem;
}

.lesson-notes-panel {
    margin-top: 1rem;
}

.lesson-preview-block img,
.lesson-preview-block video {
    width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.7);
}

.lesson-preview-heading {
    margin-bottom: 0;
}

.lesson-preview-heading--h1 {
    font-size: 1.8rem;
}

.lesson-preview-heading--h3 {
    font-size: 1.1rem;
}

.lesson-preview-text,
.notes-markdown {
    margin-bottom: 0;
    color: var(--text);
    line-height: 1.7;
    white-space: pre-wrap;
}

.lesson-preview-quote {
    margin: 0;
    padding-left: 1rem;
    border-left: 4px solid rgba(31, 111, 95, 0.25);
}

.lesson-preview-quote p,
.lesson-preview-quote footer {
    margin-bottom: 0;
}

.lesson-preview-list {
    margin: 0;
    padding-left: 1.25rem;
}

.lesson-preview-list li {
    position: relative;
    padding-right: 2rem;
}

.lesson-preview-block {
    position: relative;
    padding-right: 2rem;
}

.lesson-block-comments {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 5;
}

.lesson-block-comments [data-block-comments-toggle] {
    padding: 0.25rem 0.35rem;
    font-size: 0.9rem;
    min-height: auto;
    background: transparent;
    border-color: transparent;
    opacity: 0.4;
    transition: all 0.2s;
}

.lesson-block-comments [data-block-comments-toggle]:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.4);
    border-color: var(--border);
}

.lesson-block-comments [data-block-comments-panel] {
    position: absolute;
    top: 100%;
    right: 0;
    width: 25rem;
    max-width: calc(100vw - 2rem);
    margin-top: 0.5rem;
    z-index: 10;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}



.card-stack {
    display: grid;
    gap: 1rem;
}

.srs-card {
    display: grid;
    gap: 1rem;
}

.srs-card__content {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.srs-card__image {
    flex: 0 0 auto;
}

.chat-page {
    display: grid;
    gap: 1rem;
}

.chat-page__banner {
    display: grid;
    gap: 0.25rem;
}

.chat-page__banner h1 {
    margin-bottom: 0;
    font-size: clamp(1.45rem, 2.5vw, 1.85rem);
}

.teacher-chat-page-header {
    margin-bottom: 1rem;
}

.teacher-mode.chat-mode .teacher-page-main {
    display: flex;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
}

.teacher-mode.chat-mode .teacher-container {
    display: flex;
    min-height: 0;
    height: 100%;
    flex: 1 1 auto;
    flex-direction: column;
}

.teacher-mode.chat-mode .teacher-chat-inbox {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
}

.teacher-chat-inbox {
    display: grid;
    grid-template-columns: minmax(17rem, 22rem) minmax(0, 1fr);
    gap: 1rem;
}

.teacher-chat-inbox__drawer-toggle,
.teacher-chat-inbox__drawer-close,
.teacher-chat-inbox__drawer-backdrop {
    display: none;
}

.teacher-chat-inbox__contacts,
.teacher-chat-inbox__empty-conversation {
    min-width: 0;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.06);
}

.teacher-chat-inbox__contacts {
    display: grid;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
}

.teacher-chat-inbox__contacts-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 0.25rem;
    padding: 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.teacher-chat-inbox__contacts-header h2,
.teacher-chat-inbox__empty-conversation h2 {
    margin-bottom: 0;
    font-size: 1.15rem;
}

.teacher-chat-inbox__contact-list {
    display: grid;
    align-content: start;
    gap: 0.35rem;
    min-height: 0;
    padding: 0.5rem;
    overflow-y: auto;
}

.teacher-chat-contact {
    display: grid;
    grid-template-columns: 2.4rem minmax(0, 1fr);
    gap: 0.65rem;
    align-items: center;
    min-width: 0;
    padding: 0.65rem;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
}

.teacher-chat-contact:hover,
.teacher-chat-contact--active {
    border-color: rgba(31, 111, 95, 0.22);
    background: rgba(31, 111, 95, 0.08);
}

.teacher-chat-contact:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.teacher-chat-contact__avatar {
    display: inline-flex;
    width: 2.4rem;
    height: 2.4rem;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #176b5b;
    color: #fff;
    font-weight: 700;
}

.teacher-chat-contact__body,
.teacher-chat-contact__topline {
    min-width: 0;
}

.teacher-chat-contact__body {
    display: grid;
    gap: 0.12rem;
}

.teacher-chat-contact__topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.teacher-chat-contact__name,
.teacher-chat-contact__login,
.teacher-chat-contact__preview {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.teacher-chat-contact__name {
    font-size: 0.92rem;
}

.teacher-chat-contact__login,
.teacher-chat-contact__preview {
    color: var(--muted);
    font-size: 0.78rem;
}

.teacher-chat-contact__unread {
    min-width: 1.35rem;
    padding: 0.12rem 0.38rem;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
}

.teacher-chat-inbox__conversation {
    display: flex;
    min-width: 0;
    min-height: 0;
}

.teacher-chat-inbox__conversation > .chat-stage {
    width: 100%;
    height: 100%;
    min-height: 0;
}

.teacher-chat-inbox__contacts-empty,
.teacher-chat-inbox__empty-conversation {
    width: 100%;
    height: 100%;
    display: grid;
    gap: 0.75rem;
    align-content: center;
    justify-items: start;
    padding: 1rem;
}

.chat-stage {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 0;
    height: clamp(34rem, 72vh, 48rem);
    min-height: 34rem;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 18px;
    background: #f3f6f8;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
    color: var(--text);
}

.chat-stage .eyebrow,
.chat-stage h2,
.chat-stage .lead,
.chat-stage .field span {
    color: inherit;
}

.chat-stage .lead,
.chat-stage .table-note {
    color: var(--muted);
}

.chat-stage__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.95rem 1rem 0.85rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(255, 255, 255, 0.94);
}

.chat-stage__header-main,
.chat-stage__identity {
    display: grid;
    gap: 0.45rem;
    min-width: 0;
}

.chat-stage__header-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.chat-stage__back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.7);
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s;
}

.chat-stage__back-link:hover {
    background: rgba(255, 255, 255, 0.95);
}

.chat-stage__back-link:focus-visible,
.chat-stage__composer textarea:focus,
.chat-stage__submit:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    box-shadow: 0 0 0 4px rgba(31, 111, 95, 0.15);
}

.chat-stage__context {
    margin-bottom: 0;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    background: rgba(31, 111, 95, 0.1);
    color: var(--accent-strong);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.chat-stage__identity h2 {
    margin-bottom: 0;
    font-size: clamp(1.15rem, 2vw, 1.45rem);
    line-height: 1.15;
}

.chat-stage__frame {
    display: grid;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr) auto;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background:
        linear-gradient(180deg, rgba(226, 232, 240, 0.44) 0%, rgba(248, 250, 252, 0.96) 100%);
}

.chat-stage__scroll-region {
    display: grid;
    align-content: start;
    gap: 0.65rem;
    min-height: 0;
    max-height: none;
    padding: 1rem;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-color: var(--border) transparent;
}

.chat-stage__messages {
    display: grid;
    gap: 0.35rem;
}

.chat-stage__empty-state {
    display: grid;
    justify-items: center;
    gap: 0.45rem;
    align-content: center;
    min-height: 17rem;
    padding: 2rem 1rem;
    border: 1px dashed rgba(148, 163, 184, 0.34);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.5);
    text-align: center;
}

.chat-stage__empty-title {
    margin-bottom: 0;
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 700;
}

.chat-stage__day-separator {
    position: sticky;
    top: 0.35rem;
    z-index: 1;
    display: flex;
    justify-content: center;
    margin: 0.35rem 0 0.25rem;
}

.chat-stage__day-separator span {
    padding: 0.18rem 0.55rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.25;
    box-shadow: 0 5px 16px rgba(15, 23, 42, 0.05);
}

.chat-stage__message {
    display: flex;
    min-width: 0;
}

.chat-stage__message--self {
    justify-content: flex-start;
}

.chat-stage__message--peer {
    justify-content: flex-start;
}

.chat-stage__bubble {
    position: relative;
    width: fit-content;
    max-width: min(70%, 38rem);
    padding: 0.48rem 0.62rem 0.4rem;
    border: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.08);
}

.chat-stage__message--self .chat-stage__bubble {
    border-color: rgba(21, 79, 68, 0.16);
    border-radius: 18px 18px 18px 6px;
    background: #176b5b;
    color: #fff;
}

.chat-stage__message--peer .chat-stage__bubble {
    border-radius: 18px 18px 18px 6px;
    background: rgba(255, 255, 255, 0.96);
}

.chat-stage__author-meta {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    margin-bottom: 0.18rem;
    min-width: 0;
}

.chat-stage__author {
    color: var(--accent-strong);
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1.2;
}

.chat-stage__role-label {
    color: var(--muted);
    font-size: 0.68rem;
    line-height: 1.2;
}

.chat-stage__role-label::before {
    content: "";
    display: inline-block;
    width: 0.25rem;
    height: 0.25rem;
    margin: 0 0.35rem 0.09rem 0.05rem;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.5;
}

.chat-stage__body-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.5rem;
}

.chat-stage__body {
    flex: 1 1 auto;
    margin-top: 0;
    margin-bottom: 0;
    color: var(--text);
    font-size: 0.94rem;
    line-height: 1.38;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.chat-stage__message--self .chat-stage__body {
    color: rgba(255, 255, 255, 0.95);
}

.chat-stage__timestamp-wrap {
    flex: 0 0 auto;
    margin-left: auto;
    padding-top: 0.18rem;
}

.chat-stage__timestamp {
    color: var(--muted);
    font-size: 0.66rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.chat-stage__message--self .chat-stage__timestamp {
    color: rgba(255, 255, 255, 0.72);
}

.chat-stage__composer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.65rem;
    align-items: end;
    padding: 0.75rem;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(255, 255, 255, 0.9);
}

.chat-stage__composer-field {
    position: relative;
    gap: 0;
}

.chat-stage__composer-field > span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.chat-stage__composer textarea {
    min-height: 3rem;
    max-height: 9rem;
    resize: vertical;
    padding: 0.78rem 0.9rem;
    border-color: rgba(148, 163, 184, 0.38);
    border-radius: 14px;
    background: #fff;
    color: var(--text);
    line-height: 1.35;
}

.chat-stage__composer textarea::placeholder {
    color: var(--muted);
}

.chat-stage__composer-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem;
}

.chat-stage__composer-hint {
    display: none;
}

.chat-stage__submit {
    flex: 0 0 auto;
    min-width: 7rem;
    min-height: 3rem;
    border-radius: 999px;
}

.cookie-banner {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    z-index: 20;
    pointer-events: none;
}

.cookie-banner__panel {
    width: min(100%, 64rem);
    margin: 0 auto;
    padding: 1.25rem 1.5rem;
    border: 1px solid rgba(203, 213, 225, 0.8);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.08), 0 1px 0 rgba(255,255,255,0.5) inset;
    backdrop-filter: blur(16px);
    pointer-events: auto;
}

.pwa-install-banner {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 18;
    width: min(100% - 2rem, 24rem);
    pointer-events: none;
}

.pwa-install-banner__panel {
    position: relative;
    overflow: hidden;
    padding: 1.25rem 1.4rem 1.2rem;
    border: 1px solid rgba(203, 213, 225, 0.7);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(20px);
    pointer-events: auto;
}

.pwa-install-banner__panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #0ea5e9);
    border-radius: 20px 20px 0 0;
}

.pwa-install-banner .eyebrow {
    color: #6366f1;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.pwa-install-banner .eyebrow::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #6366f1;
}

.pwa-install-banner .lead {
    font-size: 0.92rem;
    color: #334155;
    line-height: 1.55;
    margin-bottom: 1rem;
}

.pwa-install-banner .form-actions {
    gap: 0.5rem;
}

.pwa-install-banner .button {
    background: #6366f1;
    font-size: 0.88rem;
    padding: 0.6rem 1.1rem;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.pwa-install-banner .button:hover {
    background: #4f46e5;
}

.pwa-install-banner .button--secondary {
    background: #f1f5f9;
    color: #475569;
    font-size: 0.88rem;
    padding: 0.6rem 1.1rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: none;
}

.pwa-install-banner .button--secondary:hover {
    background: #e2e8f0;
    color: #334155;
}

.cookie-option {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(203, 213, 225, 0.7);
    border-radius: var(--radius-sm);
    background: rgba(248, 250, 252, 0.6);
    transition: background 0.15s;
}

.cookie-option input {
    margin-top: 0.2rem;
}

.cookie-option span {
    display: grid;
    gap: 0.2rem;
}

.cookie-option small {
    color: var(--muted);
}

.site-footer {
    padding: 0 0 2rem;
}

.site-footer__inner {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(203, 213, 225, 0.7);
    background: rgba(255, 255, 255, 0.72);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.site-footer__links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .site-header__inner {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .primary-nav {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        padding-top: 0.5rem;
    }

    .language-switcher {
        width: 100%;
        justify-content: space-between;
        margin-left: 0;
    }

    body[data-nav-open="true"] .primary-nav {
        display: flex;
    }

    .primary-nav a {
        width: 100%;
        text-align: center;
        border: 1px solid rgba(226, 232, 240, 0.7);
        background: rgba(248, 250, 252, 0.95);
    }

    .surface-grid {
        grid-template-columns: 1fr;
    }

    .teacher-tiles,
    .student-detail-grid,
    .lesson-editor-grid {
        grid-template-columns: 1fr;
    }

    .chat-stage__header {
        flex-direction: column;
        align-items: stretch;
    }

    .chat-stage__composer {
        grid-template-columns: 1fr;
    }

    .chat-stage__composer-actions {
        justify-content: stretch;
    }

    .chat-stage__bubble {
        max-width: 84%;
    }

    .chat-stage__submit {
        width: 100%;
    }

    .srs-card__content {
        flex-direction: column;
    }

    .page-main {
        padding-top: 1.5rem;
    }

    .cookie-banner {
        left: 0.5rem;
        right: 0.5rem;
        bottom: 0.5rem;
    }

    .pwa-install-banner {
        left: 0.5rem;
        right: 0.5rem;
        width: auto;
        bottom: 0.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        width: min(100% - 1rem, var(--container));
    }

    .hero,
    .page-card {
        border-radius: var(--radius-md);
    }

    .section-header {
        flex-direction: column;
    }

    .chat-stage {
        padding: 0;
        border-radius: 14px;
    }

    .chat-page__banner h1 {
        font-size: 1.35rem;
    }

    .chat-stage__header-topline {
        align-items: flex-start;
    }

    .chat-stage__scroll-region,
    .chat-stage__composer {
        padding: 0.75rem;
    }

    .chat-stage__bubble {
        max-width: 90%;
    }

    h1 {
        font-size: clamp(1.8rem, 10vw, 2.6rem);
    }

    .lead {
        font-size: 1rem;
    }
}

/* Teacher Cabinet Redesign (Light Theme) */
.teacher-mode {
    background: #f8fafc;
    /* Light, clean background */
    color: #334155;
}

.teacher-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.teacher-sidebar {
    width: 280px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    z-index: 20;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.03);
    overflow: hidden;
    transition: width 0.2s ease;
}

.teacher-sidebar,
.student-sidebar {
    flex: 0 0 auto;
}

.sidebar-header-identity {
    display: flex;
    min-width: 0;
    align-items: center;
    column-gap: 0.5rem;
    row-gap: 0.35rem;
    flex-wrap: wrap;
    flex: 1 1 auto;
}

.sidebar-collapse-toggle {
    display: inline-flex;
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.78);
    color: #64748b;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.sidebar-collapse-toggle svg {
    transition: transform 0.2s ease;
}

.sidebar-collapse-toggle:hover,
.sidebar-collapse-toggle:focus-visible {
    border-color: rgba(13, 148, 136, 0.28);
    background: rgba(13, 148, 136, 0.08);
    color: #0f766e;
    outline: none;
}

.student-mode .sidebar-collapse-toggle:hover,
.student-mode .sidebar-collapse-toggle:focus-visible {
    border-color: rgba(99, 102, 241, 0.28);
    background: rgba(99, 102, 241, 0.08);
    color: #4f46e5;
}

.sidebar-link-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.teacher-nav-link svg,
.student-nav-link svg {
    flex: 0 0 auto;
}

body[data-sidebar-collapsed="true"] .teacher-sidebar,
body[data-sidebar-collapsed="true"] .student-sidebar {
    width: 84px;
}

body[data-sidebar-collapsed="true"] .teacher-sidebar-header,
body[data-sidebar-collapsed="true"] .student-sidebar-header {
    justify-content: center;
    padding: 1rem 0.75rem;
}

body[data-sidebar-collapsed="true"] .sidebar-header-identity,
body[data-sidebar-collapsed="true"] .sidebar-link-label,
body[data-sidebar-collapsed="true"] .sidebar-language-wrapper,
body[data-sidebar-collapsed="true"] .teacher-name,
body[data-sidebar-collapsed="true"] .student-name {
    display: none;
}

body[data-sidebar-collapsed="true"] .sidebar-collapse-toggle {
    margin-left: 0;
}

body[data-sidebar-collapsed="true"] .sidebar-collapse-toggle svg {
    transform: rotate(180deg);
}

body[data-sidebar-collapsed="true"] .teacher-nav,
body[data-sidebar-collapsed="true"] .student-nav {
    align-items: center;
    padding: 1rem 0.75rem;
}

body[data-sidebar-collapsed="true"] .teacher-nav-link,
body[data-sidebar-collapsed="true"] .student-nav-link {
    width: 3rem;
    height: 3rem;
    justify-content: center;
    gap: 0;
    padding: 0;
    border-left: 0;
}

body[data-sidebar-collapsed="true"] .teacher-nav-link:hover,
body[data-sidebar-collapsed="true"] .student-nav-link:hover {
    transform: none;
}

body[data-sidebar-collapsed="true"] .teacher-sidebar .teacher-nav-badge {
    position: absolute;
    top: 0.3rem;
    right: 0.3rem;
    min-width: 1rem;
    height: 1rem;
    margin-left: 0;
    padding: 0 0.25rem;
    font-size: 0.6rem;
}

body[data-sidebar-collapsed="true"] .teacher-sidebar-footer,
body[data-sidebar-collapsed="true"] .student-sidebar-footer {
    flex-direction: column;
    justify-content: center;
    gap: 0.55rem;
    padding: 1rem 0.75rem;
}

body[data-sidebar-collapsed="true"] .teacher-user-info,
body[data-sidebar-collapsed="true"] .student-user-info {
    justify-content: center;
    gap: 0;
}

body[data-sidebar-collapsed="true"] .teacher-logout-btn,
body[data-sidebar-collapsed="true"] .student-logout-btn {
    width: 2.75rem;
    height: 2.75rem;
}

.teacher-sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.teacher-brand {
    font-size: 1.4rem;
    color: #0f172a;
    background: linear-gradient(135deg, #0d9488, #0369a1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.05em;
    font-weight: 800;
}

.teacher-role-badge {
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 700;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: rgba(13, 148, 136, 0.1);
    color: #0d9488;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    border: 1px solid rgba(13, 148, 136, 0.2);
}

.teacher-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.teacher-nav::-webkit-scrollbar {
    width: 4px;
}

.teacher-nav::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.teacher-nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.2rem;
    border-radius: 12px;
    color: #64748b;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.teacher-nav-link:hover {
    color: #0f172a;
    background: rgba(0, 0, 0, 0.03);
    transform: translateX(4px);
}

.teacher-nav-link.active {
    color: #0f172a;
    background: linear-gradient(90deg, rgba(13, 148, 136, 0.08), rgba(3, 105, 161, 0.03));
    border-left: 3px solid #0d9488;
    font-weight: 600;
}

.teacher-nav-badge {
    margin-left: auto;
    background: #e11d48;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    min-width: 1.25rem;
    height: 1.25rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.35rem;
    line-height: 1;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(225, 29, 72, 0.35);
    animation: badge-pulse 2.5s ease-in-out infinite;
}

@keyframes badge-pulse {
    0%, 100% { box-shadow: 0 1px 4px rgba(225, 29, 72, 0.35); }
    50% { box-shadow: 0 1px 8px rgba(225, 29, 72, 0.6); }
}

.teacher-sidebar-footer {
    padding: 1.2rem;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
    background: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.teacher-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.teacher-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d9488, #0284c7);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.2);
}

.teacher-name {
    color: #334155;
    font-weight: 600;
    font-size: 0.9rem;
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.teacher-logout-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 0;
}

.teacher-logout-btn:hover {
    color: #e11d48;
    background: rgba(225, 29, 72, 0.1);
}

.teacher-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    background: #f8fafc;
}

.teacher-main::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 30vh;
    background: radial-gradient(circle at top right, rgba(14, 165, 233, 0.08), transparent 60%);
    pointer-events: none;
    z-index: 0;
}


.teacher-page-main {
    flex: 1;
    overflow-y: auto;
    padding: 2rem !important;
    padding-bottom: var(--teacher-pb, 2rem) !important;
    z-index: 5;
}

.teacher-container {
    max-width: 1400px !important;
}

/* Adjust components for teacher theme */
.teacher-mode .page-card,
.teacher-mode .hero {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(16px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.02);
    color: #334155;
}

.teacher-mode h1,
.teacher-mode h2,
.teacher-mode h3 {
    color: #0f172a;
}

.teacher-mode .lead {
    color: #475569;
}

.teacher-mode .eyebrow {
    color: #0d9488;
}

.teacher-mode .surface-card,
.teacher-mode .chart-bar-card,
.teacher-mode .import-report-card {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

/* .teacher-mode .surface-card:not([data-beta-lesson-editor-shell]):hover {
    background: #ffffff !important;
    border-color: rgba(13, 148, 136, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.04);
    transition: all 0.3s;
} */

.teacher-mode .surface-card:not([data-beta-lesson-editor-shell]) p {
    color: #64748b;
}

.teacher-mode .surface-card a,
.teacher-mode a {
    color: #0284c7;
}

.teacher-mode .surface-card a:hover {
    text-decoration: underline;
}

.teacher-mode .button {
    background: #0ea5e9;
    color: #fff;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.teacher-mode .button:hover {
    background: #0284c7;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(14, 165, 233, 0.3);
}

.teacher-mode .button--secondary {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: none;
}

.teacher-mode .button--secondary:hover {
    background: #e2e8f0;
}

.teacher-mode .field input,
.teacher-mode .field select,
.teacher-mode .field textarea {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
}

.teacher-mode .field input:focus,
.teacher-mode .field select:focus,
.teacher-mode .field textarea:focus {
    border-color: #0ea5e9;
    outline: 2px solid rgba(14, 165, 233, 0.15);
}

.teacher-mode .table-card {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.05);
}

.teacher-mode .data-table th,
.teacher-mode .data-table td {
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    color: #334155;
}

.teacher-mode .data-table th {
    color: #64748b;
}

.teacher-mode .status-chip--active {
    background: rgba(13, 148, 136, 0.1);
    color: #0d9488;
}

.teacher-mode .status-chip--available {
    background: rgba(2, 132, 199, 0.1);
    color: #0284c7;
}

.teacher-mode .status-chip--inactive {
    background: rgba(225, 29, 72, 0.1);
    color: #e11d48;
}

.admin-mode {
    color: #1f2937;
    background: #eef2f7;
}

.admin-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
}

.admin-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(15, 23, 42, 0.08);
    background: #ffffff;
}

.admin-sidebar__header,
.admin-sidebar__footer {
    padding: 1rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.admin-sidebar__footer {
    margin-top: auto;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    border-bottom: 0;
    display: grid;
    gap: 0.75rem;
}

.admin-sidebar__footer span {
    display: block;
    color: #64748b;
    font-size: 0.82rem;
}

.admin-brand {
    color: #0f172a;
}

.admin-role-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 0.5rem;
    padding: 0.2rem 0.5rem;
    border: 1px solid rgba(51, 65, 85, 0.18);
    border-radius: 999px;
    background: #f8fafc;
    color: #475569;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
}

.admin-nav {
    display: grid;
    gap: 0.35rem;
    padding: 1rem;
}

.admin-nav a,
.mobile-nav-menu--admin a {
    border-radius: 8px;
    padding: 0.7rem 0.85rem;
    color: #475569;
    font-weight: 650;
}

.admin-nav a:hover,
.admin-nav a.active,
.mobile-nav-menu--admin a:hover,
.mobile-nav-menu--admin a.active {
    background: #e0f2fe;
    color: #075985;
}

.admin-main {
    min-width: 0;
    padding: 1.5rem;
    overflow-x: hidden;
}

.admin-container {
    width: min(100%, 1360px);
    margin: 0 auto;
}

.admin-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.admin-page-header h1 {
    margin-bottom: 0.35rem;
    font-size: 2rem;
    letter-spacing: 0;
}

.admin-metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.admin-metric {
    display: grid;
    gap: 0.25rem;
    min-height: 7rem;
    padding: 1rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 8px;
    background: #ffffff;
}

.admin-metric span {
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.admin-metric strong {
    color: #0f172a;
    font-size: 2rem;
    line-height: 1;
}

.admin-metric small {
    color: #64748b;
}

.admin-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.admin-filter-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
    gap: 0.75rem;
    align-items: end;
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 8px;
    background: #ffffff;
}

.admin-filter-bar label,
.admin-filter-bar span {
    display: grid;
    gap: 0.35rem;
}

.admin-filter-bar span,
.admin-mode .field span {
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.admin-filter-bar input,
.admin-filter-bar select,
.admin-mode .field input,
.admin-mode .field select {
    min-width: 0;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
    background: #ffffff;
    color: #0f172a;
    font: inherit;
}

.admin-stat-list {
    display: grid;
    gap: 0.5rem;
    margin: 0;
}

.admin-stat-list div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid rgba(15, 23, 42, 0.07);
}

.admin-stat-list dt {
    color: #64748b;
    font-weight: 650;
}

.admin-stat-list dd {
    margin: 0;
    color: #0f172a;
    font-weight: 800;
}

.admin-list {
    display: grid;
    gap: 0.65rem;
}

.admin-list div {
    display: grid;
    gap: 0.2rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.07);
}

.admin-list span {
    color: #64748b;
    font-size: 0.84rem;
}

.admin-action-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1rem;
}

.admin-action-stack form {
    margin: 0;
}

.admin-password-reset-dialog {
    max-width: 460px;
}

.admin-password-reset-dialog__body {
    margin: 0 0 1rem;
    color: #475569;
}

.admin-password-reset-dialog__copy-row {
    display: flex;
    gap: 0.5rem;
}

.admin-password-reset-dialog__copy-row input {
    flex: 1 1 auto;
    min-width: 0;
}

.admin-storage-tree {
    display: grid;
    gap: 0.65rem;
    max-width: 100%;
    min-width: 0;
}

.admin-storage-tree__branch {
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 8px;
    background: #ffffff;
}

.admin-storage-tree__branch summary {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    cursor: pointer;
    overflow-wrap: anywhere;
}

.admin-storage-tree__branch summary strong {
    color: #0f766e;
    white-space: nowrap;
}

.admin-storage-tree__branch .admin-stat-list {
    padding: 0 1rem 1rem;
}

.impersonation-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(180, 83, 9, 0.35);
    border-radius: 8px;
    background: #fffbeb;
    color: #78350f;
}

.impersonation-banner div {
    display: grid;
    gap: 0.15rem;
}

.impersonation-banner span {
    font-size: 0.86rem;
}

.impersonation-banner form {
    display: flex;
    gap: 0.5rem;
    margin: 0;
}

.impersonation-banner input {
    width: 12rem;
    border: 1px solid rgba(180, 83, 9, 0.35);
    border-radius: 8px;
    padding: 0.45rem 0.6rem;
}

.mobile-app-bar--admin {
    display: none;
}

.teacher-dashboard-header {
    margin-bottom: 2rem;
}

.teacher-dashboard-title {
    margin-bottom: 0.5rem;
    color: #0f172a;
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 0;
}

.teacher-dashboard-lead {
    max-width: 800px;
    color: #475569;
}

.teacher-dashboard-create-action {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.teacher-dashboard-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: #0f172a;
    font-weight: 700;
}

.teacher-mode .teacher-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.teacher-dashboard-main .teacher-tiles {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.teacher-stat-card {
    display: block;
    color: inherit;
    text-decoration: none;
}

.teacher-stat-card--featured {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.teacher-stat-card--badge {
    position: relative;
}

.teacher-stat-card__value {
    margin: 0;
    font-size: 1.8rem;
}

.teacher-stat-card--featured .teacher-stat-card__value {
    font-size: 2.2rem;
}

.teacher-stat-card__value--students {
    color: #0284c7;
}

.teacher-stat-card__value--lessons {
    color: #0d9488;
}

.teacher-stat-card__value--neutral {
    color: #334155;
}

.teacher-stat-card__value--due {
    color: #d97706;
}

.teacher-stat-card__value--success {
    color: #65a30d;
}

.teacher-stat-card__value--danger {
    color: #e11d48;
}

.teacher-stat-card__label {
    margin-top: 0.25rem;
    font-size: 0.9rem;
}

.teacher-review-summary-tiles {
    margin-bottom: 1.5rem;
}

.teacher-review-stat-card {
    border-left: 4px solid #0d9488;
}

.teacher-review-stat-card--pending {
    border-left-color: #e11d48;
}

.teacher-review-stat-card__value {
    margin: 0;
    color: #334155;
    font-size: 2.2rem;
}

.teacher-review-stat-card--pending .teacher-review-stat-card__value {
    color: #e11d48;
}

.teacher-review-stat-card__label {
    margin-top: 0.25rem;
}

.teacher-stat-card__badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: #e11d48;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.teacher-dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    align-items: start;
}

.teacher-dashboard-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.teacher-dashboard-widget {
    padding: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.03);
}

.teacher-dashboard-widget__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.teacher-dashboard-widget__header--roomy {
    margin-bottom: 1.5rem;
}

.teacher-dashboard-widget__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: #0f172a;
    font-size: 1.4rem;
}

.teacher-dashboard-widget__pill {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.8rem;
    border: 1px solid rgba(225, 29, 72, 0.2);
    border-radius: 999px;
    background: rgba(225, 29, 72, 0.1);
    color: #e11d48;
    font-size: 0.85rem;
    font-weight: 700;
}

.teacher-dashboard-widget__pill-count {
    margin-right: 0.3rem;
    font-size: 1.1rem;
}

.teacher-dashboard-widget__list {
    display: grid;
    gap: 0.75rem;
}

.teacher-dashboard-widget__item {
    padding: 1rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    background: #f8fafc;
    box-shadow: none;
}

.teacher-dashboard-widget__item-header {
    margin-bottom: 0.5rem;
}

.teacher-dashboard-widget__item-header--roomy {
    margin-bottom: 0.75rem;
}

.teacher-dashboard-widget__item-title {
    margin-bottom: 0.15rem;
    color: #0f172a;
    font-size: 1rem;
}

.teacher-dashboard-widget__item-title--large {
    margin-bottom: 0.2rem;
    font-size: 1.1rem;
}

.teacher-dashboard-widget__item-meta {
    margin: 0;
    color: #64748b;
    font-size: 0.78rem;
}

.teacher-dashboard-widget__item-meta--large {
    font-size: 0.8rem;
}

.teacher-dashboard-widget__status {
    flex-shrink: 0;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: rgba(225, 29, 72, 0.08);
    color: #e11d48;
    font-size: 0.72rem;
    white-space: nowrap;
}

.teacher-dashboard-widget__block {
    margin-bottom: 0.75rem;
    color: #64748b;
    font-size: 0.8rem;
}

.teacher-dashboard-widget__action {
    margin: 0;
}

.teacher-dashboard-widget__button {
    display: flex;
    padding: 0.5rem;
    font-size: 0.9rem;
    text-align: center;
}

.teacher-dashboard-widget__footer {
    margin-top: 1rem;
    text-align: center;
}

.teacher-dashboard-widget__view-all {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.teacher-dashboard-widget__count-badge {
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    background: #e11d48;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
}

.teacher-dashboard-empty {
    padding: 1.5rem 0;
    color: #64748b;
    text-align: center;
    opacity: 0.7;
}

.teacher-dashboard-empty--roomy {
    padding: 2rem 0;
}

.teacher-dashboard-empty__icon {
    margin-bottom: 0.5rem;
}

.teacher-dashboard-empty__icon--large {
    margin-bottom: 1rem;
}

.teacher-dashboard-empty__text {
    margin: 0;
    font-size: 0.9rem;
}

.teacher-dashboard-empty__text--large {
    font-size: 0.95rem;
}

.teacher-dashboard-widget__unread-count {
    padding: 0.2rem 0.5rem;
    background: rgba(14, 165, 233, 0.1);
    color: #0284c7;
    font-size: 0.75rem;
}

.teacher-dashboard-widget__message {
    margin-bottom: 1rem;
    color: #475569;
    font-size: 0.95rem;
    line-height: 1.4;
}

.teacher-mobile-primary-action {
    flex: 0 0 auto;
}

.teacher-row-actions {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.25rem;
    white-space: nowrap;
}

.teacher-row-actions .button {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: auto;
}

.teacher-row-actions svg {
    flex: 0 0 auto;
}


/* ── Student Cabinet (Light Sidebar Theme) ─────────────────────────── */

.student-mode {
    background: #f8fafc;
    color: #334155;
}

.student-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.student-sidebar {
    width: 260px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    z-index: 20;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.03);
    overflow: hidden;
    transition: width 0.2s ease;
}

.student-sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.student-brand {
    font-size: 1.4rem;
    color: #0f172a;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.05em;
    font-weight: 800;
}

.student-role-badge {
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 700;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.student-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.student-nav::-webkit-scrollbar {
    width: 4px;
}

.student-nav::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.student-nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.2rem;
    border-radius: 12px;
    color: #64748b;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.student-nav-link:hover {
    color: #0f172a;
    background: rgba(0, 0, 0, 0.03);
    transform: translateX(4px);
}

.student-nav-link.active {
    color: #0f172a;
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.03));
    border-left: 3px solid #6366f1;
    font-weight: 600;
}

.student-sidebar-footer {
    padding: 1.2rem;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
    background: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.student-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.student-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.student-name {
    color: #334155;
    font-weight: 600;
    font-size: 0.9rem;
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.student-logout-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 0;
}

.student-logout-btn:hover {
    color: #e11d48;
    background: rgba(225, 29, 72, 0.1);
}

.student-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    background: #f8fafc;
}

.student-main::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 30vh;
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.07), transparent 60%);
    pointer-events: none;
    z-index: 0;
}


.student-page-main {
    flex: 1;
    overflow-y: auto;
    padding: 2rem !important;
    z-index: 5;
}

.student-container {
    max-width: 1200px !important;
}

/* Adjust components for student theme */
.student-mode .page-card,
.student-mode .hero {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(16px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.02);
    color: #334155;
}

.student-mode h1,
.student-mode h2,
.student-mode h3 {
    color: #0f172a;
}

.student-mode .lead {
    color: #475569;
}

.student-mode .eyebrow {
    color: #6366f1;
}

.student-mode .surface-card,
.student-mode .chart-bar-card,
.student-mode .import-report-card {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.student-mode .surface-card:not([data-beta-lesson-editor-shell]) p {
    color: #64748b;
}

.student-mode .surface-card a,
.student-mode a {
    color: #6366f1;
}

.student-mode .surface-card a:hover {
    text-decoration: underline;
}

.student-mode .button {
    background: #6366f1;
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.student-mode .button:hover {
    background: #4f46e5;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.3);
}

.student-mode .button--secondary {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: none;
}

.student-mode .button--secondary:hover {
    background: #e2e8f0;
    transform: none;
    box-shadow: none;
}

.student-mode .button--danger {
    background: #e11d48;
    box-shadow: 0 4px 12px rgba(225, 29, 72, 0.2);
}

.student-mode .button--danger:hover {
    background: #be123c;
    transform: translateY(-1px);
}

.student-mode .field input,
.student-mode .field select,
.student-mode .field textarea {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
}

.student-mode .field input:focus,
.student-mode .field select:focus,
.student-mode .field textarea:focus {
    border-color: #6366f1;
    outline: 2px solid rgba(99, 102, 241, 0.15);
}

.student-mode .table-card {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.05);
}

.student-mode .data-table th,
.student-mode .data-table td {
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    color: #334155;
}

.student-mode .data-table th {
    color: #64748b;
}

.student-mode .status-chip--active {
    background: rgba(99, 102, 241, 0.1);
    color: #4f46e5;
}

.student-mode .status-chip--available {
    background: rgba(2, 132, 199, 0.1);
    color: #0284c7;
}

.student-mode .status-chip--inactive {
    background: rgba(225, 29, 72, 0.1);
    color: #e11d48;
}

.student-mode .teacher-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.student-mode .chart-bar-fill {
    background: linear-gradient(180deg, #818cf8 0%, #6366f1 100%);
}

.student-mode .chart-bar-track {
    background: rgba(99, 102, 241, 0.08);
}

.student-mode select#language-select-student {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
    border-radius: 999px;
    padding: 0.4rem 0.8rem;
}

/* ── Public pages — neutral light theme ─────────────────────────────── */

body:not(.teacher-mode):not(.student-mode) {
    background:
        radial-gradient(circle at top left, rgba(99, 102, 241, 0.06), transparent 35%),
        linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

body:not(.teacher-mode):not(.student-mode) .site-header {
    background: rgba(248, 250, 252, 0.92);
    border-bottom-color: rgba(203, 213, 225, 0.7);
}

body:not(.teacher-mode):not(.student-mode) .hero,
body:not(.teacher-mode):not(.student-mode) .page-card {
    background: rgba(255, 255, 255, 0.88);
    border-color: rgba(203, 213, 225, 0.7);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
}

body:not(.teacher-mode):not(.student-mode) .surface-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.95));
    border-color: rgba(203, 213, 225, 0.8);
}

body:not(.teacher-mode):not(.student-mode) .eyebrow {
    color: #6366f1;
}

body:not(.teacher-mode):not(.student-mode) .button {
    background: #6366f1;
}

body:not(.teacher-mode):not(.student-mode) .button:hover {
    background: #4f46e5;
}

body:not(.teacher-mode):not(.student-mode) .button--secondary {
    background: rgba(99, 102, 241, 0.1);
    color: #4f46e5;
}

body:not(.teacher-mode):not(.student-mode) .primary-nav a:hover,
body:not(.teacher-mode):not(.student-mode) .primary-nav a:focus-visible {
    background: rgba(99, 102, 241, 0.1);
    color: #4f46e5;
}

body:not(.teacher-mode):not(.student-mode) .site-footer__inner {
    background: rgba(255, 255, 255, 0.75);
    border-color: rgba(203, 213, 225, 0.8);
}

/* ── Public landing ─────────────────────────────────────────────────── */

.landing-page {
    overflow: hidden;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(203, 213, 225, 0.72);
    border-radius: var(--radius-lg);
    box-shadow: 0 18px 46px rgba(15, 23, 42, 0.08);
}

.landing-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(19rem, 25rem);
    gap: clamp(1.5rem, 4vw, 2.4rem);
    align-items: center;
    padding: clamp(1.75rem, 5vw, 3.2rem);
}

.landing-hero__content,
.landing-final > div,
.landing-section {
    min-width: 0;
}

.landing-hero__label,
.landing-section__label {
    display: inline-flex;
    align-items: center;
    min-height: 2.1rem;
    margin-bottom: 1rem;
    border-radius: 999px;
    color: #4f46e5;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}

.landing-hero__label {
    padding: 0 0.85rem;
    border: 1px solid rgba(99, 102, 241, 0.2);
    background: rgba(99, 102, 241, 0.08);
}

.landing-section__label {
    min-height: 0;
    margin-bottom: 0.75rem;
}

.landing-hero__title {
    max-width: 42rem;
    margin-bottom: 1.1rem;
    font-size: clamp(2.25rem, 5vw, 4rem);
    line-height: 1.06;
    letter-spacing: 0;
    overflow-wrap: break-word;
    text-wrap: balance;
}

.landing-hero__lead {
    max-width: 39rem;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 1.08rem;
    line-height: 1.7;
}

.landing-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.6rem;
}

.landing-proof-grid,
.landing-feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.landing-proof-grid {
    margin-top: 1.75rem;
}

.landing-proof-card,
.landing-feature-card,
.landing-step {
    border: 1px solid rgba(203, 213, 225, 0.82);
    background: linear-gradient(180deg, #ffffff, #f8fafc);
}

.landing-proof-card {
    min-height: 6rem;
    padding: 0.9rem;
    border-radius: var(--radius-sm);
}

.landing-proof-card h2,
.landing-dashboard__item h2,
.landing-feature-card h3,
.landing-step h3 {
    margin-bottom: 0.45rem;
    font-size: 0.95rem;
    line-height: 1.35;
}

.landing-proof-card p,
.landing-dashboard__item p,
.landing-feature-card p,
.landing-step p,
.landing-section > p,
.landing-final p {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.65;
}

.landing-proof-card p,
.landing-dashboard__item p {
    font-size: 0.86rem;
}

.landing-dashboard {
    overflow: hidden;
    border: 1px solid rgba(203, 213, 225, 0.9);
    border-radius: 22px;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    box-shadow: 0 22px 55px rgba(15, 23, 42, 0.1);
}

.landing-dashboard__header {
    padding: 1.1rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.85);
}

.landing-dashboard__header strong {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 1.1rem;
}

.landing-dashboard__header span,
.landing-dashboard__meta {
    color: var(--muted);
    font-size: 0.84rem;
}

.landing-dashboard__body {
    display: grid;
    gap: 0.75rem;
    padding: 1.1rem;
}

.landing-dashboard__item {
    display: grid;
    gap: 0.5rem;
    padding: 0.9rem;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: var(--radius-sm);
    background: #ffffff;
}

.landing-dashboard__meta {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: center;
}

.landing-dashboard__tag {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 0.3rem 0.55rem;
    background: rgba(31, 111, 95, 0.1);
    color: #1f6f5f;
    font-size: 0.75rem;
    font-weight: 700;
}

.landing-dashboard__progress {
    display: block;
    height: 0.55rem;
    overflow: hidden;
    border-radius: 999px;
    background: #eef2ff;
}

.landing-dashboard__progress span {
    display: block;
    width: 68%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #6366f1, #1f6f5f);
}

.landing-section {
    padding: clamp(1.75rem, 4vw, 2.7rem) clamp(1.75rem, 5vw, 3.2rem);
    border-top: 1px solid rgba(226, 232, 240, 0.78);
}

.landing-section h2,
.landing-final h2 {
    max-width: 46rem;
    margin-bottom: 0.9rem;
    font-size: clamp(1.7rem, 3vw, 2.35rem);
    line-height: 1.16;
    letter-spacing: 0;
    overflow-wrap: break-word;
    text-wrap: balance;
}

.landing-section > p {
    max-width: 48rem;
}

.landing-feature-grid {
    margin-top: 1.35rem;
}

.landing-feature-card {
    min-height: 11rem;
    padding: 1.2rem;
    border-radius: var(--radius-md);
}

.landing-feature-card h3 {
    font-size: 1.15rem;
}

.landing-steps {
    display: grid;
    gap: 0.75rem;
    margin-top: 1.35rem;
}

.landing-step {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    padding: 1.1rem;
    border-radius: var(--radius-md);
}

.landing-step__number {
    display: inline-flex;
    width: 2.15rem;
    height: 2.15rem;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.1);
    color: #4f46e5;
    font-weight: 800;
}

.landing-final {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    align-items: center;
    padding: clamp(1.75rem, 4vw, 2.8rem) clamp(1.75rem, 5vw, 3.2rem);
    border-top: 1px solid rgba(226, 232, 240, 0.78);
    background: rgba(248, 250, 252, 0.72);
}

.landing-final p {
    max-width: 43rem;
}

.landing-final > .button {
    flex: 0 0 auto;
}

.landing-final__links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    margin-top: 1rem;
}

.landing-final__links a {
    color: #4f46e5;
    font-weight: 600;
}

@media (max-width: 900px) {
    .landing-hero {
        grid-template-columns: 1fr;
    }

    .landing-dashboard {
        max-width: 36rem;
    }

    .landing-final {
        display: grid;
        align-items: stretch;
    }

    .landing-final > .button {
        justify-self: flex-start;
    }
}

@media (max-width: 768px) {
    .landing-proof-grid,
    .landing-feature-grid {
        grid-template-columns: 1fr;
    }

    .landing-proof-card,
    .landing-feature-card {
        min-height: 0;
    }
}

@media (max-width: 480px) {
    .landing-page {
        border-radius: var(--radius-md);
    }

    .landing-hero,
    .landing-section,
    .landing-final {
        padding: 1.25rem;
    }

    .landing-hero__actions .button,
    .landing-final > .button {
        width: 100%;
    }

    .landing-dashboard__meta {
        align-items: flex-start;
    }

    .landing-step {
        grid-template-columns: 1fr;
    }
}

/* ── Student-mode chat: light theme ─────────────────────────────────── */

.student-mode .chat-stage {
    background: #f3f6fb;
    border: 1px solid rgba(99, 102, 241, 0.12);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.07);
    color: #0f172a;
    border-radius: 18px;
}

.student-mode .chat-stage .eyebrow {
    color: #6366f1;
}

.student-mode .chat-stage h2,
.student-mode .chat-stage .lead,
.student-mode .chat-stage .field span {
    color: #0f172a;
}

.student-mode .chat-stage .lead,
.student-mode .chat-stage .table-note {
    color: #64748b;
}

.student-mode .chat-stage__back-link {
    border-color: rgba(15, 23, 42, 0.1);
    background: rgba(99, 102, 241, 0.06);
    color: #4f46e5;
    font-weight: 600;
}

.student-mode .chat-stage__back-link:hover {
    background: rgba(99, 102, 241, 0.12);
}

.student-mode .chat-stage__context {
    background: rgba(99, 102, 241, 0.08);
    color: #4f46e5;
}

.student-mode .chat-stage__frame {
    background:
        linear-gradient(180deg, rgba(226, 232, 240, 0.5) 0%, rgba(248, 250, 252, 0.98) 100%);
}

.student-mode .chat-stage__scroll-region {
    scrollbar-color: rgba(99, 102, 241, 0.2) transparent;
}

.student-mode .chat-stage__empty-state {
    border-color: rgba(99, 102, 241, 0.15);
    background: rgba(248, 250, 252, 0.6);
}

.student-mode .chat-stage__empty-title {
    color: #334155;
}

.student-mode .chat-stage__day-separator span {
    border-color: rgba(15, 23, 42, 0.07);
    background: rgba(255, 255, 255, 0.8);
    color: #64748b;
}

.student-mode .chat-stage__message--self .chat-stage__bubble {
    border-color: rgba(79, 70, 229, 0.18);
    background: #4f46e5;
}

.student-mode .chat-stage__message--peer .chat-stage__bubble {
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.student-mode .chat-stage__author {
    color: #6366f1;
}

.student-mode .chat-stage__role-label {
    color: #94a3b8;
}

.student-mode .chat-stage__message--peer .chat-stage__body {
    color: #0f172a;
}

.student-mode .chat-stage__message--peer .chat-stage__timestamp {
    color: #94a3b8;
}

.student-mode .chat-stage__composer {
    border-top-color: rgba(15, 23, 42, 0.06);
    background: rgba(255, 255, 255, 0.92);
}

.student-mode .chat-stage__composer textarea {
    border-color: #cbd5e1;
    background: #ffffff;
    color: #0f172a;
    border-radius: 14px;
}

.student-mode .chat-stage__composer textarea::placeholder {
    color: #94a3b8;
}

.student-mode .chat-stage__composer-hint {
    color: #94a3b8;
}

.student-mode .chat-stage__back-link:focus-visible,
.student-mode .chat-stage__composer textarea:focus,
.student-mode .chat-stage__submit:focus-visible {
    outline-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

/* ── Sidebar language switcher ──────────────────────── */

.sidebar-language-wrapper {
    padding: 0 1.5rem 1rem;
}

.sidebar-language-wrapper .language-switcher {
    margin-left: 0;
    width: 100%;
}

.sidebar-language-wrapper .language-switcher select {
    width: 100%;
    font-size: 0.82rem;
    padding: 0.35rem 0.75rem;
    padding-right: 2rem;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.07);
    background-color: transparent;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    color: #64748b;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s, color 0.2s;
    appearance: none;
    -webkit-appearance: none;
}

.student-mode .sidebar-language-wrapper .language-switcher select:hover {
    border-color: rgba(99, 102, 241, 0.3);
    background-color: rgba(255, 255, 255, 0.6);
    color: #334155;
}

.student-mode .sidebar-language-wrapper .language-switcher select:focus {
    outline: 2px solid rgba(99, 102, 241, 0.15);
    border-color: #6366f1;
    background-color: rgba(255, 255, 255, 0.8);
    color: #334155;
}

.teacher-mode .sidebar-language-wrapper .language-switcher select:hover {
    border-color: rgba(14, 165, 233, 0.3);
    background-color: rgba(255, 255, 255, 0.6);
    color: #334155;
}

.teacher-mode .sidebar-language-wrapper .language-switcher select:focus {
    outline: 2px solid rgba(14, 165, 233, 0.15);
    border-color: #0ea5e9;
    background-color: rgba(255, 255, 255, 0.8);
    color: #334155;
}

/* Details Panel (Accordion) */
.details-panel {
    overflow: hidden;
}

.student-cards-detail {
    margin-top: 1.5rem;
    padding: 0;
}

.details-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    list-style: none; /* Hide default arrow */
    margin: 0;
    box-shadow: none; /* Remove page-card shadow */
    border: none;
    border-radius: var(--radius-lg); /* Keep radius if it's closed */
    background: transparent;
}

.student-cards-summary {
    padding: clamp(1.5rem, 4vw, 2.5rem);
}

.student-cards-summary__title {
    margin: 0;
}

.details-panel[open] .details-summary {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

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

.details-chevron {
    transition: transform 0.2s ease;
    color: var(--muted);
    font-size: 0.9rem;
    padding-left: 1rem;
}

.details-panel[open] .details-chevron {
    transform: rotate(180deg);
}

.details-content {
    padding: 0 1.5rem 1.5rem;
    border-top: 1px solid rgba(226, 232, 240, 0.5);
}

.student-cards-section {
    margin-top: 1.25rem;
}

.student-cards-chart-empty {
    margin-top: 0.75rem;
}

/* ── SRS Card Redesign ─────────────────────────────────────────────── */

.srs-progress-header {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #64748b;
    font-size: 0.95rem;
}

.srs-card--focused {
    max-width: 500px;
    margin: 0 auto;
    padding: 1.25rem;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
}

.srs-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.srs-card__tag {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.6rem;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 6px;
    color: #64748b;
}

.srs-card__content--center {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
}

.srs-card__examples {
    position: relative;
    margin-top: 1rem;
    opacity: 0.8;
    font-size: 0.9em;
    text-align: left;
}

.srs-example-audio-btn {
    position: absolute;
    top: 0;
    right: 0;
    padding: 0.25rem;
    border: 0;
    background: none;
    color: #6366f1;
    cursor: pointer;
}

.srs-card__example-pair {
    margin-bottom: 0.5rem;
    padding-right: 2rem;
    padding-left: 1rem;
    border-left: 2px solid var(--border);
}

.srs-card__example-target {
    color: var(--muted);
}

.lesson-reset-warning {
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

.lesson-reset-feedback {
    margin-top: 0.5rem;
}

@keyframes srs-shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

.srs-card__image-wrap {
    position: relative;
    width: 100%;
    height: 120px;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(
        90deg,
        rgba(0, 0, 0, 0.04) 25%,
        rgba(0, 0, 0, 0.08) 50%,
        rgba(0, 0, 0, 0.04) 75%
    );
    background-size: 800px 100%;
    animation: srs-shimmer 1.4s infinite linear;
    flex-shrink: 0;
}

.srs-card__image-wrap--empty {
    background: rgba(0, 0, 0, 0.03);
    border: 1px dashed rgba(0, 0, 0, 0.1);
    animation: none;
}

.srs-card__hero-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.srs-card__hero-image.is-loaded {
    opacity: 1;
}

/* Legacy placeholder — kept for fallback, hidden via wrap */
.srs-card__hero-image-placeholder {
    width: 100%;
    height: 120px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 12px;
    border: 1px dashed rgba(0, 0, 0, 0.1);
}

.srs-card__source-text {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0.5rem 0;
    color: #0f172a;
    line-height: 1.2;
}

.srs-card__target-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.02);
    padding: 1rem;
    border-radius: 12px;
    margin: 0.5rem 0;
}

.srs-card__target-text {
    text-align: left;
    flex: 1;
}

.srs-card__target {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #334155;
}

.srs-card__audio-player {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 1rem;
}

.srs-audio-btn {
    background: #6366f1;
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.srs-audio-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.srs-audio-btn svg {
    margin-left: 4px; /* visually center the play triangle */
}

.form-actions--full {
    display: flex;
}

.form-actions--full .button {
    width: 100%;
}

.form-actions--grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 2rem;
}

.button--large {
    padding: 1.2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
}

/* Responsive student app shell and reusable student layout pieces */
.mobile-app-bar,
.mobile-bottom-nav {
    display: none;
}

.app-page-header {
    display: grid;
    gap: 0.45rem;
    margin-bottom: 2rem;
}

.app-page-title {
    margin: 0;
    color: #0f172a;
    font-size: clamp(1.85rem, 4vw, 2.5rem);
    font-weight: 800;
    line-height: 1.08;
}

.student-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.student-stat-card {
    display: flex;
    min-width: 0;
    min-height: 7.5rem;
    flex-direction: column;
    justify-content: space-between;
    color: inherit;
    text-decoration: none;
}

.student-stat-card:hover {
    text-decoration: none;
}

.student-stat-card__value {
    margin: 0;
    color: #6366f1;
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.05;
}

.student-stat-card__value--orange {
    color: #d97706;
}

.student-stat-card__value--warning {
    color: #d97706;
}

.student-stat-card__value--teal {
    color: #0d9488;
}

.student-stat-card__value--success {
    color: #0d9488;
}

.student-stat-card__value--blue {
    color: #0284c7;
}

.student-stat-card__value--info {
    color: #0284c7;
}

.student-stat-card__value--slate {
    color: #334155;
}

.student-stat-card__value--neutral {
    color: #334155;
}

.student-stat-card__value--muted {
    color: #94a3b8;
}

.student-stat-card__value--danger {
    color: #e11d48;
}

.student-stat-card__meta {
    margin-top: 0.25rem;
    color: #64748b;
    font-size: 0.9rem;
    line-height: 1.45;
}

.student-stat-card__body {
    display: grid;
    gap: 0.25rem;
}

.student-stat-card__detail {
    display: grid;
    gap: 0.35rem;
    margin-top: 0.75rem;
}

.student-stat-card__timestamp {
    margin: 0;
    color: #64748b;
    font-size: 0.8rem;
}

.student-stat-card__preview {
    margin: 0;
    color: #475569;
    font-size: 0.88rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.student-stat-card__action {
    justify-self: start;
    min-height: 36px;
    padding: 0.4rem 0.9rem;
    font-size: 0.88rem;
}

.student-content-stack,
.student-profile-stack {
    display: grid;
    gap: 1.25rem;
}

.student-profile-stack {
    max-width: 50rem;
}

.student-profile-card {
    padding: 2rem;
}

.student-profile-danger,
.student-profile-card--danger {
    border-color: rgba(225, 29, 72, 0.2) !important;
    background: rgba(225, 29, 72, 0.02) !important;
}

.student-profile-danger h2,
.student-profile-card--danger h2,
.student-profile-card__title {
    margin: 0 0 0.5rem;
    color: #e11d48;
    font-size: 1.4rem;
}

.student-profile-card__lead {
    margin-bottom: 1.5rem;
    color: #475569;
}

.lesson-detail-actions,
.srs-page-actions {
    align-items: center;
}

.srs-card-nav-actions__mobile-label {
    display: none;
}

.lesson-detail-progress-grid {
    align-items: stretch;
}

@media (max-width: 900px) {
    .student-mode {
        background: #f8fafc;
    }

    .student-mode .student-shell {
        display: block;
        min-height: 100svh;
        height: auto;
        overflow: visible;
        padding-top: 3.75rem;
        padding-bottom: calc(4.75rem + env(safe-area-inset-bottom));
    }

    .student-mode .student-sidebar {
        display: none;
    }

    .student-mode .student-main {
        display: block;
        min-height: auto;
        overflow: visible;
    }

    .student-mode .student-main::before {
        height: 14rem;
    }

    .student-mode .student-page-main {
        display: block;
        overflow: visible;
        padding: 1rem !important;
    }

    .student-mode .student-container {
        width: min(100%, 48rem);
        max-width: none !important;
        padding: 0;
    }

    .mobile-app-bar {
        position: fixed;
        top: 0;
        right: 0;
        left: 0;
        z-index: 35;
        display: flex;
        min-width: 0;
        height: 3.75rem;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        padding: 0.65rem max(0.85rem, env(safe-area-inset-right)) 0.65rem max(0.85rem, env(safe-area-inset-left));
        border-bottom: 1px solid rgba(15, 23, 42, 0.08);
        background: rgba(255, 255, 255, 0.94);
        box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
        backdrop-filter: blur(18px);
    }

    .mobile-app-bar__identity {
        display: flex;
        min-width: 0;
        align-items: center;
        gap: 0.55rem;
    }

    .mobile-app-bar .brand {
        display: inline-flex;
        min-width: 0;
        min-height: 44px;
        align-items: center;
        overflow: hidden;
        font-size: 1rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-account-menu {
        position: relative;
        flex: 0 0 auto;
    }

    .mobile-account-menu__summary {
        display: flex;
        width: 2.75rem;
        height: 2.75rem;
        align-items: center;
        justify-content: center;
        border-radius: 999px;
        cursor: pointer;
        list-style: none;
    }

    .mobile-account-menu__summary::-webkit-details-marker {
        display: none;
    }

    .mobile-account-menu__avatar {
        width: 2.25rem;
        height: 2.25rem;
        font-size: 0.95rem;
    }

    .mobile-account-menu__panel {
        position: absolute;
        top: calc(100% + 0.5rem);
        right: 0;
        display: none;
        width: min(18rem, calc(100vw - 1.5rem));
        gap: 0.7rem;
        padding: 0.9rem;
        border: 1px solid rgba(15, 23, 42, 0.08);
        border-radius: 14px;
        background: #ffffff;
        box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
    }

    .mobile-account-menu[open] > .mobile-account-menu__panel {
        display: grid;
    }

    .mobile-account-menu__name {
        margin: 0;
        color: #0f172a;
        font-weight: 700;
        overflow-wrap: anywhere;
    }

    .mobile-account-menu__language,
    .mobile-account-menu__language select {
        width: 100%;
    }

    .mobile-account-menu__link,
    .mobile-account-menu__button {
        display: flex;
        min-height: 44px;
        width: 100%;
        align-items: center;
        justify-content: center;
        border: 1px solid rgba(15, 23, 42, 0.08);
        border-radius: 12px;
        background: #f8fafc;
        color: #334155;
        font: inherit;
        font-weight: 700;
        cursor: pointer;
    }

    .mobile-nav-menu {
        position: relative;
        flex: 0 0 auto;
    }

    .mobile-nav-menu__summary {
        display: flex;
        width: 2.75rem;
        height: 2.75rem;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 0.25rem;
        border: 1px solid rgba(15, 23, 42, 0.08);
        border-radius: 999px;
        background: #ffffff;
        cursor: pointer;
        list-style: none;
    }

    .mobile-nav-menu__summary::-webkit-details-marker {
        display: none;
    }

    .mobile-nav-menu__bar {
        display: block;
        width: 1.1rem;
        height: 2px;
        border-radius: 999px;
        background: #0f172a;
    }

    .mobile-nav-menu__panel {
        position: fixed;
        top: calc(3.75rem + 0.5rem);
        right: max(0.75rem, env(safe-area-inset-right));
        left: max(0.75rem, env(safe-area-inset-left));
        z-index: 45;
        display: none;
        width: auto;
        max-height: calc(100svh - 4.75rem);
        overflow-y: auto;
        gap: 0.35rem;
        padding: 0.85rem;
        border: 1px solid rgba(15, 23, 42, 0.08);
        border-radius: 16px;
        background: #ffffff;
        box-sizing: border-box;
        box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
    }

    .mobile-nav-menu[open] > .mobile-nav-menu__panel {
        display: grid;
    }

    .mobile-nav-menu__panel a,
    .mobile-nav-menu__button {
        display: flex;
        min-height: 44px;
        width: 100%;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        padding: 0.65rem 0.75rem;
        border: 1px solid rgba(15, 23, 42, 0.08);
        border-radius: 12px;
        background: #f8fafc;
        color: #334155;
        font: inherit;
        font-weight: 700;
        text-align: left;
    }

    .mobile-nav-menu__panel a.active {
        border-color: rgba(13, 148, 136, 0.28);
        background: rgba(13, 148, 136, 0.09);
        color: #0f766e;
    }

    .mobile-bottom-nav {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 34;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 0.15rem;
        padding: 0.35rem max(0.35rem, env(safe-area-inset-left)) calc(0.35rem + env(safe-area-inset-bottom)) max(0.35rem, env(safe-area-inset-right));
        border-top: 1px solid rgba(15, 23, 42, 0.08);
        background: rgba(255, 255, 255, 0.95);
        box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
        backdrop-filter: blur(18px);
    }

    .mobile-bottom-nav__link {
        display: flex;
        min-width: 0;
        min-height: 54px;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 0.2rem;
        border-radius: 12px;
        color: #64748b;
        font-size: 0.68rem;
        font-weight: 700;
        line-height: 1.15;
        text-align: center;
    }

    .mobile-bottom-nav__link span {
        display: block;
        width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-bottom-nav__link.active {
        background: rgba(99, 102, 241, 0.1);
        color: #4f46e5;
    }

    .student-mode .pwa-install-banner {
        bottom: calc(5.35rem + env(safe-area-inset-bottom));
        z-index: 36;
    }

    .teacher-mode .teacher-shell {
        display: block;
        min-height: 100svh;
        height: auto;
        overflow: visible;
        padding-top: 3.75rem;
    }

    .teacher-mode .teacher-sidebar {
        display: none;
    }

    .teacher-mode .teacher-main {
        display: block;
        min-height: auto;
        overflow: visible;
    }

    .teacher-mode .teacher-main::before {
        height: 12rem;
    }

    .teacher-mode .teacher-page-main {
        display: block;
        overflow: visible;
        padding: 1rem !important;
    }

    .teacher-mode .teacher-container {
        width: min(100%, 56rem);
        max-width: none !important;
        padding: 0;
    }

    .chat-mode {
        --mobile-chat-app-bar-height: 3.75rem;
        --mobile-chat-student-nav-height: calc(54px + 0.7rem + env(safe-area-inset-bottom));
    }

    .student-mode.chat-mode .student-shell,
    .teacher-mode.chat-mode .teacher-shell {
        height: 100svh;
        min-height: 100svh;
        overflow: hidden;
    }

    .student-mode.chat-mode .student-shell {
        padding-top: var(--mobile-chat-app-bar-height);
        padding-bottom: var(--mobile-chat-student-nav-height);
    }

    .teacher-mode.chat-mode .teacher-shell {
        padding-top: var(--mobile-chat-app-bar-height);
    }

    .student-mode.chat-mode .student-main,
    .teacher-mode.chat-mode .teacher-main {
        display: flex;
        min-height: 0;
        flex-direction: column;
        overflow: hidden;
    }

    .student-mode.chat-mode .student-main {
        height: calc(100svh - var(--mobile-chat-app-bar-height) - var(--mobile-chat-student-nav-height));
    }

    .teacher-mode.chat-mode .teacher-main {
        height: calc(100svh - var(--mobile-chat-app-bar-height));
    }

    .student-mode.chat-mode .student-page-main,
    .teacher-mode.chat-mode .teacher-page-main {
        display: flex;
        min-height: 0;
        flex: 1 1 auto;
        flex-direction: column;
        overflow: hidden;
        padding: 0.75rem !important;
    }

    .student-mode.chat-mode .student-container,
    .teacher-mode.chat-mode .teacher-container {
        display: flex;
        min-height: 0;
        height: 100%;
        flex: 1 1 auto;
        flex-direction: column;
    }

    .teacher-mode.chat-mode .mobile-app-bar--teacher-chat .teacher-brand {
        background: linear-gradient(135deg, #0d9488, #0369a1);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
    }

    .app-page-header {
        margin-bottom: 1.25rem;
    }

    .student-mode.chat-mode .app-page-header,
    .teacher-mode.chat-mode .app-page-header {
        display: none;
    }

    .app-page-title {
        font-size: 1.85rem;
    }

    .student-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.8rem;
        margin-bottom: 1.25rem;
    }

    .student-stat-card {
        min-height: 6.5rem;
        padding: 1rem;
    }

    .student-stat-card__value {
        font-size: 1.8rem;
    }

    .student-profile-card {
        padding: 1.25rem;
    }

    .student-mode .page-card,
    .teacher-mode.chat-mode .page-card {
        border-radius: 18px;
    }

    .student-mode .dashboard-activity-panel {
        margin-top: 1rem;
        padding: 1rem;
        border-radius: 18px;
    }

    .student-mode .dashboard-activity-panel::before {
        border-radius: 18px 18px 0 0;
    }

    .student-mode .dashboard-activity-panel .modern-chart-header {
        margin-bottom: 0.75rem;
        align-items: flex-start;
    }

    .student-mode .dashboard-activity-panel .modern-chart-header h2 {
        font-size: 1.25rem;
    }

    .student-mode .dashboard-activity-line__svg {
        height: 8.75rem;
    }

    .student-mode .dashboard-activity-line__labels {
        gap: 0.25rem;
    }

    .student-mode .dashboard-activity-line__label {
        font-size: 0.68rem;
    }

    .student-mode .dashboard-activity-line__label strong {
        min-width: 1.6rem;
        min-height: 1.3rem;
        font-size: 0.76rem;
    }

    .student-mode .modern-chart-panel--cards-stats {
        margin-top: 1rem;
        padding: 1rem;
        border-radius: 18px;
    }

    .student-mode .modern-chart-panel--cards-stats::before {
        border-radius: 18px 18px 0 0;
    }

    .student-mode .modern-chart-panel--cards-stats .modern-chart-header {
        margin-bottom: 1rem;
        align-items: flex-start;
    }

    .student-mode .modern-chart-panel--cards-stats .modern-chart-header h2 {
        font-size: 1.25rem;
    }

    .student-mode .cards-activity-chart {
        gap: 0.6rem;
    }

    .student-mode .cards-activity-chart__row {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 0.55rem 0.75rem;
        padding: 0.75rem;
    }

    .student-mode .cards-activity-chart__date {
        order: 1;
    }

    .student-mode .cards-activity-chart__total {
        order: 2;
        justify-self: end;
    }

    .student-mode .cards-activity-chart__track {
        grid-column: 1 / -1;
        order: 3;
    }

    .student-mode .cards-activity-chart__meta {
        grid-column: 1 / -1;
        order: 4;
    }

    .student-mode .section-header,
    .student-mode .chat-stage__header,
    .teacher-mode.chat-mode .chat-stage__header {
        flex-direction: column;
        align-items: stretch;
    }

    .student-mode .form-actions,
    .teacher-mode.chat-mode .form-actions {
        align-items: stretch;
    }

    .student-mode .form-actions .button,
    .teacher-mode.chat-mode .form-actions .button {
        min-height: 44px;
        justify-content: center;
        text-align: center;
    }

    .student-mode .srs-cards-page {
        padding: 1rem;
    }

    .student-mode .srs-cards-page > .student-content-stack {
        gap: 0.85rem;
        margin-top: 0.75rem;
        padding: 0.85rem;
    }

    .student-mode .srs-review-header {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 0.6rem;
        margin-bottom: 0;
    }

    .student-mode .srs-review-header .eyebrow {
        display: none;
    }

    .student-mode .srs-review-header h1 {
        margin: 0;
        font-size: 1.45rem;
        line-height: 1.1;
    }

    .student-mode .srs-card-nav-actions {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: flex-end;
        gap: 0.35rem;
    }

    .student-mode .srs-card-nav-actions .button {
        display: inline-flex;
        width: auto;
        min-height: 44px;
        align-items: center;
        justify-content: center;
        padding: 0.45rem 0.7rem;
        border-radius: 999px;
        font-size: 0.78rem;
        line-height: 1;
        text-align: center;
        white-space: nowrap;
    }

    .student-mode .srs-card-nav-actions__desktop-label {
        display: none;
    }

    .student-mode .srs-card-nav-actions__mobile-label {
        display: inline;
    }

    .student-mode .srs-card-nav-actions [data-srs-dashboard-link] {
        display: none;
    }

    .student-mode .surface-grid.compact-grid,
    .student-mode .lesson-detail-progress-grid {
        grid-template-columns: 1fr;
    }

    .student-mode .lesson-preview-shell {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow-x: clip;
        padding: 1rem;
    }

    .student-mode [data-beta-lesson-editor-shell],
    .student-mode .beta-lesson-editor-mount {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow-x: clip;
    }

    .student-mode [data-beta-lesson-editor-shell] {
        padding: 0.75rem;
    }

    .student-mode .lesson-preview-shell .surface-card,
    .student-mode .lesson-progress-card,
    .student-mode .lesson-detail-header,
    .student-mode .lesson-detail-actions {
        max-width: 100%;
        min-width: 0;
    }

    .student-mode .lesson-preview-shell h1,
    .student-mode .lesson-preview-shell h2,
    .student-mode .lesson-preview-shell h3,
    .student-mode .lesson-preview-shell p,
    .student-mode .lesson-preview-shell li,
    .student-mode .lesson-preview-shell code,
    .student-mode .lesson-preview-shell pre {
        overflow-wrap: anywhere;
    }

    .student-mode .lesson-preview-shell img,
    .student-mode .lesson-preview-shell video,
    .student-mode .lesson-preview-shell iframe,
    .student-mode .lesson-preview-shell audio {
        max-width: 100%;
    }

    .student-mode .lesson-block-comments [data-block-comments-panel] {
        position: fixed;
        top: 4.25rem;
        right: 0.75rem;
        left: 0.75rem;
        width: auto;
        max-width: none;
    }

    .chat-mode .chat-stage {
        display: grid;
        min-height: 0;
        height: 100%;
        flex: 1 1 auto;
        grid-template-rows: auto minmax(0, 1fr);
        gap: 0;
        overflow: hidden;
        padding: 0;
        border-radius: 16px;
    }

    .teacher-mode.chat-mode .teacher-chat-inbox {
        display: grid;
        position: relative;
        min-height: 0;
        height: 100%;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr);
        gap: 0;
    }

    .teacher-mode.chat-mode .teacher-chat-inbox__drawer-toggle {
        position: absolute;
        top: 0.65rem;
        right: 0.75rem;
        z-index: 2;
        display: inline-flex;
        width: fit-content;
        min-height: 44px;
        align-items: center;
        justify-content: center;
        justify-self: start;
        padding: 0.55rem 0.85rem;
        border-radius: 999px;
    }

    .teacher-mode.chat-mode .teacher-chat-inbox__drawer-backdrop {
        position: fixed;
        inset: var(--mobile-chat-app-bar-height) 0 0;
        z-index: 55;
        display: block;
        background: rgba(15, 23, 42, 0.36);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.18s ease;
    }

    .teacher-mode.chat-mode .teacher-chat-inbox[data-teacher-chat-contacts-open="true"] .teacher-chat-inbox__drawer-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .teacher-mode.chat-mode .teacher-chat-inbox__contacts {
        position: fixed;
        top: var(--mobile-chat-app-bar-height);
        bottom: 0;
        left: 0;
        z-index: 60;
        width: min(86vw, 22rem);
        height: auto;
        max-height: none;
        grid-template-rows: auto minmax(0, 1fr);
        border-radius: 0 16px 16px 0;
        transform: translateX(-105%);
        visibility: hidden;
        pointer-events: none;
        transition:
            transform 0.18s ease,
            visibility 0s linear 0.18s;
    }

    .teacher-mode.chat-mode .teacher-chat-inbox[data-teacher-chat-contacts-open="true"] .teacher-chat-inbox__contacts {
        transform: translateX(0);
        visibility: visible;
        pointer-events: auto;
        transition-delay: 0s;
    }

    .teacher-mode.chat-mode .teacher-chat-inbox__contacts-header {
        padding: 0.85rem 0.9rem 0.65rem;
        gap: 0.75rem;
    }

    .teacher-mode.chat-mode .teacher-chat-inbox__drawer-close {
        display: inline-flex;
        min-height: 40px;
        align-items: center;
        justify-content: center;
        padding: 0.4rem 0.65rem;
        border: 1px solid var(--border);
        border-radius: 999px;
        background: #fff;
        color: var(--text);
        font: inherit;
        font-size: 0.78rem;
        font-weight: 700;
    }

    .teacher-mode.chat-mode .teacher-chat-inbox__contact-list {
        display: grid;
        align-content: start;
        gap: 0.35rem;
        min-height: 0;
        padding: 0.55rem;
        overflow-x: hidden;
        overflow-y: auto;
        scrollbar-color: var(--border) transparent;
    }

    .teacher-mode.chat-mode .teacher-chat-contact {
        min-width: 0;
    }

    .teacher-mode.chat-mode .teacher-chat-inbox__conversation {
        min-height: 0;
    }

    .teacher-mode.chat-mode .chat-stage__header {
        padding-right: 7rem;
    }

    .student-mode.chat-mode .chat-stage {
        grid-template-rows: minmax(0, 1fr);
    }

    .student-mode.chat-mode .chat-stage__header {
        display: none;
    }

    .teacher-mode.chat-mode .chat-stage__context,
    .teacher-mode.chat-mode .chat-stage__identity {
        display: none;
    }

    .teacher-mode.chat-mode .chat-stage__back-link {
        min-height: 44px;
        align-items: center;
    }

    .chat-mode .chat-stage__frame {
        display: grid;
        min-height: 0;
        grid-template-rows: minmax(0, 1fr) auto;
    }

    .chat-mode .chat-stage__scroll-region {
        min-height: 0;
        max-height: none;
        padding: 0.8rem;
    }

    .chat-mode .chat-stage__bubble {
        max-width: 88%;
    }

    .chat-mode .chat-stage__message--self {
        justify-content: flex-end;
    }

    .chat-mode .chat-stage__message--peer {
        justify-content: flex-start;
    }

    .chat-mode .chat-stage__message--self .chat-stage__bubble {
        border-radius: 18px 18px 6px 18px;
    }

    .chat-mode .chat-stage__composer {
        padding: 0.75rem;
    }

    .chat-mode .chat-stage__composer textarea {
        resize: none;
    }
}

@media (max-width: 900px) {
    .admin-shell {
        display: block;
    }

    .admin-sidebar {
        display: none;
    }

    .admin-main {
        padding: 5rem 0.85rem 1rem;
    }

    .mobile-app-bar--admin {
        display: flex;
    }

    .admin-page-header,
    .admin-grid-2,
    .impersonation-banner {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
    }

    .admin-filter-bar {
        grid-template-columns: 1fr;
    }

    .admin-mode .data-table--admin-responsive {
        min-width: 0;
    }

    .admin-mode .data-table--admin-responsive thead {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .admin-mode .data-table--admin-responsive,
    .admin-mode .data-table--admin-responsive tbody,
    .admin-mode .data-table--admin-responsive tr,
    .admin-mode .data-table--admin-responsive td {
        display: block;
        width: 100%;
    }

    .admin-mode .data-table--admin-responsive tr {
        margin-bottom: 0.85rem;
        overflow: hidden;
        border: 1px solid rgba(15, 23, 42, 0.08);
        border-radius: 8px;
        background: #ffffff;
    }

    .admin-mode .data-table--admin-responsive td {
        display: grid;
        grid-template-columns: minmax(7rem, 36%) minmax(0, 1fr);
        gap: 0.75rem;
        padding: 0.75rem 0.85rem;
        border-bottom: 1px solid rgba(15, 23, 42, 0.06);
        overflow-wrap: anywhere;
    }

    .admin-mode .data-table--admin-responsive td:last-child {
        border-bottom: 0;
    }

    .admin-mode .data-table--admin-responsive td::before {
        content: attr(data-label);
        color: #64748b;
        font-size: 0.74rem;
        font-weight: 800;
        text-transform: uppercase;
    }

    .admin-mode .data-table--admin-responsive td[data-label=""]::before {
        content: "";
    }

    .admin-mode .data-table--admin-responsive td .button,
    .admin-mode .data-table--admin-responsive td form,
    .impersonation-banner form,
    .impersonation-banner input {
        width: 100%;
    }

    .student-mode .data-table--responsive {
        min-width: 0;
    }

    .student-mode .data-table--responsive thead {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .student-mode .data-table--responsive,
    .student-mode .data-table--responsive tbody,
    .student-mode .data-table--responsive tr,
    .student-mode .data-table--responsive td {
        display: block;
        width: 100%;
    }

    .student-mode .data-table--responsive tr {
        margin-bottom: 0.85rem;
        overflow: hidden;
        border: 1px solid rgba(15, 23, 42, 0.08);
        border-radius: 14px;
        background: #ffffff;
        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
    }

    .student-mode .data-table--responsive td {
        display: grid;
        grid-template-columns: minmax(6.5rem, 38%) minmax(0, 1fr);
        gap: 0.75rem;
        align-items: start;
        padding: 0.75rem 0.85rem;
        border-bottom: 1px solid rgba(15, 23, 42, 0.06);
        overflow-wrap: anywhere;
    }

    .student-mode .data-table--responsive td:last-child {
        border-bottom: 0;
    }

    .student-mode .data-table--responsive td::before {
        content: attr(data-label);
        color: #64748b;
        font-size: 0.76rem;
        font-weight: 800;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }

    .student-mode .data-table--responsive td[data-label=""]::before {
        content: "";
    }

    .student-mode .data-table--responsive td .button {
        width: 100%;
        min-height: 44px;
        justify-content: center;
    }

    .teacher-mode .page-card,
    .teacher-mode .surface-card,
    .teacher-mode .table-card {
        max-width: 100%;
        min-width: 0;
        border-radius: 18px;
    }

    .teacher-mode .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .teacher-mode .section-header .button,
    .teacher-mode .form-actions .button {
        min-height: 44px;
        justify-content: center;
        text-align: center;
    }

    .dictionary-upload-picker {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .dictionary-upload-picker__button {
        grid-column: 1 / -1;
        width: 100%;
    }

    .teacher-mobile-primary-action {
        width: 100%;
        min-height: 44px;
        justify-content: center;
        text-align: center;
    }

    .teacher-dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .teacher-mode .teacher-tiles {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.8rem;
    }

    .teacher-mode .data-table--teacher-responsive {
        min-width: 0;
    }

    .teacher-mode .data-table--teacher-responsive thead {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .teacher-mode .data-table--teacher-responsive,
    .teacher-mode .data-table--teacher-responsive tbody,
    .teacher-mode .data-table--teacher-responsive tr,
    .teacher-mode .data-table--teacher-responsive td {
        display: block;
        width: 100%;
    }

    .teacher-mode .data-table--teacher-responsive tr {
        margin-bottom: 0.85rem;
        overflow: hidden;
        border: 1px solid rgba(15, 23, 42, 0.08);
        border-radius: 14px;
        background: #ffffff;
        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
    }

    .teacher-mode .data-table--teacher-responsive td {
        display: grid;
        grid-template-columns: minmax(6.5rem, 38%) minmax(0, 1fr);
        gap: 0.75rem;
        align-items: start;
        padding: 0.75rem 0.85rem;
        border-bottom: 1px solid rgba(15, 23, 42, 0.06);
        overflow-wrap: anywhere;
    }

    .teacher-mode .data-table--teacher-responsive td:last-child {
        border-bottom: 0;
    }

    .teacher-mode .data-table--teacher-responsive td::before {
        content: attr(data-label);
        color: #64748b;
        font-size: 0.76rem;
        font-weight: 800;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }

    .teacher-mode .data-table--teacher-responsive td[data-label=""]::before {
        content: "";
    }

    .teacher-mode .data-table--teacher-responsive td .button {
        width: 100%;
        min-height: 44px;
        justify-content: center;
    }

    .teacher-mode .data-table--teacher-responsive .teacher-row-actions {
        display: inline-flex;
        max-width: 100%;
        flex-wrap: nowrap;
    }

    .teacher-mode .data-table--teacher-responsive .teacher-row-actions .button {
        flex: 0 0 auto;
        width: auto;
    }
}

@media (max-width: 480px) {
    .student-mode .student-page-main,
    .teacher-mode .teacher-page-main {
        padding: 0.75rem !important;
    }

    .mobile-app-bar {
        padding-right: 0.7rem;
        padding-left: 0.7rem;
    }

    .mobile-app-bar .student-role-badge,
    .mobile-app-bar .teacher-role-badge {
        display: none;
    }

    .mobile-bottom-nav__link {
        min-height: 52px;
        font-size: 0.64rem;
    }

    .student-summary-grid {
        grid-template-columns: 1fr;
    }

    .teacher-mode .teacher-tiles {
        grid-template-columns: 1fr;
    }

    .teacher-mode .data-table--teacher-responsive td {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }

    .student-stat-card {
        min-height: 0;
    }

    .student-mode .dashboard-activity-panel {
        padding: 0.85rem;
    }

    .student-mode .dashboard-activity-line__svg {
        height: 8rem;
    }

    .student-mode .dashboard-activity-line__label small {
        font-size: 0.64rem;
    }

    .student-mode .modern-chart-panel--cards-stats {
        padding: 0.85rem;
    }

    .student-mode .cards-activity-chart__row {
        gap: 0.45rem;
        padding: 0.65rem;
    }

    .student-mode .cards-activity-chart__track {
        height: 0.7rem;
    }

    .student-mode .cards-activity-chart__meta {
        flex-direction: column;
        font-size: 0.78rem;
    }

    .student-mode .data-table--responsive td {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }

    .student-mode .form-actions,
    .student-mode .form-actions--grid2,
    .teacher-mode.chat-mode .form-actions {
        grid-template-columns: 1fr;
    }

    .student-mode .form-actions .button,
    .teacher-mode.chat-mode .form-actions .button,
    .chat-mode .chat-stage__submit {
        width: 100%;
    }

    .student-mode .srs-cards-page {
        padding: 0.75rem;
    }

    .student-mode .srs-cards-page > .student-content-stack {
        padding: 0.7rem;
    }

    .student-mode .srs-card-nav-actions .button {
        width: auto;
    }

    .srs-card--focused {
        width: 100%;
        max-width: none;
        padding: 1rem;
    }

    .srs-card__source-text {
        font-size: 1.55rem;
        overflow-wrap: anywhere;
    }

    .srs-card__target-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 0.85rem;
    }

    .srs-card__target-text {
        text-align: center;
    }

    .srs-card__audio-player {
        margin-left: 0;
    }

    .srs-audio-btn {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
    }

    .form-actions--grid2 {
        grid-template-columns: 1fr;
    }

    .chat-mode .chat-stage__bubble {
        max-width: 94%;
    }

    .chat-mode .chat-stage__scroll-region {
        min-height: 0;
        max-height: none;
    }

    .chat-mode .chat-stage__composer {
        padding: 0.75rem;
    }

    .chat-mode .chat-stage__composer textarea {
        min-height: 3.25rem;
    }

    .chat-mode .chat-stage__composer-hint {
        display: none;
    }

    .chat-mode .chat-stage__composer-actions {
        flex-direction: column;
        align-items: stretch;
    }
}
