/* ===== Layout (from english.css) ===== */

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: auto;
    font-size: 18px;
    background-color: #EDEEF0;
}

body > .page {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

header {
    flex: 0 0 auto;
    margin-top: 4px;
    background: linear-gradient(0.02turn, #ffffffff, #ffffffd0, #ffffff60);
    min-height: 45px;
    height: 70px;
}

header > div {
    width: 100%;
    height: 100%;
    text-align: center;
    background-image: url(/images/background.jpg);
    background-size: auto 100%;
    background-repeat: no-repeat;
    background-position: left;
    display: flex;
    justify-content: center;
    align-items: center;
}

header h1, header a, header img {
    display: inline-block;
    text-wrap: auto;
    text-wrap-mode: wrap;
    text-wrap-style: balance;
}

h1, h2 {
    text-align: center;
}

div.page {
    height: 96%;
    position: relative;
    border-spacing: 1px;
    border-collapse: separate;
    border: solid 2px #795d21c9;
    background-color: #ffffffa0;
}

.row {
    display: flex;
    flex: 1 1 auto;
    overflow: hidden;
}

.row aside {
    flex: 0 0 220px;
    min-width: 190px;
    background-color: #fff8f8bb;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    padding: 0px 8px 8px 0px;
    overflow-y: auto;
}

.row main {
    flex: 1 1 auto;
    overflow-x: hidden;
    overflow-y: auto;
    box-sizing: border-box;
}

aside, main {
    border: solid 1px #75611edb;
    margin: 2px;
}

main {
    background: linear-gradient(0.25turn, #ffffffa8, #ffffff40);
    width: 100%;
}

p {
    margin: 2px 0 2px 0;
    padding: 2px;
    max-width: 900px;
}

ul {
    max-width: 900px;
}

aside li {
    padding: 3px 0 0 0;
    max-width: 870px;
}

aside li > a {
    width: 90%;
    margin: 0 2px;
}

.scrollable {
    height: 96%;
    overflow: auto;
    padding: 10px;
    box-sizing: border-box;
    position: relative;
    flex: 1;
}

.flexRow {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    width: fit-content;
    text-align: center;
}

.content {
    font-family: Tahoma, Verdana, Arial, system-ui;
    max-width: 1150px;
}

a.printer {
    cursor: copy, context-menu, pointer;
}

/* ===== Layout responsive ===== */

@media screen and (max-width: 1040px) {
    header img {
        display: none;
    }
}

@media screen and (max-width: 1099px) {
    .row aside {
        padding: 1px;
    }
}

@media screen and (min-width: 1100px) and (max-width: 1199px) {
    .row aside {
        padding: 0.7em;
        min-width: 330px;
        width: 330px;
    }
}

@media screen and (min-width: 1200px) and (max-width: 1299px) {
    .row aside {
        padding: 0.7em;
        min-width: 370px;
        width: 370px;
    }
}

@media screen and (min-width: 1300px) and (max-width: 1399px) {
    .row aside {
        padding: 0.7em;
        min-width: 410px;
        width: 410px;
    }
}

@media screen and (min-width: 1400px) {
    .row aside {
        padding: 0.7em;
        min-width: 450px;
        width: 450px;
    }
}

@media screen and (max-width: 1199px) {
    main {
        padding-left: 7px;
        padding-right: 4px;
    }
}

@media screen and (min-width: 1200px) {
    main {
        padding-left: 12px;
        padding-right: 10px;
    }
}

/* ===== Authorization bar (train_header) ===== */

.header {
    text-align: center;
    max-width: 1150px;
    margin: 0 auto;
}

.header table {
    width: 100%;
}

/* ===== Common forum styles ===== */

#forumContainer {
    max-width: 800px;
    margin: 0 auto;
    padding: 16px;
}

.emptyState {
    text-align: center;
    padding: 40px 16px;
    font-size: 18px;
    color: #666;
}

/* Pagination */

.pagination {
    margin: 12px 0;
    text-align: center;
}

.paginationInner {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.pageLink {
    display: inline-block;
    padding: 4px 10px;
    border: 1px solid #ccc;
    border-radius: 3px;
    text-decoration: none;
    color: #335;
}

.pageLink:hover {
    background: #eee;
}

.pageCurrent {
    display: inline-block;
    padding: 4px 10px;
    border: 1px solid #335;
    border-radius: 3px;
    background: #335;
    color: #fff;
    font-weight: bold;
}

.pageDots {
    padding: 0 4px;
    color: #999;
}

/* Messages */

.forumMessage {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
    background: #fafafa;
}

.msgHeader {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 13px;
    color: #888;
}

.msgAuthor {
    font-weight: bold;
}

.msgAuthor a {
    color: #335;
    text-decoration: none;
}

.msgAuthor a:hover {
    text-decoration: underline;
}

.msgDescription {
    font-weight: bold;
    margin-bottom: 4px;
    color: #333;
}

.msgText {
    margin-bottom: 6px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.msgFolder {
    font-size: 12px;
    color: #999;
    margin-bottom: 4px;
}

.msgDate {
    font-size: 12px;
    color: #999;
}

.msgActions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 8px;
}

/* Replies */

.replyBtn {
    font-size: 12px;
    padding: 2px 8px;
    cursor: pointer;
}

.replyLnk,
.replyLink {
    color: #335;
    text-decoration: none;
}

.replyLnk:hover,
.replyLink:hover {
    text-decoration: underline;
}

.replyLink {
    font-size: 12px;
}

.replyCount {
    font-size: 12px;
    color: #888;
    margin-top: 6px;
}

.replyItem {
    padding: 8px 0;
}

.replyHeader {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #999;
    margin-bottom: 2px;
}

.replyAuthor {
    font-weight: bold;
}

.replyAuthor a {
    color: #335;
    text-decoration: none;
}

.replyAuthor a:hover {
    text-decoration: underline;
}

.replyText {
    line-height: 1.5;
    white-space: pre-wrap;
}

.replyActions {
    margin-top: 2px;
}

.replyActions a {
    font-size: 12px;
    color: #335;
    text-decoration: none;
    margin-right: 8px;
}

.replyActions a:hover {
    text-decoration: underline;
}

.replyActions .deleteLink {
    color: #c33;
}

/* Delete link */

.deleteLink {
    font-size: 12px;
    color: #c33;
    text-decoration: none;
    cursor: pointer;
}

.deleteLink:hover {
    text-decoration: underline;
}

/* Back link */

.backLink {
    display: inline-block;
    margin-bottom: 16px;
    cursor: pointer;
    color: #335;
    text-decoration: none;
}

.backLink:hover {
    text-decoration: underline;
}

.emptyReplies {
    text-align: center;
    padding: 16px;
    color: #999;
}

/* Reactions */

.reactions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.rxnBtn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border: 1px solid #ccc;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}

.rxnBtn:hover {
    background: #eef3f9;
    border-color: #99b;
}

.rxnBtn.active {
    background: #d6e4f0;
    border-color: #1a5276;
}

.rxnIcon {
    font-size: 15px;
}

.rxnCount {
    font-size: 12px;
    color: #666;
}

.rxnAdd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 1px dashed #bbb;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    font-size: 15px;
    color: #999;
    transition: all 0.15s;
}

.rxnAdd:hover {
    background: #eef3f9;
    border-color: #99b;
    color: #333;
}

.rxnPicker {
    display: none;
    gap: 4px;
    flex-wrap: wrap;
    width: 100%;
    padding-top: 4px;
}

.rxnOption {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid #ddd;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.12s;
}

.rxnOption:hover {
    background: #eef3f9;
    border-color: #99b;
    transform: scale(1.15);
}

.reactionsDisabled {
    opacity: 0.5;
    pointer-events: none;
}

/* ===== Forum main page (forum.xsl) ===== */

#newMessageForm {
    margin-top: 24px;
    padding: 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #f5f5f5;
}

#newMessageForm h2 {
    margin: 0 0 12px 0;
    font-size: 18px;
}

#newMessageForm label {
    display: block;
    margin-bottom: 4px;
    font-weight: bold;
}

#newMessageForm input[type="text"] {
    width: 100%;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    margin-bottom: 10px;
}

#newMessageForm textarea {
    width: 100%;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    margin-bottom: 10px;
}

#sendMsgBtn {
    padding: 8px 20px;
    background: #335;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

#sendMsgBtn:hover {
    background: #446;
}

#sendStatus {
    margin-left: 10px;
    font-size: 13px;
}

/* ===== Forum reply page (forumReply.xsl) ===== */

.messageView {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 16px;
    background: #fafafa;
}

#replyForm {
    margin-top: 20px;
    padding: 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #f5f5f5;
}

#replyForm h2 {
    margin: 0 0 12px 0;
    font-size: 16px;
}

#replyForm textarea {
    width: 100%;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    margin-bottom: 10px;
}

#sendReplyBtn {
    padding: 8px 20px;
    background: #335;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

#sendReplyBtn:hover {
    background: #446;
}

#replyStatus {
    margin-left: 10px;
    font-size: 13px;
}

/* ===== Forum user page (forumUser.xsl) ===== */

.userInfo {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 16px;
    background: #fafafa;
}

.userInfo h2 {
    margin: 0 0 4px 0;
    font-size: 20px;
    color: #335;
}

.tutorLink {
    display: inline-block;
    font-size: 14px;
    color: #1a5276;
    text-decoration: none;
}

.tutorLink:hover {
    text-decoration: underline;
}

.tutorSubjects {
    color: #666;
}

.ui-tabs .ui-tabs-nav {
    border-bottom: 2px solid #335;
    max-width: none;
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
}

.ui-tabs .ui-tabs-nav li {
    margin-bottom: -2px;
}

.ui-tabs .ui-tabs-nav li.ui-tabs-active {
    border-bottom: 2px solid #fff;
}

.ui-tabs .ui-tabs-nav li a {
    padding: 8px 20px;
    font-size: 14px;
    outline: none;
}

.privateMsgForm {
    padding: 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #f5f5f5;
}

.privateMsgForm h2 {
    margin: 0 0 12px 0;
    font-size: 18px;
}

.privateMsgForm textarea {
    width: 100%;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    margin-bottom: 10px;
}

.privateMsgForm input[type="text"] {
    width: 100%;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    margin-bottom: 8px;
}

#sendPrivateBtn {
    padding: 8px 20px;
    background: #335;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

#sendPrivateBtn:hover {
    background: #446;
}

/* ===== Forum questions page (forumQuestions.xsl) ===== */

.sectionHeader {
    margin-bottom: 16px;
}

.sectionHeader h1 {
    margin: 0 0 4px 0;
    font-size: 20px;
    color: #333;
}

.sectionHeader .sectionName {
    font-size: 14px;
    color: #888;
}

.msgBody {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 16px;
    background: #fafafa;
}

.msgBody .msgTitle {
    font-weight: bold;
    font-size: 18px;
    margin-bottom: 8px;
    color: #333;
}

.msgBody .msgText {
    line-height: 1.6;
    white-space: pre-wrap;
}

.msgBody .msgDate {
    font-size: 12px;
    color: #999;
    margin-bottom: 8px;
}

.repliesHeader {
    font-size: 16px;
    font-weight: bold;
    margin: 0 0 12px 0;
    color: #333;
}

#repliesTree {
    margin-bottom: 20px;
}

#replyTrigger a {
    color: #335;
    text-decoration: none;
}

#replyTrigger a:hover {
    text-decoration: underline;
}

/* ===== Forum home / PM page (forumHome.xsl) ===== */

#pmLayout {
    display: flex;
    gap: 0;
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
    height: calc(100vh - 110px);
}

#pmSidebar {
    width: 260px;
    min-width: 260px;
    border-right: 1px solid #ddd;
    background: #fafbfc;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#pmSidebar h2 {
    font-size: 15px;
    color: #555;
    padding: 14px 14px 8px;
    margin: 0;
    border-bottom: 1px solid #eee;
}

#pmSidebar .backLink {
    display: block;
    padding: 10px 14px;
    font-size: 13px;
    color: #1a5276;
    text-decoration: none;
    border-bottom: 1px solid #eee;
}

#pmSidebar .backLink:hover {
    background: #eaf2f8;
}

.contactList {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    overflow-y: auto;
}

.contactItem {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.15s;
}

.contactItem:hover {
    background: #eef3f9;
}

.contactItem.active {
    background: #d6e4f0;
    border-left: 3px solid #1a5276;
}

.contactAvatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #1a5276;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: bold;
    flex-shrink: 0;
}

.contactInfo {
    flex: 1;
    min-width: 0;
}

.contactName {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contactMeta {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contactBadge {
    background: #e74c3c;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 7px;
    border-radius: 10px;
    flex-shrink: 0;
}

#pmMessages {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.contactPanel {
    display: none;
    flex-direction: column;
    height: 100%;
}

.contactPanel.active {
    display: flex;
}

.panelHeader {
    padding: 12px 20px;
    border-bottom: 1px solid #eee;
    background: #fff;
    z-index: 1;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panelHeader h1 {
    font-size: 20px;
    color: #335;
    margin: 0;
    flex: 1;
}

.panelHeader h1 a {
    color: inherit;
    text-decoration: none;
}

.panelHeader h1 a:hover {
    color: #1a5276;
    text-decoration: underline;
}

.typingIndicator {
    font-size: 12px;
    color: #27ae60;
    font-style: italic;
    white-space: nowrap;
    display: none;
}

.panelMessages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column-reverse;
    padding: 12px 20px;
    gap: 8px;
}

.msgCard {
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fafafa;
    overflow: hidden;
    flex-shrink: 0;
}

.msgSummary {
    padding: 8px 10px;
    font-size: 13px;
    color: #555;
    display: flex;
    align-items: center;
    gap: 8px;
}

.msgDir {
    color: #335;
    white-space: nowrap;
}

.msgDir.incoming {
    color: #1a7a3a;
}

.msgDir.outgoing {
    color: #888;
}

.msgSubject {
    font-weight: bold;
    color: #333;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.msgBody {
    padding: 0 10px 10px;
}

.replyBlock {
    border-top: 1px solid #e0e0e0;
    padding: 8px 0 0;
}

.replyItem {
    margin-bottom: 6px;
    padding: 6px 8px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 4px;
}

.replyHeader {
    font-size: 12px;
    color: #888;
    margin-bottom: 3px;
}

.replyAuthor {
    font-weight: bold;
    color: #335;
}

.replyText {
    line-height: 1.5;
    white-space: pre-wrap;
}

.newIcon {
    color: red;
    font-weight: bold;
    margin-left: 6px;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50%, 100% { opacity: 1; }
    25%, 75% { opacity: 0; }
}

.panelReply {
    padding: 10px 20px;
    border-top: 1px solid #ddd;
    background: #fff;
    flex-shrink: 0;
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.panelReplyInput {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    resize: none;
    height: 44px;
    overflow-y: auto;
}

.panelReplyBtn {
    padding: 8px 18px;
    background: #1a5276;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.panelReplyBtn:hover {
    background: #2471a3;
}

.panelReplyStatus {
    font-size: 12px;
}

.emptyPanel {
    text-align: center;
    padding: 40px 16px;
    font-size: 16px;
    color: #999;
}

/* PM sidebar hidden state */

.pmSidebarHidden #pmSidebar {
    display: none;
}

#pmRestoreBtn {
    display: none;
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    background: #1a5276;
    color: #fff;
    border: none;
    border-radius: 0 6px 6px 0;
    padding: 12px 6px;
    cursor: pointer;
    font-size: 14px;
    z-index: 200;
    box-shadow: 2px 0 6px rgba(0, 0, 0, 0.15);
    writing-mode: vertical-rl;
    letter-spacing: 2px;
    font-weight: bold;
}

.pmSidebarHidden #pmRestoreBtn {
    display: block;
}

/* ===== Responsive - forum main ===== */

@media (max-width: 1024px) and (min-width: 701px) {
    .msgHeader { font-size: 1.1em; }
    .msgDescription { font-size: 1.15em; }
    .msgText { font-size: 1.1em; }
    .replyItem { font-size: 1.1em; }
    #newMessageForm h2 { font-size: 1.15em; }
    #newMessageForm textarea { font-size: 1.15em; }
    #sendMsgBtn { font-size: 1.15em; }
    .rxnBtn { font-size: 1.15em; }
    .rxnIcon { font-size: 1.2em; }
}

@media (max-width: 700px) {
    .msgHeader { font-size: 1.3em; }
    .msgDescription { font-size: 1.44em; }
    .msgText { font-size: 1.3em; }
    .replyItem { font-size: 1.3em; }
    .replyCount { font-size: 1.1em; }
    .replyLink { font-size: 1.1em; }
    #newMessageForm h2 { font-size: 1.44em; }
    #newMessageForm textarea { font-size: 1.44em; }
    #newMessageForm input[type="text"] { font-size: 1.44em; }
    #sendMsgBtn { font-size: 1.44em; padding: 12px 22px; }
    #sendStatus { font-size: 1.1em; }
    .rxnBtn { font-size: 1.3em; }
    .rxnIcon { font-size: 1.5em; }
    .rxnAdd { font-size: 1.3em; }
}

/* ===== Responsive - forum reply ===== */

@media (max-width: 1024px) and (min-width: 701px) {
    .messageView .msgDescription { font-size: 1.15em; }
    .messageView .msgText { font-size: 1.1em; }
    #replyForm textarea { font-size: 1.15em; }
    #sendReplyBtn { font-size: 1.15em; }
}

@media (max-width: 700px) {
    .messageView .msgDescription { font-size: 1.44em; }
    .messageView .msgText { font-size: 1.3em; }
    .replyText { font-size: 1.3em; }
    #replyForm h2 { font-size: 1.44em; }
    #replyForm textarea { font-size: 1.44em; }
    #sendReplyBtn { font-size: 1.44em; padding: 12px 22px; }
    #replyStatus { font-size: 1.1em; }
}

/* ===== Responsive - forum user ===== */

@media (max-width: 1024px) and (min-width: 701px) {
    .userInfo h2 { font-size: 1.15em; }
    .privateMsgForm h2 { font-size: 1.15em; }
    .privateMsgForm textarea { font-size: 1.15em; }
    #sendPrivateBtn { font-size: 1.15em; }
}

@media (max-width: 700px) {
    .userInfo h2 { font-size: 1.44em; }
    .privateMsgForm h2 { font-size: 1.44em; }
    .privateMsgForm textarea { font-size: 1.44em; }
    .privateMsgForm input[type="text"] { font-size: 1.44em; }
    #sendPrivateBtn { font-size: 1.44em; padding: 12px 22px; }
    #sendStatus { font-size: 1.1em; }
}

/* ===== Responsive - forum questions ===== */

@media (max-width: 1024px) and (min-width: 701px) {
    .sectionHeader h1 { font-size: 1.15em; }
    .msgBody .msgTitle { font-size: 1.15em; }
    .msgBody .msgText { font-size: 1.1em; }
    #replyForm textarea { font-size: 1.15em; }
    #sendReplyBtn { font-size: 1.15em; }
}

@media (max-width: 700px) {
    .sectionHeader h1 { font-size: 1.44em; }
    .msgBody .msgTitle { font-size: 1.44em; }
    .msgBody .msgText { font-size: 1.3em; }
    .replyText { font-size: 1.3em; }
    #replyForm h2 { font-size: 1.44em; }
    #replyForm textarea { font-size: 1.44em; }
    #sendReplyBtn { font-size: 1.44em; padding: 12px 22px; }
    #replyStatus { font-size: 1.1em; }
}

/* ===== Responsive - forum home / PM ===== */

@media (max-width: 1024px) and (min-width: 701px) {
    .panelHeader h1 { font-size: 1.15em; }
    .panelReplyInput { font-size: 1.15em; height: 48px; }
    .panelReplyBtn { font-size: 1.15em; }
    .msgSummary { font-size: 1.1em; }
    .contactName { font-size: 1.1em; }
}

@media (max-width: 700px) {
    #pmLayout {
        flex-direction: column;
        height: calc(100vh - 100px);
        height: calc(100dvh - 100px);
        width: 100%;
        max-width: 100%;
    }

    #pmMessages {
        min-width: 0;
        overflow: auto;
    }

    .contactItem { padding: 8px 12px; }
    .panelHeader { padding: 10px 12px; }
    .panelHeader h1 { font-size: 1.44em; }
    .panelMessages { padding: 10px 12px; }
    .panelReply { padding: 10px 12px; }
    .panelReplyInput { font-size: 1.44em; height: 56px; }
    .panelReplyBtn { font-size: 1.44em; padding: 12px 22px; }
    .msgSummary { font-size: 1.3em; }
    .msgDir { font-size: 0.9em; }
    .msgSubject { font-size: 1.2em; }
    .msgDate { font-size: 0.85em; }
    .msgText { font-size: 1.3em; }
    .replyItem { font-size: 1.3em; }
    .replyHeader { font-size: 0.9em; }
    .contactName { font-size: 1.3em; }
    .contactMeta { font-size: 1.1em; }
    .contactAvatar { width: 42px; height: 42px; font-size: 18px; }
    .typingIndicator { font-size: 1.2em; }
    .panelReplyStatus { font-size: 1.1em; }
    .contactBadge { font-size: 1.1em; padding: 3px 9px; }
}

@media (max-width: 700px) {
    #pmSidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: auto;
        z-index: 150;
        width: 80%;
        max-width: 320px;
        max-height: 80vh;
        overflow-y: auto;
        background: #fafbfc;
        border: 2px solid #aaa;
        border-radius: 0 0 8px 0;
        box-shadow: 2px 2px 12px rgba(0, 0, 0, 0.2);
        display: block;
    }

    #pmSidebar .backLink { font-size: 1.1em; }
    #pmSidebar h2 { font-size: 1.2em; }
    #pmSidebar .contactList { flex: none; height: auto; overflow-y: auto; max-height: 60vh; }
}
