.lesson-chat { margin: 1.5rem 0; padding: clamp(1rem, 3vw, 1.5rem); border: 1px solid var(--line); border-radius: 18px; background: #0b1420; color: #e7edf5; min-width: 0; }
.lesson-chat header p { color: #b7c5d5; font-size: .85rem; }
.lesson-chat-heading { margin-bottom: 1rem; }
.lesson-chat-heading-row, .lesson-chat-heading h2 { display: flex; align-items: center; gap: .6rem; }
.lesson-chat-heading-row { flex-wrap: wrap; justify-content: space-between; }
.lesson-chat-heading h2 { margin: 0; }
.lesson-chat-mark { display: inline-grid; flex: none; place-items: center; width: 2rem; height: 2rem; border-radius: 10px 10px 10px 3px; background: #194150; color: #a0f4e6; }
.lesson-chat-count { padding: .25rem .65rem; border-radius: 999px; background: #15392f; color: #a0f4d5; font-size: .8rem; font-weight: 700; }
.lesson-chat-heading p { margin: .5rem 0 0; }
.lesson-chat-layout { display: grid; grid-template-columns: minmax(150px, .75fr) minmax(0, 2fr); gap: 1rem; }
.lesson-chat-threads { display: flex; flex-direction: column; gap: .5rem; max-height: 38rem; overflow: auto; }
.lesson-chat-threads a { display: grid; gap: .3rem; padding: .8rem; border: 1px solid #425366; border-radius: 12px; color: #dce8f5; text-decoration: none; }
.lesson-chat-threads a[aria-current] { border-color: #75c6d2; background: #163644; }
.chat-unread { color: #98edd4; font-size: .75rem; font-weight: 700; }
.lesson-chat-conversation { min-width: 0; padding: 1rem; border-radius: 14px; background: #080f19; }
.academia-record .lesson-chat { margin: 0; }
.lesson-chat-log { list-style: none; padding: .5rem 0; margin: 0; display: flex; flex-direction: column; gap: .8rem; max-height: 32rem; overflow: auto; }
.chat-bubble { align-self: flex-start; max-width: 90%; padding: .8rem 1rem; border: 1px solid #3b3c56; border-radius: 14px 14px 14px 3px; background: #24263c; overflow-wrap: anywhere; }
.chat-bubble.is-mine { align-self: flex-end; border-color: #316372; background: #184454; border-radius: 14px 14px 3px 14px; }
.chat-bubble strong, .chat-bubble small { font-size: .72rem; color: #c0d5e2; }
.chat-bubble p { margin: .4rem 0; white-space: pre-wrap; }
.chat-compose { display: grid; gap: .65rem; margin-top: 1rem; }
.chat-compose textarea { width: 100%; min-height: 6rem; background: #111e2d; color: #f2f5fa; border: 1px solid #667a8d; border-radius: 12px; padding: .8rem; font: inherit; resize: vertical; }
.chat-compose-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.chat-compose-actions > button { margin-inline-start: auto; min-height: 44px; }
.chat-emojis:not([hidden]) { display: flex; flex-wrap: wrap; gap: .3rem; }
.chat-emojis button { width: 44px; height: 44px; padding: 0; border: 1px solid #425366; border-radius: 10px; background: #111e2d; font-size: 1.1rem; cursor: pointer; }
.chat-emojis button:hover { background: #22354a; }
.lesson-chat a:focus-visible, .lesson-chat button:focus-visible, .chat-compose textarea:focus-visible { outline: 3px solid #81d5e3; outline-offset: 2px; }
@media (max-width: 700px) { .lesson-chat-layout { grid-template-columns: minmax(0, 1fr); } .lesson-chat-threads { max-height: 12rem; } .lesson-chat-conversation { padding: .75rem; } .chat-bubble { max-width: 96%; } }

.chat-privacy { margin-top: 1rem; font-size: .8rem; color: #b7c5d5; }
.chat-privacy summary { cursor: pointer; }

.chat-bubble[id] { scroll-margin-top: 1rem; }
.chat-edit { margin-top: .3rem; }
.chat-bubble:has(.chat-edit[open]) { width: min(100%, 32rem); }
.chat-edit summary {
    width: fit-content;
    min-height: 2rem;
    padding: .35rem .2rem;
    color: #d2f3f7;
    font-size: .8rem;
    cursor: pointer;
}
.chat-edit-form { display: grid; gap: .5rem; margin: .25rem 0 0; }
.chat-edit-form label { font-size: .8rem; }
.chat-edit-form textarea {
    width: 100%;
    min-height: 5rem;
    padding: .65rem .75rem;
    border: 1px solid #7797a7;
    border-radius: .6rem;
    background: #111e2d;
    color: #f2f5fa;
    font: inherit;
    resize: vertical;
}
.chat-edit-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .4rem; }
.chat-edit-actions .button { min-height: 2.5rem; }
.chat-edit summary:focus-visible, .chat-edit-form textarea:focus-visible { outline: 3px solid #81d5e3; outline-offset: 2px; }
.chat-edit-error { color: #ffc1ae; }
.chat-edit-success { color: #a0f4d5; }

.student-forum {
    display: grid;
    gap: 1rem;
    min-width: 0;
    padding: clamp(1rem, 3vw, 2rem);
    border: 1px solid #4b5268;
    border-radius: 1rem;
    background: #151d2c;
    color: #edf3fa;
    scroll-margin-top: 7rem;
}
.admin-body .student-forum { scroll-margin-top: 13rem; }
.forum-header { display: flex; flex-wrap: wrap; align-items: start; justify-content: space-between; gap: .75rem; }
.student-forum :is(h1, h2, h3, p) { margin: 0; }
.forum-header p, .forum-message small, .forum-topics span { color: #b9c6d6; }
.forum-header p { margin-top: .35rem; }
.forum-new { padding: .75rem 1rem; border: 1px solid #557d80; border-radius: .7rem; background: #183239; }
.student-forum details summary { width: fit-content; min-height: 2.25rem; padding: .4rem .15rem; cursor: pointer; }
.student-forum :is(a, summary, button):focus-visible { outline: 2px solid #a0f4e6; outline-offset: 3px; }
.forum-topics, .forum-thread { display: grid; gap: .65rem; margin: 0; padding: 0; list-style: none; }
.forum-topics a {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .25rem 1rem;
    padding: .8rem 1rem;
    border: 1px solid #4f6178;
    border-radius: .65rem;
    background: #212f43;
    color: inherit;
    text-decoration: none;
}
.forum-topics a:hover { border-color: #a0f4e6; }
.forum-topics :is(strong, span), .forum-message { overflow-wrap: anywhere; }
.forum-message { padding: .85rem 1rem; border-radius: .7rem; border: 1px solid #425269; background: #202b3d; }
.forum-message:first-child { border-color: #669a99; background: #1b333d; }
.forum-message-hidden { border-style: dashed; }
.forum-message header { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .35rem 1rem; }
.forum-message p { margin: .5rem 0; white-space: pre-wrap; }
.forum-form { display: grid; gap: .7rem; margin-top: .45rem; }
.forum-form .field { min-width: 0; }
.forum-form .field textarea { min-height: 6rem; }
.forum-form button { justify-self: start; }
.forum-reply { padding-top: .7rem; border-top: 1px solid #4f6178; }
.forum-feedback { color: #a0f4d5; }
.forum-feedback[role="alert"] { color: #ffc1ae; }
.forum-pagination { display: flex; flex-wrap: wrap; gap: .65rem 1rem; }
