/* Compact centered site footer (AdminLTE .app-footer defaults are tall). */
footer.acadcon-site-footer.app-footer {
    min-height: 0;
    padding: 0.25rem 0.5rem;
  }

  /* Main app footer credits: compact, muted on small phones */
  @media (max-width: 575.98px) {
    footer.acadcon-site-footer.app-footer {
      padding: 0.12rem 0.35rem;
    }
    footer.acadcon-site-footer.app-footer .acadcon-site-footer-credits {
      font-size: 0.625rem !important;
      line-height: 1.35;
      color: var(--bs-secondary-color);
      opacity: 0.68;
      padding-top: 0.1rem !important;
      padding-bottom: 0.1rem !important;
    }
    footer.acadcon-site-footer.app-footer .acadcon-site-footer-credits .d-flex {
      column-gap: 0.35rem !important;
      row-gap: 0.1rem !important;
    }
    footer.acadcon-site-footer.app-footer .acadcon-site-footer-credits span {
      font-weight: 400;
    }
    footer.acadcon-site-footer.app-footer .acadcon-site-footer-credits a.acadcon-site-footer-credits-link {
      color: var(--bs-secondary-color) !important;
      text-decoration: underline;
      text-decoration-color: rgba(var(--bs-secondary-rgb), 0.28);
      text-underline-offset: 1px;
    }
    footer.acadcon-site-footer.app-footer .acadcon-site-footer-credits a.acadcon-site-footer-version {
      font-size: 0.58rem !important;
      padding: 0.05rem 0.2rem !important;
      font-weight: 400 !important;
      color: var(--bs-secondary-color) !important;
      background: rgba(var(--bs-secondary-rgb), 0.08) !important;
      border: 0 !important;
    }
    footer.acadcon-site-footer.app-footer .acadcon-site-footer-credits a.acadcon-site-footer-version i {
      font-size: 0.85em;
      opacity: 0.85;
    }
  }

  /* Login / register / access-code: footer width matches .login-box / .register-box, minimal height */
  .login-box footer.acadcon-auth-footer,
  .register-box footer.acadcon-auth-footer {
    flex-shrink: 0;
  }
  footer.acadcon-auth-footer:not(.acadcon-auth-footer--blend) {
    border-top: 1px solid var(--bs-border-color-translucent, rgba(0, 0, 0, 0.1)) !important;
  }
  footer.acadcon-auth-footer > div {
    padding: 0.15rem 0.25rem !important;
    font-size: 0.7rem;
    line-height: 1.2;
  }
  .login-box footer.acadcon-auth-footer--blend > div,
  .register-box footer.acadcon-auth-footer--blend > div {
    font-size: inherit;
    line-height: inherit;
  }
  footer.acadcon-auth-footer .d-flex {
    gap: 0.2rem 0.35rem !important;
    column-gap: 0.35rem !important;
    row-gap: 0.15rem !important;
  }
  footer.acadcon-auth-footer .badge {
    font-size: 0.62rem;
    padding: 0.08rem 0.3rem;
    line-height: 1.2;
  }
  footer.acadcon-auth-footer i.fas {
    font-size: 0.8em;
    vertical-align: -0.05em;
  }

  /* Login / register / access-code login: footer fades into page (no bar, micro type). */
  .login-box footer.acadcon-auth-footer.acadcon-auth-footer--blend,
  .register-box footer.acadcon-auth-footer.acadcon-auth-footer--blend {
    border-top: none !important;
    box-shadow: none !important;
    margin-top: 0.25rem;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    background: transparent !important;
  }
  .login-box footer.acadcon-auth-footer.acadcon-auth-footer--blend .acadcon-auth-footer-blend-inner,
  .register-box footer.acadcon-auth-footer.acadcon-auth-footer--blend .acadcon-auth-footer-blend-inner {
    padding: 0.05rem 0.25rem 0.1rem !important;
  }
  .login-box footer.acadcon-auth-footer.acadcon-auth-footer--blend .acadcon-auth-footer-line,
  .register-box footer.acadcon-auth-footer.acadcon-auth-footer--blend .acadcon-auth-footer-line {
    font-size: 0.5625rem !important;
    line-height: 1.45 !important;
    font-weight: 400;
    letter-spacing: 0.03em;
    color: var(--bs-secondary-color);
    opacity: 0.62;
  }
  .login-box footer.acadcon-auth-footer.acadcon-auth-footer--blend .acadcon-auth-footer-muted,
  .register-box footer.acadcon-auth-footer.acadcon-auth-footer--blend .acadcon-auth-footer-muted {
    color: inherit;
    font-weight: 400;
  }
  .login-box footer.acadcon-auth-footer.acadcon-auth-footer--blend a.acadcon-auth-footer-link,
  .register-box footer.acadcon-auth-footer.acadcon-auth-footer--blend a.acadcon-auth-footer-link {
    color: inherit;
    text-decoration: none;
    font-weight: 400;
    border-bottom: 1px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  }
  .login-box footer.acadcon-auth-footer.acadcon-auth-footer--blend a.acadcon-auth-footer-link:hover,
  .register-box footer.acadcon-auth-footer.acadcon-auth-footer--blend a.acadcon-auth-footer-link:hover {
    color: var(--bs-body-color);
    opacity: 1;
    border-bottom-color: rgba(var(--bs-secondary-rgb, 108, 117, 125), 0.35);
  }
  .login-box footer.acadcon-auth-footer.acadcon-auth-footer--blend .acadcon-auth-footer-sep,
  .register-box footer.acadcon-auth-footer.acadcon-auth-footer--blend .acadcon-auth-footer-sep {
    opacity: 0.4;
    font-weight: 300;
    margin: 0 0.18em;
  }

  /* Account template builder (teacher + student). */
  .student-template-fab {
    position: fixed;
    left: 18px;
    bottom: 18px;
    z-index: 1080;
    width: 46px;
    height: 46px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, .08);
    background: #fff;
    color: var(--acadcon-fab-icon, #6c757d);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .28);
  }
  .student-template-fab i {
    font-size: 1.1rem;
  }
  .student-template-fab:hover,
  .student-template-fab:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .30);
  }
  .student-template-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .35);
    z-index: 1081;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  .student-template-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }
  .student-template-panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: min(340px, 92vw);
    z-index: 1082;
    background: #fff;
    box-shadow: -8px 0 28px rgba(0, 0, 0, .22);
    transform: translateX(100%);
    transition: transform .22s ease;
    display: flex;
    flex-direction: column;
  }
  .student-template-panel.is-open {
    transform: translateX(0);
  }
  .student-template-option {
    border: 1px solid rgba(0, 0, 0, .14);
    border-radius: 9px;
    padding: .4rem .45rem;
    background: #fff;
    width: 100%;
    text-align: left;
  }
  .student-template-options-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .45rem;
  }
  .student-template-option .small {
    font-size: .74rem;
  }
  .student-template-option.is-active {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 .2rem rgba(13, 110, 253, .18);
  }
  .student-template-swatch {
    width: 100%;
    height: 14px;
    border-radius: 999px;
    margin-bottom: .25rem;
  }
  .student-template-swatch-default { background: linear-gradient(90deg, #343a40, #495057); }
  .student-template-swatch-ocean { background: linear-gradient(90deg, #1a3b5d, #2c78b3); }
  .student-template-swatch-forest { background: linear-gradient(90deg, #1f4a34, #2f7a55); }
  .student-template-swatch-plum { background: linear-gradient(90deg, #4d2f63, #8f5ab1); }
  .student-template-swatch-custom { background: linear-gradient(90deg, #1f2937, #111827); }
  .student-template-custom-controls {
    border: 1px solid rgba(0, 0, 0, .12);
    border-radius: 10px;
    padding: .65rem;
    display: grid;
    gap: .55rem;
  }
  .student-template-custom-controls label {
    font-size: .78rem;
    color: rgba(33, 37, 41, .82);
    margin-bottom: .2rem;
  }
  .student-template-custom-controls input[type="color"] {
    width: 100%;
    height: 34px;
    border: 1px solid rgba(0, 0, 0, .12);
    border-radius: 8px;
    background: #fff;
    padding: .15rem;
  }
  html[data-acadcon-template="ocean"] .app-sidebar-student {
    background: linear-gradient(180deg, #1a3b5d 0%, #132d47 100%) !important;
  }
  html[data-acadcon-template="ocean"] .user-menu .user-header.text-bg-secondary {
    background: linear-gradient(135deg, #1b537f 0%, #2c78b3 100%) !important;
    color: #fff !important;
  }
  html[data-acadcon-template="ocean"] #acadconHeaderCanvas .user-header {
    background: linear-gradient(135deg, #1b537f 0%, #2c78b3 100%) !important;
    color: #fff !important;
  }
  html[data-acadcon-template="ocean"] #chat-unread-filter-all.btn,
  html[data-acadcon-template="ocean"] #chat-unread-filter-unread.btn,
  html[data-acadcon-template="ocean"] #teacher-notif-filter-all.btn,
  html[data-acadcon-template="ocean"] #teacher-notif-filter-unread.btn {
    border-color: #2c78b3;
    color: #2c78b3;
    background: #e9f4ff;
  }
  html[data-acadcon-template="ocean"] #chat-unread-filter-all.btn.active,
  html[data-acadcon-template="ocean"] #chat-unread-filter-unread.btn.active,
  html[data-acadcon-template="ocean"] #teacher-notif-filter-all.btn.active,
  html[data-acadcon-template="ocean"] #teacher-notif-filter-unread.btn.active {
    background: #2c78b3;
    border-color: #2c78b3;
    color: #fff;
  }
  html[data-acadcon-template="forest"] .app-sidebar-student {
    background: linear-gradient(180deg, #1f4a34 0%, #183a2a 100%) !important;
  }
  html[data-acadcon-template="forest"] .user-menu .user-header.text-bg-secondary {
    background: linear-gradient(135deg, #256343 0%, #2f7a55 100%) !important;
    color: #fff !important;
  }
  html[data-acadcon-template="forest"] #acadconHeaderCanvas .user-header {
    background: linear-gradient(135deg, #256343 0%, #2f7a55 100%) !important;
    color: #fff !important;
  }
  html[data-acadcon-template="forest"] #chat-unread-filter-all.btn,
  html[data-acadcon-template="forest"] #chat-unread-filter-unread.btn,
  html[data-acadcon-template="forest"] #teacher-notif-filter-all.btn,
  html[data-acadcon-template="forest"] #teacher-notif-filter-unread.btn {
    border-color: #2f7a55;
    color: #2f7a55;
    background: #eaf8f0;
  }
  html[data-acadcon-template="forest"] #chat-unread-filter-all.btn.active,
  html[data-acadcon-template="forest"] #chat-unread-filter-unread.btn.active,
  html[data-acadcon-template="forest"] #teacher-notif-filter-all.btn.active,
  html[data-acadcon-template="forest"] #teacher-notif-filter-unread.btn.active {
    background: #2f7a55;
    border-color: #2f7a55;
    color: #fff;
  }
  html[data-acadcon-template="plum"] .app-sidebar-student {
    background: linear-gradient(180deg, #4d2f63 0%, #3d2450 100%) !important;
  }
  html[data-acadcon-template="plum"] .user-menu .user-header.text-bg-secondary {
    background: linear-gradient(135deg, #6a3f89 0%, #8f5ab1 100%) !important;
    color: #fff !important;
  }
  html[data-acadcon-template="plum"] #acadconHeaderCanvas .user-header {
    background: linear-gradient(135deg, #6a3f89 0%, #8f5ab1 100%) !important;
    color: #fff !important;
  }
  html[data-acadcon-template="plum"] #chat-unread-filter-all.btn,
  html[data-acadcon-template="plum"] #chat-unread-filter-unread.btn,
  html[data-acadcon-template="plum"] #teacher-notif-filter-all.btn,
  html[data-acadcon-template="plum"] #teacher-notif-filter-unread.btn {
    border-color: #7a4ba0;
    color: #7a4ba0;
    background: #f6edff;
  }
  html[data-acadcon-template="plum"] #chat-unread-filter-all.btn.active,
  html[data-acadcon-template="plum"] #chat-unread-filter-unread.btn.active,
  html[data-acadcon-template="plum"] #teacher-notif-filter-all.btn.active,
  html[data-acadcon-template="plum"] #teacher-notif-filter-unread.btn.active {
    background: #7a4ba0;
    border-color: #7a4ba0;
    color: #fff;
  }
  html[data-acadcon-template="custom"] .app-sidebar-student {
    background: linear-gradient(180deg, var(--acadcon-sidebar-start, #1f2937) 0%, var(--acadcon-sidebar-end, #111827) 100%) !important;
  }
  html[data-acadcon-template="custom"] .user-menu .user-header.text-bg-secondary {
    background: linear-gradient(135deg, var(--acadcon-profile-start, #374151) 0%, var(--acadcon-profile-end, #1f2937) 100%) !important;
    color: var(--acadcon-text-color, #ffffff) !important;
  }
  html[data-acadcon-template="custom"] #acadconHeaderCanvas .user-header {
    background: linear-gradient(135deg, var(--acadcon-profile-start, #374151) 0%, var(--acadcon-profile-end, #1f2937) 100%) !important;
    color: var(--acadcon-text-color, #ffffff) !important;
  }
  html[data-acadcon-template="custom"] .app-sidebar-student .brand-text,
  html[data-acadcon-template="custom"] .app-sidebar-student .nav-link,
  html[data-acadcon-template="custom"] .app-sidebar-student .nav-icon,
  html[data-acadcon-template="custom"] .app-sidebar-student .dropdown-item-title {
    color: var(--acadcon-text-color, #ffffff) !important;
  }
  html[data-acadcon-template="custom"] #chat-unread-filter-all.btn,
  html[data-acadcon-template="custom"] #chat-unread-filter-unread.btn,
  html[data-acadcon-template="custom"] #teacher-notif-filter-all.btn,
  html[data-acadcon-template="custom"] #teacher-notif-filter-unread.btn {
    border-color: var(--acadcon-accent, #3b82f6);
    color: var(--acadcon-text-color, #1f2937);
    background: var(--acadcon-filter-bg, #eef4ff);
  }
  html[data-acadcon-template="custom"] #chat-unread-filter-all.btn.active,
  html[data-acadcon-template="custom"] #chat-unread-filter-unread.btn.active,
  html[data-acadcon-template="custom"] #teacher-notif-filter-all.btn.active,
  html[data-acadcon-template="custom"] #teacher-notif-filter-unread.btn.active {
    background: var(--acadcon-accent, #3b82f6);
    border-color: var(--acadcon-accent, #3b82f6);
    color: #fff;
  }
  /* Actions pill is positioned relative to the whole message set (attachments + bubble). */
  .direct-chat-msg{ position: relative; }
  .direct-chat-msg .chat-msg-actions {
    display: none;
    position: absolute;
    top: var(--chat-set-mid, 50%);
    left: calc(var(--chat-set-right, 0px) + 10px); /* received: to the right of the set */
    transform: translateY(-50%);
    gap: 6px;
    align-items: center;
    padding: 2px 6px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(2px);
  }
  .direct-chat-msg.end .chat-msg-actions {
    left: calc(var(--chat-set-left, 0px) - 10px); /* sent: to the left of the set */
    transform: translate(-100%, -50%);
  }
  /* Sender bubble is primary (blue) so use a lighter pill bg */
  .direct-chat-msg.end .direct-chat-text .chat-msg-actions {
    background: rgba(255, 255, 255, 0.22);
  }
  .direct-chat-msg:hover .chat-msg-actions {
    display: inline-flex;
  }
  .direct-chat-msg.chat-msg-actions-open .chat-msg-actions {
    display: inline-flex;
  }
  /* Make icons clearly visible (override any `text-muted` on the buttons) */
  .direct-chat-text .chat-msg-actions .btn,
  .direct-chat-text .chat-msg-actions .btn.text-muted {
    opacity: 1;
    line-height: 1;
  }
  .direct-chat-text .chat-msg-actions i {
    font-size: 1.05rem;
  }
  /* Semantic colors per action */
  .direct-chat-text .chat-msg-actions .chat-msg-action-delete { color: var(--bs-danger) !important; }
  .direct-chat-text .chat-msg-actions .chat-msg-action-edit { color: var(--bs-secondary) !important; }
  .direct-chat-text .chat-msg-actions .chat-msg-action-save { color: var(--bs-success) !important; }
  .direct-chat-text .chat-msg-actions .chat-msg-action-cancel { color: var(--bs-danger) !important; }

  /* Fallback: if any action button doesn't have a specific class */
  .direct-chat-text .chat-msg-actions .btn { color: rgba(0,0,0,.85); }
  .direct-chat-text .chat-msg-actions {
    box-shadow: 0 2px 10px rgba(0,0,0,.25);
  }
  .direct-chat-msg.end .direct-chat-text .chat-msg-actions {
    box-shadow: 0 2px 10px rgba(0,0,0,.35);
  }
  /* Ensure the side action pill isn't clipped */
  .direct-chat-text { overflow: visible !important; }
  /* Save (✓) + Cancel (X) only during edit mode.
     Actions are moved to `.direct-chat-msg` on load, so key off the wrapper. */
  .direct-chat-msg.chat-editing .chat-msg-action-edit,
  .direct-chat-msg.chat-editing .chat-msg-action-delete {
    display: none !important;
  }
  .direct-chat-msg:not(.chat-editing) .chat-msg-action-save,
  .direct-chat-msg:not(.chat-editing) .chat-msg-action-cancel {
    display: none !important;
  }
  .direct-chat-text .chat-msg-text {
    white-space: inherit;
  }
  /* Make chat bubbles thinner (less padding) */
  :root{
    --chat-side-gap: 50px; /* bubble offset from edge */
    --chat-avatar-size: 40px; /* AdminLTE .direct-chat-img */
    /* We want bubbles aligned with the name start, not after the avatar. */
    --chat-bubble-gap: calc(var(--chat-side-gap) - var(--chat-avatar-size)); /* 50 - 40 = 10 */
  }
  /* Align name line with bubble start/end (including text-only) */
  .direct-chat-msg .direct-chat-infos{
    padding-left: var(--chat-side-gap, 50px) !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  .direct-chat-msg.end .direct-chat-infos{
    padding-left: 0 !important;
    padding-right: var(--chat-side-gap, 50px) !important;
  }
  /* Keep AdminLTE/Bootstrap float-start/end for names */
  .direct-chat-msg:not(.end) .direct-chat-name.float-start{
    padding-left: var(--chat-name-offset) !important;
  }
  .direct-chat-msg.end .direct-chat-name.float-end{
    padding-right: var(--chat-name-offset) !important;
  }
  .direct-chat-text {
    padding: 4px 6px !important;
    max-width: 35% !important;
    min-height: 0 !important;
    line-height: 1.2;
    width: auto !important;
    display: inline-flex !important;
    align-items: center;
    margin-left: var(--chat-bubble-gap, 10px) !important;
  }
  .direct-chat-msg.end .direct-chat-text {
    margin-left: 0 !important;
    margin-right: var(--chat-bubble-gap, 10px) !important;
  }
  /* When avatar becomes absolutely positioned (attachments), revert to full side gap */
  .direct-chat-msg.has-attachments .direct-chat-text{
    margin-left: var(--chat-side-gap, 50px) !important;
  }
  .direct-chat-msg.end.has-attachments .direct-chat-text{
    margin-right: var(--chat-side-gap, 50px) !important;
  }
  @media (max-width: 767.98px) {
    .direct-chat-text {
      max-width: 65% !important;
      margin-left: var(--chat-bubble-gap, 10px) !important;
    }
    .direct-chat-msg.end .direct-chat-text {
      margin-right: var(--chat-bubble-gap, 10px) !important;
    }
    .direct-chat-msg.has-attachments .direct-chat-text{
      margin-left: var(--chat-side-gap, 50px) !important;
    }
    .direct-chat-msg.end.has-attachments .direct-chat-text{
      margin-right: var(--chat-side-gap, 50px) !important;
    }
  }
  .direct-chat-attachment {
    display: inline-block;
    width: fit-content;
    clear: both;
    max-width: 35%;
    margin: 5px 0 0 var(--chat-bubble-gap, 10px);
    float: left;
  }
  .direct-chat-attachment + .direct-chat-text {
    clear: both;
  }
  .direct-chat-msg.end .direct-chat-attachment {
    float: right;
    margin: 5px var(--chat-bubble-gap, 10px) 0 0;
    margin-left: 0;
  }
  .direct-chat-msg.has-attachments .direct-chat-attachment{
    margin-left: var(--chat-side-gap, 50px);
  }
  .direct-chat-msg.end.has-attachments .direct-chat-attachment{
    margin-right: var(--chat-side-gap, 50px);
  }
  .direct-chat-msg:not(.end) .direct-chat-attachment {
    margin-right: 0;
  }
  /* When a message has attachments, anchor avatar precisely */
  .direct-chat-msg.has-attachments{
    position: relative;
  }
  .direct-chat-msg.has-attachments .direct-chat-img{
    position: absolute;
    left: 0;
    top: var(--avatar-top, 0px);
    float: none !important;
  }
  .direct-chat-msg.end.has-attachments .direct-chat-img{
    left: auto;
    right: 0;
  }
  @media (max-width: 767.98px) {
    .direct-chat-attachment {
      max-width: 65%;
      margin-left: var(--chat-bubble-gap, 10px);
    }
    .direct-chat-msg.end .direct-chat-attachment {
      margin-right: var(--chat-bubble-gap, 10px);
    }
    .direct-chat-msg.has-attachments .direct-chat-attachment{
      margin-left: var(--chat-side-gap, 50px);
    }
    .direct-chat-msg.end.has-attachments .direct-chat-attachment{
      margin-right: var(--chat-side-gap, 50px);
    }
  }
  .direct-chat-text.chat-msg-actions-only {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }
  .direct-chat-text.chat-msg-actions-only .chat-msg-text {
    display: none !important;
  }
  .direct-chat-text.chat-msg-actions-only::before,
  .direct-chat-text.chat-msg-actions-only::after {
    display: none !important;
  }
  .chat-attachment-file {
    max-width: 260px;
  }
  .chat-attachment-file span {
    display: inline-block;
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .chat-msg-attachment {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
  }
  .direct-chat-text.chat-msg-attachment-only {
    padding: 4px 6px !important;
    min-height: 0 !important;
    display: inline-flex !important;
    flex-direction: column;
    width: auto !important;
    max-width: 55% !important;
  }
  .direct-chat-text.chat-msg-attachment-only .chat-msg-text {
    display: none !important;
  }
  .direct-chat-text.chat-msg-attachment-only .chat-msg-attachment {
    margin-bottom: 0 !important;
  }
  .chat-attachment-img {
    display: inline-block;
    text-decoration: none;
  }
  .chat-attachment-img img {
    display: block;
    max-width: 180px;
    max-height: 120px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,.08);
  }
  .chat-attachment-file {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,.08);
    background: #fff;
    color: #212529;
    text-decoration: none;
  }
  .chat-attachment-file:visited,
  .chat-attachment-file:hover,
  .chat-attachment-file:active {
    color: #212529;
  }
  .chat-attachment-file .text-muted {
    color: #6c757d !important;
  }
  .chat-attachment-file i {
    font-size: 1rem;
  }
  .chat-attachment-list .chat-attachment-pill {
    max-width: 100%;
  }
  .direct-chat-text textarea.chat-msg-editor {
    width: 100%;
    min-width: 240px;
    max-width: 100%;
    resize: vertical;
    border: 1px solid rgba(0,0,0,.15);
    border-radius: 6px;
    padding: 6px 8px;
    font: inherit;
    line-height: inherit;
    background: rgba(255,255,255,.9);
  }

  /* Deleted message: no bubble background/arrow */
  .direct-chat-text.chat-msg-deleted,
  .end .direct-chat-text.chat-msg-deleted {
    background: transparent !important;
    border-color: transparent !important;
  }
  .direct-chat-text.chat-msg-deleted::after,
  .direct-chat-text.chat-msg-deleted::before {
    display: none !important;
  }
  .direct-chat-text.chat-msg-deleted .chat-msg-text {
    color: var(--bs-body-color) !important;
    opacity: 0.75;
  }

  /* Online indicator (messages list, roster, etc.) */
  .online-dot{
    display:inline-block;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--bs-secondary-bg);
    border: 1px solid rgba(0,0,0,.15);
    opacity: .25; /* offline */
    flex: 0 0 auto;
  }
  .online-dot.is-online{
    background: var(--bs-success);
    border-color: rgba(0,0,0,.15);
    opacity: 1;
    box-shadow: 0 0 0 2px rgba(25,135,84,.15);
  }

  /* Chat header avatar/initial: prevent flex shrink on small screens */
  .profile-initial-chathead,
  .direct-chat .card-header .img-size-50,
  .direct-chat .card-header img.img-size-50 {
    flex: 0 0 auto !important;
    width: 50px;
    height: 50px;
    min-width: 50px;
    min-height: 50px;
  }
  .profile-initial-chathead {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
  }

  /* Header dropdown avatar: keep it small (prevents huge image in user menu) */
  .user-menu .user-header .user-header-avatar {
    width: 96px;
    height: 96px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 2.5rem;
    border-radius: 999px;
    object-fit: cover;
  }

  /* Mobile offcanvas header panel: keep profile avatar small even when menu is moved out of `.user-menu` */
  #acadconHeaderCanvas .user-header-avatar {
    width: 96px !important;
    height: 96px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 2.5rem;
    border-radius: 999px;
    object-fit: cover;
  }
  #acadconHeaderCanvas .user-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: .5rem;
    padding: 1rem;
  }
  #acadconHeaderCanvas .user-footer {
    display: flex;
    gap: .75rem;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    background: var(--bs-light-bg, #f8f9fa);
  }
  #acadconHeaderCanvas .user-footer::after {
    display: none !important; /* offcanvas uses flex; no clearfix needed */
  }
  #acadconHeaderCanvas .user-footer .btn {
    flex: 1 1 0;
    white-space: nowrap;
  }
  #acadconHeaderCanvas .user-footer .float-end {
    float: none !important;
    margin-left: 0 !important;
  }

  /* Chat header dropdown toggle: hide caret (more "clickable header" look) */
  .chat-header-dropdown-toggle.dropdown-toggle::after{
    display: none !important;
  }

  /* Mobile header offcanvas should be true full-screen */
  @media (max-width: 767.98px) {
    #acadconHeaderCanvas.offcanvas {
      --bs-offcanvas-width: 100vw;
      width: 100vw !important;
      max-width: 100vw !important;
      border-left: 0 !important;
    }
    #acadconHeaderCanvas.offcanvas.offcanvas-end {
      left: 0 !important; /* ensure it spans full width */
      right: 0 !important;
    }
    #acadconHeaderCanvas .offcanvas-header {
      padding-left: 1rem;
      padding-right: 1rem;
    }
    #acadconHeaderCanvas .offcanvas-body {
      padding: 0 !important;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }
  }

  /* Prevent avatar stretching everywhere (crop instead of distort) */
  img.user-image,
  img.brand-image,
  img.direct-chat-img,
  img.img-size-40,
  img.img-size-50,
  .user-menu .user-header img.user-header-avatar,
  .direct-chat .card-header img.img-size-50 {
    object-fit: cover !important;
    object-position: center !important;
    aspect-ratio: 1 / 1;
  }

  /* Utility: allow flex children to shrink (Bootstrap doesn't include min-w-0) */
  .min-w-0 { min-width: 0 !important; }

  /* Mobile: ensure Bootstrap modals are scrollable (AdminLTE fixed layout can interfere) */
  @media (max-width: 767.98px) {
    .modal { overscroll-behavior: contain; }
    .modal-dialog.modal-dialog-scrollable { height: calc(100% - 1rem) !important; }
    .modal-dialog.modal-dialog-scrollable .modal-content {
      max-height: calc(100vh - 1rem) !important;
      display: flex !important;
      flex-direction: column !important;
    }
    .modal-dialog.modal-dialog-scrollable .modal-header,
    .modal-dialog.modal-dialog-scrollable .modal-footer {
      flex: 0 0 auto !important;
    }
    .modal-dialog.modal-dialog-scrollable .modal-body {
      flex: 1 1 auto !important;
      min-height: 0 !important;
      overflow-y: auto !important;
      -webkit-overflow-scrolling: touch;
      touch-action: pan-y;
    }

    /* Fullscreen-on-mobile scrollable modal */
    .modal-dialog.modal-fullscreen-sm-down.modal-dialog-scrollable {
      height: 100% !important;
      margin: 0 !important;
    }
    .modal-dialog.modal-fullscreen-sm-down.modal-dialog-scrollable .modal-content {
      height: 100% !important;
      max-height: 100% !important;
      display: flex !important;
      flex-direction: column !important;
    }
  }

  /* Unread messages dropdown highlight (similar to teacher notifications) */
  #chat-unread-list a[data-unread-open][data-unread="1"] {
    position: relative;
    background: rgba(255, 193, 7, .22) !important; /* stronger warning tint */
  }
  #chat-unread-list a[data-unread-open][data-unread="1"]::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: rgba(255, 193, 7, .95);
  }
  #chat-unread-list a[data-unread-open][data-unread="1"]:hover,
  #chat-unread-list a[data-unread-open][data-unread="1"]:focus {
    background: rgba(255, 193, 7, .28) !important;
  }
  #chat-unread-list a[data-unread-open][data-unread="1"] .chat-unread-dot {
    display: inline-block;
  }
  .chat-unread-dot {
    display: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 193, 7, .95);
    box-shadow: 0 0 0 2px rgba(255, 193, 7, .18);
  }

  /* Messages dropdown: avatar next to each thread */
  #chat-unread-list .chat-unread-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.06);
    border: 1px solid rgba(0,0,0,.10);
    margin-top: 2px;
  }
  #chat-unread-list .chat-unread-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
  #chat-unread-list .chat-unread-avatar-initial {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: .95rem;
    color: rgba(0,0,0,.75);
    text-transform: uppercase;
  }

  /* Unread highlight in the consultations list (teacher/messages list items) */
  a.list-group-item.chat-unread-row {
    position: relative;
    background: rgba(255, 193, 7, .10) !important;
    font-weight: 600; /* make unread rows stand out */
  }
  a.list-group-item.chat-unread-row .fw-semibold {
    font-weight: 800 !important;
  }
  a.list-group-item.chat-unread-row .text-muted {
    opacity: 1;
  }
  a.list-group-item.chat-unread-row::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: rgba(255, 193, 7, .95);
  }
  a.list-group-item.chat-unread-row:hover,
  a.list-group-item.chat-unread-row:focus {
    background: rgba(255, 193, 7, .14) !important;
  }

  /* Responsive header dropdowns (Messages + Notifications) */
  #chat-unread-list,
  #teacher-notif-list,
  #student-notif-list,
  #code-user-notif-list {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
  }

  /* Pagination button styling */
  #chat-unread-list .see-older-btn,
  #teacher-notif-list .see-older-btn,
  #student-notif-list .see-older-btn,
  #code-user-notif-list .see-older-btn {
    cursor: pointer;
    padding: 0.75rem 1rem;
    text-align: center;
    color: #0d6efd;
    font-size: 0.875rem;
    border: none;
    background: none;
  }

  #chat-unread-list .see-older-btn:hover,
  #teacher-notif-list .see-older-btn:hover,
  #student-notif-list .see-older-btn:hover,
  #code-user-notif-list .see-older-btn:hover {
    background-color: #f0f0f0;
    text-decoration: underline;
  }

  @media (max-width: 767.98px) {
    /* Primary target: our header dropdown menus (messages + notifications) */
    .app-header .acadcon-header-menu {
      min-width: 0 !important;
      width: calc(100vw - 1rem) !important;
      max-width: calc(100vw - 1rem) !important;
      /* AdminLTE sets .dropdown-menu-lg max-width:300px; override */
      max-height: calc(100vh - 4.25rem) !important;
      z-index: 2000 !important;
      /* Beat Popper inline positioning so menus don't overflow the viewport */
      position: fixed !important;
      left: .5rem !important;
      right: .5rem !important;
      top: calc(3.25rem + env(safe-area-inset-top, 0px)) !important; /* below sticky header */
      transform: none !important;
      inset: auto !important;
    }

    /* Back-compat (in case IDs exist but class doesn't for some reason) */
    #chat-unread-menu,
    #teacher-notif-menu,
    #student-notif-menu,
    #code-user-notif-menu {
      min-width: 0 !important;
      width: calc(100vw - 1rem) !important;
      max-width: calc(100vw - 1rem) !important;
      max-height: calc(100vh - 4.25rem) !important;
      z-index: 2000 !important;
      position: fixed !important;
      left: .5rem !important;
      right: .5rem !important;
      top: calc(3.25rem + env(safe-area-inset-top, 0px)) !important;
      transform: none !important;
      inset: auto !important;
    }

    #chat-unread-list,
    #teacher-notif-list,
    #student-notif-list,
    #code-user-notif-list {
      max-height: 60vh;
      overflow: auto;
    }
    #teacher-notif-menu .dropdown-item.dropdown-header,
    #student-notif-menu .dropdown-item.dropdown-header,
    #code-user-notif-menu .dropdown-item.dropdown-header,
    #chat-unread-menu .dropdown-item.dropdown-header {
      white-space: normal;
    }

    /* Student invitation buttons: allow wrapping on narrow screens */
    #student-notif-list .d-flex.gap-2.mt-2,
    #code-user-notif-list .d-flex.gap-2.mt-2 {
      flex-wrap: wrap;
    }
    #student-notif-list .d-flex.gap-2.mt-2 > form,
    #code-user-notif-list .d-flex.gap-2.mt-2 > form {
      flex: 1 1 140px;
    }

    /* Absolute fallback: any large dropdown in the header should be full-width on mobile */
    .app-header .dropdown-menu.dropdown-menu-lg {
      min-width: 0 !important;
      width: calc(100vw - 1rem) !important;
      max-width: none !important; /* beat AdminLTE .dropdown-menu-lg max-width:300px */
      position: fixed !important;
      left: .5rem !important;
      right: .5rem !important;
      transform: none !important;
      inset: auto !important;
      z-index: 2000 !important;
    }
  }

  /* Legacy crop UI styles (crop flow is currently disabled in JS) */
  .profile-crop-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #111;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,.08);
  }
  .profile-crop-frame > img#cropAvatarImage {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    user-select: none;
    -webkit-user-drag: none;
    touch-action: none;
    max-width: none;
    max-height: none;
  }
  .profile-crop-zoom {
    width: 100%;
  }

  /* Crop modal: circular mask overlay like the reference */
  .avatar-crop-wrap {
    position: relative;
    width: 100%;
    max-width: 420px;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    background: #f1f3f5;
    border-radius: 8px;
    overflow: hidden;
  }
  .avatar-crop-wrap img#cropAvatarImage {
    display: block;
    width: 100%;
    height: 100%;
    max-height: none;
  }
  .avatar-crop-mask {
    pointer-events: none;
    position: absolute;
    inset: 0;
    /* Dim outside a perfect inscribed circle (matches crop area's edges) */
    background: radial-gradient(circle closest-side at center, rgba(0,0,0,0) 99%, rgba(0,0,0,.55) 100%);
  }
  /* Cropper.js: make the actual crop box perfectly circular and handle non-square images robustly */
  .avatar-crop-wrap .cropper-container,
  .avatar-crop-wrap .cropper-wrap-box,
  .avatar-crop-wrap .cropper-canvas {
    width: 100% !important;
    height: 100% !important;
  }
  .avatar-crop-wrap .cropper-crop-box,
  .avatar-crop-wrap .cropper-view-box,
  .avatar-crop-wrap .cropper-face {
    border-radius: 999px !important;
  }
  /* Dim everything outside the circle (prevents misaligned overlay issues on non-square images) */
  .avatar-crop-wrap .cropper-crop-box {
    box-shadow: 0 0 0 9999px rgba(0,0,0,.55) !important;
  }
  .avatar-crop-wrap .cropper-view-box {
    outline: 2px solid rgba(255,255,255,.85);
    outline-offset: -2px;
  }
  /* Hide the old fixed mask overlay; cropper box-shadow handles the dim correctly */
  .avatar-crop-wrap .avatar-crop-mask {
    display: none;
  }

  /* Profile change-password: never show invalid-feedback until validation is triggered */
  #profile-password-form .invalid-feedback {
    display: none !important;
  }
  #profile-password-form.was-validated :invalid ~ .invalid-feedback,
  #profile-password-form.was-validated .is-invalid ~ .invalid-feedback {
    display: block !important;
  }
  /* Keep password eye button aligned even when validation feedback is shown */
  #profile-password-form .input-group {
    flex-wrap: wrap;
    align-items: stretch;
  }
  #profile-password-form .input-group > .form-control {
    min-width: 0; /* allow shrink instead of wrapping the button */
  }
  #profile-password-form .input-group > .invalid-feedback {
    flex: 0 0 100%;
    order: 3;
    margin-top: .25rem;
  }
  /* Match rounded corners on the right edge of the eye button */
  #profile-password-form .input-group > button.btn[data-toggle-password] {
    border-top-right-radius: var(--bs-border-radius) !important;
    border-bottom-right-radius: var(--bs-border-radius) !important;
  }

  /* =========================
     Acadcon: Searchbox UI
     ========================= */
  .acad-search {
    width: 100%;
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .45rem .6rem;
    border: 1px solid var(--bs-border-color, rgba(0,0,0,.12));
    border-radius: 999px;
    background: var(--bs-body-bg, #fff);
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
  }
  .acad-search:focus-within {
    border-color: rgba(var(--bs-primary-rgb, 13,110,253), .55);
    box-shadow: 0 0 0 .22rem rgba(var(--bs-primary-rgb, 13,110,253), .14);
  }
  .acad-search .acad-search-icon {
    color: var(--bs-secondary-color, rgba(0,0,0,.55));
    font-size: 1rem;
    flex: 0 0 auto;
    margin-left: .15rem;
  }
  .acad-search .acad-search-input {
    flex: 1 1 auto;
    min-width: 0;
  }
  .acad-search .form-control,
  .acad-search .form-control:focus {
    border: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0 !important;
    height: auto !important;
  }
  .acad-search .acad-search-clear {
    border: 0 !important;
    background: transparent !important;
    padding: 0 .2rem !important;
    line-height: 1;
    color: var(--bs-secondary-color, rgba(0,0,0,.55)) !important;
    display: none;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    cursor: pointer;
  }
  .acad-search .acad-search-clear:hover {
    color: rgba(var(--bs-primary-rgb, 13,110,253), .95) !important;
  }
  .acad-search[data-has-value="1"] .acad-search-clear {
    display: inline-flex;
  }
  .acad-search--sm {
    padding: .35rem .55rem;
  }
  .acad-search--sm .acad-search-icon {
    font-size: .95rem;
  }
  .acad-search--sidebar {
    border-radius: 12px;
    padding: .35rem .55rem;
    background: rgba(255,255,255,.08);
    border-color: rgba(255,255,255,.18);
  }
  .acad-search--sidebar:focus-within {
    border-color: rgba(255,255,255,.35);
    box-shadow: 0 0 0 .20rem rgba(255,255,255,.12);
  }
  .acad-search--sidebar .form-control {
    color: rgba(255,255,255,.92) !important;
  }
  .acad-search--sidebar .form-control::placeholder {
    color: rgba(255,255,255,.65) !important;
  }
  .acad-search--sidebar .acad-search-icon,
  .acad-search--sidebar .acad-search-clear {
    color: rgba(255,255,255,.75) !important;
  }
.acadcon-login-brand {
line-height: 1.15;
}
.acadcon-login-logo {
display: block;
margin: 0 auto;
object-fit: contain;
}
.acadcon-login-title {
font-family: Georgia, 'Times New Roman', Times, serif;
font-size: 1rem;
font-weight: 700;
color: #00334d;
text-align: center;
}