:root {
    --bs-body-bg: #ffffff;
    --bs-body-color: #000000;
    --bs-secondary-color: #212529;
    --bs-border-color: #ced4da;
    --bg: var(--bs-body-bg);
    --panel: var(--bs-body-bg);
    --panel-soft: #f8f9fa;
    --ink: var(--bs-body-color);
    --muted: var(--bs-secondary-color);
    --line: var(--bs-border-color);
    --teal: #097c72;
    --teal-dark: #075d56;
    --red: #c43e32;
    --yellow: #efbe35;
    --green-soft: #dcece7;
    --shadow: 0 18px 50px rgba(39, 48, 31, 0.12);
    color-scheme: light;
}

body.page-gray {
    --bs-body-bg: #d9d9d9;
    background-color: #090813;
    --bs-body-color: #180a35;
    --bs-secondary-color: #212529;
    --bs-border-color: #9f9f9f;
    --bg: var(--bs-body-bg);
    --panel: #eeeeee;
    --panel-soft: #dddddd;
    --ink: var(--bs-body-color);
    --muted: var(--bs-secondary-color);
    --line: var(--bs-border-color);
    --green-soft: #d7dddd;
    --shadow: 0 18px 50px rgba(20, 20, 20, 0.12);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

a {
    color: inherit;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

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

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding: 24px;
    background: #20281f;
    color: #f6f7f2;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 2px solid var(--yellow);
    border-radius: 8px;
    background: #293226;
    color: var(--yellow);
    font-weight: 800;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 18px;
}

.brand small {
    color: #c9d2c3;
    font-size: 13px;
}

.side-nav {
    display: grid;
    gap: 8px;
}

.side-nav a,
.side-nav button.nav-link {
    padding: 10px 12px;
    border-radius: 8px;
    color: #e9eee5;
    text-decoration: none;
}

.side-nav a:hover,
.side-nav a:focus-visible,
.side-nav button.nav-link:hover,
.side-nav button.nav-link:focus-visible {
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

.progress-panel {
    margin-top: auto;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.07);
}

.progress-panel p {
    margin: 0 0 8px;
    color: #cbd5c4;
    font-size: 13px;
}

.progress-panel strong {
    display: block;
    margin-bottom: 12px;
    font-size: 24px;
}

.progress-track {
    width: 100%;
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
}

.progress-track span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--yellow);
    transition: width 180ms ease;
}

.progress-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 12px;
}

.progress-actions .ghost-button.compact {
    min-width: 0;
    margin-top: 0;
    padding: 8px 10px;
    line-height: 1.2;
    white-space: normal;
}

.progress-panel .progress-sync-message {
    min-height: 18px;
    margin: 10px 0 0;
    color: #fff0b8;
    font-weight: 800;
}

.theme-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.07);
}

.theme-panel p {
    flex: 1 0 100%;
    margin: 0;
    color: #cbd5c4;
    font-size: 12px;
    font-weight: 800;
}

.theme-panel label {
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 28px;
    padding: 4px 7px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.theme-panel label.is-selected {
    border-color: var(--yellow);
    background: rgba(239, 190, 53, 0.16);
    color: #fff2bc;
}

.theme-panel input {
    width: 13px;
    height: 13px;
    accent-color: var(--yellow);
}

.main {
    min-width: 0;
    padding: 28px;
}

.page-auth-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.top-band {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    gap: 24px;
    align-items: stretch;
    margin-bottom: 24px;
}

.intro-copy,
.visual-panel,
.workspace-header,
.module-column,
.detail-panel,
.pdf-section,
.share-section,
.creation-section,
.creation-tool,
.creation-defaults {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.intro-copy {
    padding: 28px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--teal-dark);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    letter-spacing: 0;
}

h1 {
    max-width: 720px;
    margin: 0;
    font-size: 40px;
    line-height: 1.05;
}

h2 {
    margin: 0;
    font-size: 22px;
}

h3 {
    margin: 0;
    font-size: 17px;
}

.intro-copy > p:not(.eyebrow) {
    max-width: 760px;
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 18px;
}

.quick-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.quick-stats span {
    min-width: 118px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
    color: var(--muted);
}

.quick-stats strong {
    display: block;
    color: var(--ink);
    font-size: 24px;
    line-height: 1;
}

.top-actions,
.detail-actions,
.pdf-heading {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.top-actions {
    margin-top: 24px;
}

.primary-button,
.ghost-button,
.premium-button,
.danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 14px;
    border-radius: 8px;
    font-weight: 800;
    text-decoration: none;
}

.primary-button {
    border: 1px solid var(--teal);
    background: var(--teal);
    color: #ffffff;
}

.primary-button:hover,
.primary-button:focus-visible {
    background: var(--teal-dark);
    outline: none;
}

.ghost-button {
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink);
}

.ghost-button:hover,
.ghost-button:focus-visible {
    border-color: var(--teal);
    outline: none;
}

.ghost-button[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 0.62;
}

.premium-button {
    border: 1px solid #9c6d12;
    background: #fff3c8;
    color: #5d4310;
}

.premium-button:hover,
.premium-button:focus-visible {
    border-color: #6f4d0c;
    background: #f8df8b;
    outline: none;
}

.danger-button {
    border: 1px solid #b73026;
    border-radius: 8px;
    background: #fff1ef;
    color: #8f241d;
    font-weight: 800;
}

.danger-button:hover,
.danger-button:focus-visible {
    border-color: #8f241d;
    background: #ffd8d3;
    outline: none;
}

.danger-button:disabled {
    cursor: not-allowed;
    opacity: 0.62;
}

.ghost-button.compact {
    width: 100%;
    min-height: 36px;
    margin-top: 14px;
    border-color: rgba(255, 255, 255, 0.25);
    background: transparent;
    color: #ffffff;
}

.ghost-button.compact-light {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 13px;
}

.primary-button.compact-light {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 13px;
}

.primary-button:disabled {
    cursor: not-allowed;
    opacity: 0.62;
}

.forgot-password-button {
    justify-self: start;
    margin-top: 2px;
}

.password-reset-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.password-reset-panel {
    width: min(560px, 100%);
}

.password-reset-form {
    padding: 16px;
}

.visual-panel {
    min-height: 310px;
    overflow: hidden;
    background: var(--panel-soft);
}

.visual-panel img {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 310px;
    object-fit: cover;
}

.workspace-header {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) auto;
    gap: 16px;
    align-items: end;
    margin-bottom: 16px;
    padding: 18px;
}

.search-box {
    display: grid;
    gap: 8px;
}

.search-box label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.search-box input,
.search-box select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--ink);
}

.search-box input:focus,
.search-box select:focus {
    border-color: var(--teal);
    outline: 3px solid rgba(9, 124, 114, 0.18);
}

.search-box span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.segment {
    min-height: 36px;
    padding: 8px 11px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font-weight: 800;
}

.segment.is-active {
    background: var(--teal);
    color: #ffffff;
}

.theme-strip {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.theme-pill {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--muted);
    font-size: 14px;
    font-weight: 800;
}

.theme-pill.is-active {
    border-color: var(--teal);
    background: var(--green-soft);
    color: var(--teal-dark);
}

.workspace-grid {
    display: grid;
    grid-template-columns: minmax(320px, 0.78fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.module-column,
.detail-panel,
.pdf-section,
.share-section {
    min-width: 0;
}

.module-column {
    overflow: hidden;
}

.list-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--line);
}

.list-header span {
    min-width: 44px;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--green-soft);
    color: var(--teal-dark);
    text-align: center;
    font-weight: 800;
}

.module-list {
    display: grid;
    max-height: 760px;
    overflow: auto;
}

.module-card {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 30px;
    gap: 12px;
    width: 100%;
    min-height: 92px;
    padding: 14px 16px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink);
    text-align: left;
}

.module-card:hover,
.module-card:focus-visible,
.module-card.is-selected {
    background: #f3f8f4;
    outline: none;
}

.module-card.is-selected {
    box-shadow: inset 4px 0 0 var(--teal);
}

.module-number {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: #20281f;
    color: #ffffff;
    font-weight: 800;
}

.module-title {
    display: block;
    margin-bottom: 8px;
    font-weight: 800;
    line-height: 1.25;
}

.module-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
}

.done-dot {
    align-self: start;
    width: 26px;
    height: 26px;
    border: 2px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
}

.module-card.is-done .done-dot {
    border-color: var(--teal);
    background: var(--teal);
}

.module-card.is-done .done-dot::after {
    content: "";
    display: block;
    width: 8px;
    height: 12px;
    margin: 3px 0 0 7px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.detail-panel {
    position: sticky;
    top: 20px;
    padding: 20px;
}

.detail-kicker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.badge,
.page-badge {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
}

.badge {
    background: #20281f;
    color: #ffffff;
}

.page-badge {
    background: #fff3c8;
    color: #5d4310;
}

.detail-panel h2 {
    max-width: 760px;
    margin-bottom: 12px;
    line-height: 1.2;
}

.detail-panel p {
    color: var(--muted);
}

.detail-sections {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.detail-section {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.detail-section ul {
    display: grid;
    gap: 8px;
    margin: 10px 0 0;
    padding-left: 18px;
    color: var(--muted);
}

.detail-media {
    display: grid;
    gap: 10px;
    margin: 14px 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.detail-media img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

.empty-state {
    padding: 28px 18px;
    color: var(--muted);
}

.pdf-section {
    margin-top: 16px;
    overflow: hidden;
}

.pdf-heading {
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--line);
}

.pdf-heading .eyebrow {
    margin-bottom: 4px;
}

.pdf-section iframe {
    display: block;
    width: 100%;
    height: 720px;
    border: 0;
    background: #e6e6e6;
}

.pdf-canvas-viewer {
    display: none;
    gap: 12px;
    padding: 12px;
    background: #e6e6e6;
}

.pdf-canvas-page {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    border: 1px solid var(--line);
    background: #ffffff;
    box-shadow: 0 6px 18px rgba(18, 32, 29, 0.12);
}

.pdf-canvas-message {
    margin: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--muted);
    font-weight: 800;
}

.premium-section {
    margin-top: 16px;
    overflow: hidden;
    border: 1px solid #e3c46d;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: var(--shadow);
}

.premium-heading {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #ead891;
    background: #fffaf0;
}

.premium-tag {
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    background: #20281f;
    color: #ffffff;
    font-size: 13px;
    font-weight: 800;
}

.premium-lock {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
    gap: 18px;
    align-items: center;
    padding: 18px;
    background:
        linear-gradient(135deg, rgba(255, 243, 200, 0.82), rgba(255, 255, 255, 0.96)),
        repeating-linear-gradient(45deg, rgba(156, 109, 18, 0.1), rgba(156, 109, 18, 0.1) 8px, transparent 8px, transparent 18px);
}

.premium-lock h3 {
    margin-bottom: 8px;
}

.premium-lock p {
    max-width: 620px;
    margin: 0;
    color: var(--muted);
}

.premium-actions {
    display: grid;
    gap: 8px;
}

.auth-form {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.auth-form label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.auth-form input,
.auth-form select,
.share-form input,
.share-form select,
.share-form textarea {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--ink);
}

.auth-form input:focus,
.auth-form select:focus,
.share-form input:focus,
.share-form select:focus,
.share-form textarea:focus {
    border-color: #9c6d12;
    outline: 3px solid rgba(239, 190, 53, 0.24);
}

.share-form textarea {
    min-height: 128px;
    resize: vertical;
}

.register-fields {
    display: grid;
    gap: 10px;
}

.share-section {
    margin-top: 16px;
    overflow: hidden;
}

.student-space {
    border: 1px solid #b9cde2;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: var(--shadow);
}

.student-space .share-heading {
    border-bottom: 1px solid #d6e3f0;
    background: #f5f9fd;
}

.student-space-lock {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    padding: 18px 16px;
    border-bottom: 1px solid #d6e3f0;
    background: linear-gradient(135deg, rgba(237, 245, 252, 0.92), rgba(255, 255, 255, 0.98));
}

.student-space-lock h3 {
    margin: 0 0 8px;
}

.student-space-lock p {
    max-width: 660px;
    margin: 0;
    color: var(--muted);
}

.student-space-content {
    padding: 16px;
}

.student-space-account {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
}

.student-space-account span {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--muted);
    font-weight: 800;
}

.student-group-panel {
    display: grid;
    gap: 14px;
}

.student-group-card {
    display: grid;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.student-group-card-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

.student-group-card-header h3 {
    margin: 0;
}

.student-group-meta {
    margin: 0;
    color: var(--muted);
}

.student-group-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.student-group-meta-grid span,
.student-group-list li span,
.student-group-invite span {
    color: var(--muted);
    font-size: 13px;
}

.student-group-section {
    display: grid;
    gap: 10px;
}

.student-group-section h4,
.student-group-subtitle h3 {
    margin: 0;
    font-size: 15px;
}

.student-group-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.student-group-list li,
.student-group-invite {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.student-group-invite p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.student-group-invite-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    align-items: center;
}

.student-group-invites {
    display: grid;
    gap: 10px;
}

.student-group-subtitle {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

.student-group-subtitle span {
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: #20281f;
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
}

.student-group-chat {
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.student-group-message-list {
    display: grid;
    gap: 8px;
}

.student-group-message {
    display: grid;
    gap: 6px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.student-group-message.is-own {
    border-color: rgba(33, 119, 93, 0.35);
    background: var(--green-soft);
}

.student-group-message-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
}

.student-group-message-meta span {
    color: var(--muted);
    font-size: 12px;
}

.student-group-message p {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.student-group-message-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: start;
}

.student-group-message-form textarea {
    min-height: 76px;
    resize: vertical;
}

.student-group-message-form .share-message {
    grid-column: 1 / -1;
}

.group-discussion-layout {
    display: grid;
    grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
    gap: 16px;
    padding: 16px;
}

.group-discussion-groups,
.group-discussion-chat-panel {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.group-discussion-groups {
    display: grid;
    gap: 12px;
    align-content: start;
    padding: 14px;
}

.group-discussion-panel-heading,
.group-discussion-chat-heading {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

.group-discussion-panel-heading h2,
.group-discussion-chat-heading h2 {
    margin: 0;
    font-size: 20px;
}

.group-discussion-group-list {
    display: grid;
    gap: 8px;
}

.group-discussion-group {
    display: grid;
    gap: 4px;
    width: 100%;
    min-height: 76px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}

.group-discussion-group:hover,
.group-discussion-group:focus-visible,
.group-discussion-group.is-active {
    border-color: var(--teal);
    outline: none;
}

.group-discussion-group.is-active {
    background: var(--green-soft);
}

.group-discussion-group span,
.group-discussion-group small {
    color: var(--muted);
}

.group-discussion-chat-panel {
    display: grid;
    grid-template-rows: auto minmax(280px, 56vh) auto;
    gap: 12px;
    padding: 14px;
}

.group-discussion-messages {
    align-content: start;
    min-height: 280px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 4px;
}

.group-discussion-form {
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.group-discussion-status {
    padding: 0 16px 16px;
}

.share-heading,
.shared-files-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.share-heading {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--line);
}

.share-heading .eyebrow {
    margin-bottom: 4px;
}

.share-heading-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.share-grid {
    display: grid;
    grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
    gap: 16px;
    padding: 16px;
}

.share-form {
    display: grid;
    gap: 10px;
    align-content: start;
}

.share-form label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.share-form input[type="file"] {
    padding: 8px;
}

.share-account-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.share-account-row span {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--muted);
    font-weight: 800;
}

.share-message {
    min-height: 22px;
    margin: 0;
    color: #7a2d24;
    font-weight: 800;
}

.shared-files {
    min-width: 0;
}

.shared-files-header {
    margin-bottom: 10px;
}

.share-filter-row {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(180px, 260px);
    gap: 10px;
    margin-bottom: 12px;
}

.shared-files-header span {
    min-width: 38px;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--green-soft);
    color: var(--teal-dark);
    text-align: center;
    font-weight: 800;
}

.shared-files-list {
    display: grid;
    gap: 10px;
}

.shared-file-card {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.shared-file-card h3,
.shared-file-card h4 {
    margin: 0;
    font-size: 17px;
    line-height: 1.2;
}

.shared-file-card p {
    margin: 0;
    color: var(--muted);
}

.shared-file-meta,
.shared-file-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.shared-file-actions .danger-button.compact-light {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 13px;
}

.shared-file-actions .ghost-button.compact-light,
.shared-file-actions .danger-button.compact-light,
.shared-comment-form .ghost-button.compact-light {
    width: auto;
}

.like-button {
    gap: 6px;
}

.like-heart {
    color: #c43e32;
    font-size: 16px;
    line-height: 1;
}

.like-button.is-liked {
    border-color: #c43e32;
    background: #fff1ef;
    color: #8f241d;
}

.shared-file-meta span {
    display: inline-flex;
    min-height: 26px;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--green-soft);
    color: var(--teal-dark);
    font-size: 13px;
    font-weight: 800;
}

.shared-preview {
    display: block;
    width: 100%;
    max-height: 240px;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.shared-comments {
    display: grid;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

.shared-comment-list {
    display: grid;
    gap: 6px;
}

.shared-comment-list.is-scrollable {
    max-height: 210px;
    overflow-y: auto;
    padding-right: 6px;
    overscroll-behavior: contain;
}

.shared-comment {
    display: grid;
    gap: 2px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.shared-comment-header {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
}

.shared-comment strong {
    color: var(--ink);
    font-size: 13px;
}

.comment-delete-button {
    min-height: 26px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
}

.shared-comment p,
.shared-comment-empty {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.shared-comment-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.shared-comment-form input {
    width: 100%;
    min-height: 34px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--ink);
}

.creation-section {
    overflow: hidden;
}

.creation-heading,
.creation-subscription {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--line);
}

.creation-heading h1 {
    font-size: 34px;
}

.creation-account-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.creation-account-row span {
    color: var(--muted);
    font-weight: 800;
}

.creation-subscription {
    background: var(--panel-soft);
}

.creation-subscription h2,
.creation-subscription p {
    margin: 0;
}

.creation-subscription p {
    color: var(--muted);
}

.creation-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    padding: 16px;
}

.creation-tool {
    min-width: 0;
    padding: 16px;
    box-shadow: none;
}

.creation-defaults {
    margin: 0 16px 16px;
    padding: 16px;
    box-shadow: none;
}

.creation-fiche-list,
.creation-image-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.creation-fiche-card,
.creation-image-card {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.creation-fiche-card span,
.creation-image-card span {
    color: var(--teal-dark);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.creation-fiche-card h3,
.creation-fiche-card p,
.creation-image-card p {
    margin: 0;
}

.creation-fiche-card p,
.creation-image-card p {
    color: var(--muted);
}

.creation-image-card img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.creation-answer {
    margin-top: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.creation-answer h3 {
    margin-bottom: 8px;
}

.creation-answer pre {
    margin: 0;
    white-space: pre-wrap;
    color: var(--ink);
    font: inherit;
}

.premium-message {
    grid-column: 1 / -1;
    min-height: 24px;
    color: #7a2d24;
    font-weight: 800;
}

.illustration-canvas {
    position: relative;
}

.premium-viewer iframe,
.premium-viewer img {
    display: block;
    width: 100%;
    height: 720px;
    border: 0;
    background: #e6e6e6;
    object-fit: contain;
}

.preview-payment-layer {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    border: 0;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
}

.preview-payment-layer:hover,
.preview-payment-layer:focus-visible {
    outline: 3px solid rgba(156, 109, 18, 0.5);
    outline-offset: -3px;
    background: rgba(255, 250, 240, 0.14);
}

.preview-payment-layer[hidden] {
    display: none;
}

.modal-open {
    overflow: hidden;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(20, 25, 18, 0.62);
}

.modal-dialog {
    position: relative;
    margin: 0;
    width: min(560px, 100%);
    max-height: min(760px, calc(100vh - 36px));
    overflow: auto;
    pointer-events: auto;
    padding: 22px;
    border: 1px solid #ead891;
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--ink);
    font-size: 24px;
    line-height: 1;
}

.modal-close:hover,
.modal-close:focus-visible {
    border-color: var(--teal);
    outline: none;
}

.modal-tabs {
    display: inline-flex;
    gap: 6px;
    margin-top: 16px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.purchase-panel {
    display: grid;
    gap: 14px;
    margin-top: 16px;
}

.account-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.account-row span {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--muted);
    font-weight: 800;
}

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

.plan-card {
    display: grid;
    gap: 8px;
    min-height: 112px;
    padding: 14px;
    border: 1px solid #ead891;
    border-radius: 8px;
    background: #fffaf0;
    color: var(--ink);
    text-align: left;
}

.plan-card:hover,
.plan-card:focus-visible {
    border-color: #9c6d12;
    outline: 3px solid rgba(239, 190, 53, 0.24);
}

.plan-card strong {
    font-size: 28px;
    line-height: 1;
}

.plan-card.is-disabled,
.plan-card:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

body.page-gray .intro-copy,
body.page-gray .visual-panel,
body.page-gray .workspace-header,
body.page-gray .module-column,
body.page-gray .detail-panel,
body.page-gray .pdf-section,
body.page-gray .share-section,
body.page-gray .creation-section,
body.page-gray .premium-section,
body.page-gray .modal-dialog {
    background: var(--panel);
}

body.page-gray .ghost-button,
body.page-gray .auth-form input,
body.page-gray .auth-form select,
body.page-gray .share-form input,
body.page-gray .share-form select,
body.page-gray .share-form textarea,
body.page-gray .search-box input,
body.page-gray .search-box select,
body.page-gray .shared-comment,
body.page-gray .shared-comment-form input,
body.page-gray .module-card,
body.page-gray .detail-section,
body.page-gray .account-row,
body.page-gray .share-account-row,
body.page-gray .shared-file-card,
body.page-gray .creation-tool,
body.page-gray .creation-defaults,
body.page-gray .creation-fiche-card,
body.page-gray .creation-image-card,
body.page-gray .creation-answer,
body.page-gray .modal-close {
    background: #e6e6e6;
}

body.page-gray .filter-row,
body.page-gray .modal-tabs {
    background: #dadada;
}

body.page-gray .theme-pill,
body.page-gray .done-dot,
body.page-gray .shared-preview {
    background: #eeeeee;
}

body.page-gray .premium-heading,
body.page-gray .premium-lock,
body.page-gray .plan-card,
body.page-gray .creation-subscription {
    background: #e7e1cf;
}

@media (max-width: 1120px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }

    .side-nav {
        grid-auto-flow: column;
        grid-auto-columns: max-content;
        overflow-x: auto;
    }

    .progress-panel {
        flex: 1 1 240px;
        margin-top: 0;
    }

    .top-band,
    .workspace-grid {
        grid-template-columns: 1fr;
    }

    .detail-panel {
        position: static;
    }
}

.admin-page {
    background:
        radial-gradient(circle at top left, rgba(38, 93, 76, 0.14), transparent 34%),
        radial-gradient(circle at bottom right, rgba(239, 190, 53, 0.12), transparent 30%),
        var(--bg);
}

.admin-main {
    max-width: 1320px;
}

.admin-hero {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 24px;
}

.admin-notices {
    min-width: 280px;
}

.admin-notice {
    margin: 0 0 8px;
    padding: 10px 12px;
    border-radius: 8px;
    min-height: 40px;
}

.admin-notice.ok {
    background: rgba(38, 93, 76, 0.12);
}

.admin-notice.error {
    background: rgba(180, 62, 45, 0.12);
}

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

.admin-card {
    grid-column: span 4;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 20px;
}

.admin-card-wide {
    grid-column: 1 / -1;
}

.admin-fiche-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.admin-fiche-toolbar select {
    min-width: 280px;
}

.admin-fiche-meta {
    display: grid;
    gap: 4px;
    justify-items: end;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.admin-fiche-form {
    display: grid;
    gap: 14px;
}

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

.admin-fiche-grid label {
    display: grid;
    gap: 8px;
}

.admin-fiche-full {
    grid-column: 1 / -1;
}

.admin-fiche-grid textarea {
    min-height: 112px;
}

.admin-form {
    display: grid;
    gap: 14px;
}

.admin-form label {
    display: grid;
    gap: 8px;
    font-size: 14px;
    color: var(--text-soft);
}

.admin-form input,
.admin-form textarea {
    width: 100%;
}

.admin-image-preview {
    margin: 0 0 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: var(--panel-soft);
    aspect-ratio: 16 / 9;
}

.admin-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.admin-asset-panel {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.admin-asset-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}

.admin-asset-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.admin-asset-top p {
    margin: 4px 0 0;
}

.admin-asset-top strong {
    display: block;
}

.admin-asset-current {
    margin-left: auto;
}

.admin-asset-panel .admin-image-preview {
    flex: 1 1 320px;
    margin-bottom: 0;
}

.admin-asset-delete {
    margin-top: 0;
    align-self: flex-start;
}

.asset-close-button {
    min-width: 92px;
    min-height: 32px;
    border: 1px solid #b43e2d;
    border-radius: 999px;
    background: #b43e2d;
    color: #ffffff;
    font-size: 12px;
    line-height: 1;
    font-weight: 800;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.asset-close-button:hover,
.asset-close-button:focus-visible {
    background: #8f2f22;
    border-color: #8f2f22;
    color: #ffffff;
    outline: none;
}

.admin-table-wrap {
    overflow: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

.admin-table th {
    font-size: 13px;
    color: var(--text-soft);
    white-space: nowrap;
}

.admin-table td form {
    margin: 0;
}

.admin-account-toggle-form {
    display: inline-flex;
}

.admin-account-toggle {
    width: 86px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel-soft);
    position: relative;
    overflow: hidden;
}

.admin-account-toggle-track {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    height: 100%;
    align-items: center;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
}

.admin-account-toggle-label {
    z-index: 1;
    color: var(--muted);
    text-align: center;
}

.admin-account-toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 40px;
    height: 26px;
    border-radius: 999px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.16);
    transition: transform 0.18s ease, background-color 0.18s ease;
}

.admin-account-toggle.is-active {
    background: rgba(38, 93, 76, 0.12);
}

.admin-account-toggle.is-active .admin-account-toggle-thumb {
    transform: translateX(38px);
}

.admin-account-toggle.is-active .admin-account-toggle-label-right {
    color: var(--teal-dark);
}

.admin-account-toggle.is-blocked {
    background: rgba(180, 62, 45, 0.12);
}

.admin-account-toggle.is-blocked .admin-account-toggle-thumb {
    transform: translateX(0);
}

.admin-account-toggle.is-blocked .admin-account-toggle-label-left {
    color: var(--teal-dark);
}

.admin-login-main {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.admin-login-card {
    width: min(560px, 100%);
}

.admin-logout-form {
    margin-top: auto;
}

@media (max-width: 760px) {
    .main {
        padding: 16px;
    }

    .sidebar {
        padding: 16px;
    }

    .top-band {
        gap: 14px;
    }

    .intro-copy {
        padding: 20px;
    }

    h1 {
        font-size: 32px;
    }

    .intro-copy > p:not(.eyebrow) {
        font-size: 16px;
    }

    .workspace-header {
        grid-template-columns: 1fr;
    }

    .filter-row {
        width: 100%;
        overflow-x: auto;
    }

    .segment {
        flex: 1 0 auto;
    }

    .module-column {
        border: 1px solid var(--line);
        border-radius: 8px;
        background: #ffffff;
    }

    .module-list {
        max-height: min(56vh, 520px);
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .detail-sections {
        grid-template-columns: 1fr;
    }

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

    .group-discussion-layout {
        grid-template-columns: 1fr;
    }

    .group-discussion-chat-panel {
        grid-template-rows: auto minmax(260px, 52vh) auto;
    }

    .creation-grid,
    .creation-fiche-list,
    .creation-image-list {
        grid-template-columns: 1fr;
    }

    .share-filter-row {
        grid-template-columns: 1fr;
    }

    .premium-lock {
        grid-template-columns: 1fr;
    }

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

    .pdf-section iframe,
    .premium-viewer iframe,
    .premium-viewer img {
        height: 520px;
    }

    .admin-hero {
        flex-direction: column;
    }

    .admin-card {
        grid-column: 1 / -1;
    }
}

@media (max-width: 520px) {
    .side-nav {
        width: 100%;
    }

    .quick-stats span,
    .primary-button,
    .ghost-button,
    .premium-button {
        width: 100%;
    }

    .module-card {
        grid-template-columns: 38px minmax(0, 1fr);
    }

    .done-dot {
        grid-column: 2;
    }

    .shared-comment-form {
        grid-template-columns: 1fr;
    }

    .student-group-invite {
        align-items: stretch;
        flex-direction: column;
    }

    .student-group-invite-actions {
        justify-content: stretch;
    }

    .student-group-message-form {
        grid-template-columns: 1fr;
    }
}

/* Responsive visual refresh */
:root {
    --bg: #f4f7f6;
    --panel: #ffffff;
    --panel-soft: #eef4f2;
    --ink: #14201d;
    --muted: #5b6764;
    --line: #d7e0dd;
    --teal: #0f766e;
    --teal-dark: #115e59;
    --yellow: #eab308;
    --red: #b42318;
    --green-soft: #dff3ed;
    --shadow: 0 12px 34px rgba(18, 32, 29, 0.08);
    --bs-body-bg: #f4f7f6;
    --bs-body-color: #14201d;
    --bs-primary: #0f766e;
    --bs-primary-rgb: 15, 118, 110;
    --bs-secondary-color: #5b6764;
    --bs-border-color: #d7e0dd;
    --bs-border-radius: 8px;
    --bs-font-sans-serif: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a,
input,
select,
textarea {
    transition:
        border-color 0.16s ease,
        background-color 0.16s ease,
        color 0.16s ease,
        box-shadow 0.16s ease,
        transform 0.16s ease;
}

.app-shell {
    grid-template-columns: minmax(252px, 292px) minmax(0, 1fr);
    background: var(--bg);
}

.sidebar {
    gap: 22px;
    padding: 22px;
    background: #15231f;
    color: #f8faf8;
    box-shadow: 1px 0 0 rgba(255, 255, 255, 0.08);
}

.brand {
    min-width: 0;
}

.brand-mark {
    flex: 0 0 auto;
    border-color: #f2c94c;
    background: #24332e;
    color: #f2c94c;
}

.brand small {
    color: #cbd8d3;
}

.side-nav {
    gap: 7px;
}

.side-nav a,
.side-nav button.nav-link {
    display: flex;
    align-items: center;
    min-height: 42px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #e9f0ed;
    font-weight: 800;
    text-align: left;
}

.side-nav a:hover,
.side-nav a:focus-visible,
.side-nav button.nav-link:hover,
.side-nav button.nav-link:focus-visible {
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.side-nav a[aria-current="page"] {
    border-color: rgba(242, 201, 76, 0.5);
    background: #f2c94c;
    color: #14201d;
}

.theme-panel,
.progress-panel {
    border-color: rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.08);
}

.main {
    padding: clamp(16px, 2.8vw, 34px);
}

.intro-copy,
.visual-panel,
.workspace-header,
.module-column,
.detail-panel,
.pdf-section,
.share-section,
.creation-section,
.creation-tool,
.creation-defaults,
.premium-section,
.modal-dialog,
.admin-card {
    border-color: var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.intro-copy,
.workspace-header,
.detail-panel,
.student-group-card,
.group-discussion-chat-panel,
.group-discussion-groups,
.creation-section,
.creation-tool,
.creation-defaults {
    box-shadow: 0 8px 24px rgba(18, 32, 29, 0.06);
}

.intro-copy {
    position: relative;
    overflow: hidden;
    padding: clamp(20px, 3vw, 34px);
    border-top: 4px solid var(--teal);
}

.eyebrow {
    color: var(--teal-dark);
    letter-spacing: 0;
}

h1 {
    font-size: clamp(30px, 4vw, 46px);
    line-height: 1.08;
}

h2 {
    font-size: clamp(20px, 2.1vw, 25px);
}

.top-band {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
    gap: clamp(14px, 2vw, 24px);
}

.visual-panel {
    min-height: clamp(220px, 32vw, 340px);
}

.visual-panel img {
    min-height: clamp(220px, 32vw, 340px);
}

.quick-stats {
    gap: 8px;
}

.quick-stats span,
.detail-section,
.detail-media,
.share-account-row,
.account-row,
.student-group-list li,
.student-group-invite,
.student-group-message,
.shared-file-card,
.creation-fiche-card,
.creation-image-card,
.plan-card {
    border-radius: 8px;
}

.primary-button,
.ghost-button,
.premium-button,
.danger-button {
    min-width: 0;
    border-radius: 8px;
    line-height: 1.2;
}

body.bootstrap-enhanced .btn {
    font-weight: 800;
    letter-spacing: 0;
}

body.bootstrap-enhanced .form-control,
body.bootstrap-enhanced .form-select {
    box-shadow: none;
}

body.bootstrap-enhanced .form-check-input:checked {
    border-color: var(--teal);
    background-color: var(--teal);
}

body.bootstrap-enhanced .btn-group {
    flex-wrap: wrap;
}

.primary-button {
    box-shadow: 0 7px 18px rgba(15, 118, 110, 0.16);
}

.primary-button:hover,
.primary-button:focus-visible {
    box-shadow: 0 10px 22px rgba(15, 118, 110, 0.2);
}

.ghost-button:hover,
.ghost-button:focus-visible,
.theme-pill:hover,
.theme-pill:focus-visible {
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.search-box input,
.search-box select,
.auth-form input,
.auth-form select,
.share-form input,
.share-form select,
.share-form textarea,
.admin-form input,
.admin-form textarea,
.admin-form select,
.student-group-message-form textarea {
    min-height: 44px;
    border-color: var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.search-box input:focus,
.search-box select:focus,
.auth-form input:focus,
.auth-form select:focus,
.share-form input:focus,
.share-form select:focus,
.share-form textarea:focus,
.admin-form input:focus,
.admin-form textarea:focus,
.admin-form select:focus,
.student-group-message-form textarea:focus {
    border-color: var(--teal);
    outline: 3px solid rgba(15, 118, 110, 0.14);
}

.workspace-header,
.share-heading,
.creation-heading,
.premium-heading,
.list-header,
.pdf-heading {
    background: #fbfdfc;
}

.module-card {
    min-height: 86px;
}

.module-card:hover,
.module-card:focus-visible,
.module-card.is-selected {
    background: #eff8f5;
}

.module-number,
.badge,
.premium-tag,
.student-group-subtitle span {
    background: #15231f;
}

.detail-panel {
    top: 24px;
}

.share-grid,
.student-space-content {
    gap: clamp(12px, 2vw, 18px);
}

.group-discussion-layout {
    grid-template-columns: minmax(230px, 310px) minmax(0, 1fr);
}

.group-discussion-group {
    border-color: var(--line);
}

.group-discussion-group:hover,
.group-discussion-group:focus-visible,
.group-discussion-group.is-active {
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.modal-dialog {
    width: min(560px, calc(100vw - 24px));
}

@media (max-width: 1120px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: sticky;
        z-index: 20;
        top: 0;
        height: auto;
        gap: 12px;
        padding: 14px 16px;
    }

    .brand {
        flex: 1 1 240px;
    }

    .side-nav {
        width: 100%;
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 2px;
        scrollbar-width: thin;
    }

    .side-nav a,
    .side-nav button.nav-link {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .theme-panel {
        flex: 0 1 auto;
    }

    .progress-panel {
        flex: 1 1 280px;
    }
}

@media (max-width: 860px) {
    .top-band,
    .workspace-grid,
    .share-grid,
    .student-space-content,
    .creation-grid,
    .group-discussion-layout,
    .premium-lock {
        grid-template-columns: 1fr;
    }

    .workspace-header,
    .share-heading,
    .creation-heading,
    .premium-heading {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .filter-row {
        width: 100%;
        overflow-x: auto;
    }

    .detail-panel {
        position: static;
    }

    .pdf-section iframe,
    .premium-viewer iframe {
        display: none;
    }

    .pdf-canvas-viewer {
        display: grid;
    }

    .group-discussion-chat-panel {
        grid-template-rows: auto minmax(300px, 55vh) auto;
    }

}

@media (max-width: 640px) {
    body {
        font-size: 15px;
    }

    .main {
        padding: 12px;
    }

    .sidebar {
        padding: 12px;
    }

    .brand-mark {
        width: 38px;
        height: 38px;
    }

    .side-nav a,
    .side-nav button.nav-link {
        min-height: 38px;
        padding: 8px 10px;
        font-size: 14px;
    }

    .intro-copy,
    .workspace-header,
    .detail-panel,
    .share-heading,
    .creation-heading,
    .premium-heading,
    .student-group-card,
    .group-discussion-chat-panel,
    .group-discussion-groups {
        padding: 14px;
    }

    .quick-stats {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .quick-stats span {
        min-width: 0;
    }

    .top-actions,
    .detail-actions,
    .student-space-account,
    .creation-account-row,
    .share-account-row,
    .account-row {
        align-items: stretch;
    }

    .module-card {
        grid-template-columns: 38px minmax(0, 1fr);
        padding: 12px;
    }

    .module-number {
        width: 38px;
        height: 38px;
    }

    .done-dot {
        grid-column: 2;
    }

    .student-group-meta-grid,
    .plan-grid,
    .detail-sections {
        grid-template-columns: 1fr;
    }

    .group-discussion-messages {
        min-height: 300px;
    }
}

@media (max-width: 420px) {
    .quick-stats {
        grid-template-columns: 1fr;
    }

    .theme-panel {
        width: 100%;
    }

    .theme-panel label {
        flex: 1 1 0;
        justify-content: center;
    }
}

.mobile-menu-toggle {
    display: none;
}

@media (max-width: 1120px) {
    .sidebar.has-mobile-menu {
        flex-direction: row;
        align-items: center;
    }

    .sidebar.has-mobile-menu .brand {
        flex: 1 1 0;
        min-width: 0;
    }

    .sidebar.has-mobile-menu .brand span:last-child {
        min-width: 0;
    }

    .sidebar.has-mobile-menu .brand strong,
    .sidebar.has-mobile-menu .brand small {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-menu-toggle {
        display: inline-flex;
        align-items: center;
        flex: 0 0 auto;
        justify-content: center;
        width: 44px;
        min-height: 38px;
        padding: 8px;
        border: 1px solid rgba(242, 201, 76, 0.46);
        border-radius: 8px;
        background: #f2c94c;
        color: #14201d;
        font-weight: 900;
    }

    .mobile-menu-toggle:hover,
    .mobile-menu-toggle:focus-visible {
        background: #ffe08a;
        outline: 3px solid rgba(242, 201, 76, 0.22);
    }

    .mobile-menu-icon {
        display: grid;
        gap: 5px;
        width: 22px;
    }

    .mobile-menu-icon span {
        display: block;
        height: 2px;
        border-radius: 999px;
        background: currentColor;
        transform-origin: center;
        transition:
            opacity 0.16s ease,
            transform 0.16s ease;
    }

    .sidebar.has-mobile-menu.is-menu-open .mobile-menu-icon span:first-child {
        transform: translateY(7px) rotate(45deg);
    }

    .sidebar.has-mobile-menu.is-menu-open .mobile-menu-icon span:nth-child(2) {
        opacity: 0;
    }

    .sidebar.has-mobile-menu.is-menu-open .mobile-menu-icon span:last-child {
        transform: translateY(-7px) rotate(-45deg);
    }

    .sidebar.has-mobile-menu .side-nav,
    .sidebar.has-mobile-menu .theme-panel,
    .sidebar.has-mobile-menu .progress-panel {
        display: none;
        width: 100%;
    }

    .sidebar.has-mobile-menu .side-nav {
        overflow: visible;
        padding: 6px 0 0;
    }

    .sidebar.has-mobile-menu.is-menu-open .side-nav {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch;
        gap: 8px;
        overflow: visible;
    }

    .sidebar.has-mobile-menu.is-menu-open .theme-panel {
        display: flex;
    }

    .sidebar.has-mobile-menu.is-menu-open .theme-panel label {
        flex: 1 1 0;
        justify-content: center;
    }

    .sidebar.has-mobile-menu.is-menu-open .progress-panel {
        display: block;
        margin-top: 0;
    }

    .sidebar.has-mobile-menu.is-menu-open .side-nav a,
    .sidebar.has-mobile-menu.is-menu-open .side-nav button.nav-link {
        width: 100%;
        flex: 0 0 auto;
        justify-content: flex-start;
        white-space: normal;
    }

    .sidebar.has-mobile-menu.is-menu-open .side-nav .nav-link {
        display: flex;
        margin: 0;
    }
}
