/* =====================================================
   Tanglaw - LAYOUT CSS (Topbars, Sidebars, Containers)
   ===================================================== */

/* ----------------------------- */
/* TOP BAR                       */
/* ----------------------------- */
.topbar {
    width: 100%;
    height: 60px;
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar .logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
}

.topnav a {
    margin-left: 18px;
    font-size: 0.95rem;
    color: var(--gray-700);
    font-weight: 500;
}

.topnav a.active {
    color: var(--primary);
    font-weight: 700;
}

/* Topbar user area (avatar + username) */
.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-avatar {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    object-fit: cover;
}


/* -------------------------------------- */
/* Notifications (topbar bell + dropdown) */
/* -------------------------------------- */

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* ----------------------------- */
/* Theme switcher (topbar)      */
/* ----------------------------- */
.theme-wrapper {
    position: relative;
}

.theme-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.1s ease;
    color: var(--text-main);
}

.theme-btn:hover {
    background: var(--surface-2);
    transform: translateY(-1px);
}

.theme-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.theme-current {
    display: none;
}

@media (min-width: 720px) {
    .theme-current {
        display: inline;
        font-size: 0.82rem;
        margin-left: 6px;
        color: var(--text-muted);
        font-weight: 700;
        letter-spacing: 0.2px;
    }
}

.theme-dropdown {
    position: absolute;
    right: 0;
    top: 125%;
    min-width: 260px;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 6px;
    z-index: 1600;
}

.theme-dropdown.open {
    display: flex;
}

.theme-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-md);
    background: var(--surface-3);
    border: 1px solid var(--border);
    color: var(--text-main);
    font-size: 0.86rem;
    cursor: pointer;
}

.theme-item:hover {
    background: var(--surface-2);
}

.theme-item-left {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.theme-name {
    font-weight: 750;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.theme-tag {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.35px;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    background: var(--chip-bg);
}

.theme-swatch {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: 0 0 auto;
}

.theme-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
}


.notif-wrapper {
    position: relative;
}

.notif-icon {
    position: relative;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 6px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.1s ease;
}

.notif-icon:hover {
    background: var(--surface-2);
    transform: translateY(-1px);
}

.notif-icon-symbol {
    font-size: 1.2rem;
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notif-dropdown {
    position: absolute;
    right: 0;
    top: 125%;
    width: 280px;
    max-height: 360px;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    padding: 8px 0;
    display: none;
    flex-direction: column;
    z-index: 1500;
}

.notif-dropdown.open {
    display: flex;
}

.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 12px 4px;
    border-bottom: 1px solid var(--border);
}

.notif-header span {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.notif-clear-btn {
    border: none;
    background: none;
    font-size: 0.75rem;
    color: var(--primary-600);
    cursor: pointer;
    padding: 2px 4px;
}

.notif-clear-btn:hover {
    text-decoration: underline;
}

.notif-list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
    overflow-y: auto;
}

.notif-item {
    padding: 8px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item.notif-footer{
    border-bottom: none;
    background: var(--surface-2);
}
.notif-item.notif-footer:hover{
    background: var(--surface);
}


.notif-item:hover {
    background: var(--surface-2);
}

.notif-item.unread {
    background: var(--notif-unread-bg);
}

.notif-item-type {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--primary-600);
}

.notif-item-message {
    color: var(--text-main);
}

.notif-item-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ----------------------------- */
/* MOBILE: NOTIFICATION DROPDOWN  */
/* Turns into a sheet on phones.  */
/* ----------------------------- */
@media (max-width: 640px) {
    .notif-dropdown{
        position: fixed;
        left: 12px;
        right: 12px;
        top: 64px;
        width: auto;
        max-height: calc(100vh - 84px);
        border-radius: var(--radius-xl);
        padding: 10px 0;
    }
    .notif-header{
        padding: 8px 14px 6px;
    }
    .notif-list{
        max-height: calc(100vh - 140px);
    }
    /* Improve touch targets */
    .notif-item{
        padding: 12px 14px;
    }
    .notif-clear-btn{
        padding: 8px 10px;
        border-radius: 10px;
        background: var(--surface-2);
        border: 1px solid var(--border);
    }
    .notif-clear-btn:hover{
        text-decoration: none;
    }
}



/* ----------------------------- */
/* PAGE CONTAINER WRAPPER        */
/* ----------------------------- */
.layout-container {
    display: flex;
    width: 100%;
    height: calc(100vh - 60px);
    overflow: hidden;
}

/* ----------------------------- */
/* LEFT SIDEBAR                  */
/* ----------------------------- */
.sidebar-left {
    width: 280px;
    background: var(--bg-white);
    border-right: 1px solid var(--border);
    padding: 20px;
    overflow-y: auto;
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--gray-800);
}

.sidebar-subtitle {
    font-size: 0.85rem;
    font-weight: 600;
    margin: 15px 0 8px;
    color: var(--gray-600);
}

/* search box inside sidebar */
.search-box input {
    width: 100%;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    background: var(--gray-50);
    border: 1px solid var(--border);
    margin-bottom: 15px;
}

.user-list li,
.student-list li,
.conversation-list li {
    padding: 10px;
    border-radius: var(--radius-md);
    background: var(--gray-50);
    margin-bottom: 10px;
    cursor: pointer;
    transition: 0.2s;

    /* global alignment for avatar + label */
    display: flex;
    align-items: center;
    gap: 10px;
}

.conversation-unread-badge {
    display: inline-block;
    min-width: 18px;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    background: var(--primary-hover);
    color: #fff;
    margin-left: 4px;
}



.user-list li:hover,
.student-list li:hover {
    background: var(--gray-100);
}

/* Presence pills for online/offline */
.presence-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    border: 1px solid var(--border);
}

.presence-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    display: inline-block;
}

/* default = offline */
.presence-pill.offline {
    background: var(--gray-50);
    color: var(--gray-500);
}

.presence-pill.offline .presence-dot {
    background: var(--gray-300);
}

/* online state */
.presence-pill.online {
    background: var(--success-soft);
    color: var(--success);
    border-color: var(--success-border-soft);
}

.presence-pill.online .presence-dot {
    background: var(--success);
}

/* busy state */
.presence-pill.busy {
    background: color-mix(in srgb, var(--warning) 18%, var(--surface-2, #fff));
    color: var(--warning);
    border-color: color-mix(in srgb, var(--warning) 35%, var(--border));
}

.presence-pill.busy .presence-dot {
    background: var(--warning);
}




/* ----------------------------- */
/* CHAT WINDOW STRUCTURE         */
/* ----------------------------- */
.chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-main);
    position: relative;
}

/* Header */
.chat-header {
    height: 60px;
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    padding: 0 15px;
    gap: 15px;
}

.chat-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

.back-btn {
    font-size: 1.2rem;
    background: none;
    color: var(--gray-600);
}

.chat-options {
    margin-left: auto;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Message search (Phase 2.3) */
.chat-header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}
.chat-header-icon-btn {
    border: 1px solid var(--border);
    background: var(--gray-50);
    color: var(--gray-700);
    border-radius: var(--radius-md);
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.95rem;
}
.chat-header-icon-btn:hover {
    filter: brightness(0.98);
}
.chat-search-bar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-white);
}
.chat-search-bar input {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--gray-50);
}
.chat-search-count {
    font-size: 0.85rem;
    color: var(--gray-600);
    white-space: nowrap;
}
.chat-search-nav, .chat-search-close {
    border: 1px solid var(--border);
    background: var(--gray-50);
    border-radius: var(--radius-md);
    padding: 7px 10px;
    cursor: pointer;
}
.chat-search-nav:hover, .chat-search-close:hover {
    filter: brightness(0.98);
}
mark.msg-highlight {
    background: rgba(255, 230, 0, 0.45);
    padding: 0 2px;
    border-radius: 3px;
}
.message.has-search-match .message-bubble {
    box-shadow: var(--shadow-sm);
}
.message.search-active-match .message-bubble {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Messages */
.chat-messages {
    flex: 1;
    min-height: 0;               /* para hindi mag-overflow sa flex container */
    padding: 20px;
    overflow-y: auto;            /* messages lang ang nag-i-scroll */
    display: flex;
    flex-direction: column;
    gap: 10px;
}


/* Message bubbles */
.message {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: var(--radius-lg);
    background: var(--gray-100);
    box-shadow: var(--shadow-sm);
    position: relative;
}

.message.sent {
    align-self: flex-end;
    background: var(--primary);
    color: #fff;
}

.message.received {
    align-self: flex-start;
    background: var(--gray-200);
}

.timestamp {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 4px;
}

/* Reply preview */
.reply-preview {
    background: var(--gray-200);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-left: 4px solid var(--primary);
}

.reply-preview button {
    font-size: 1.2rem;
    background: none;
    color: var(--gray-600);
}

/* Chat input */
.chat-input-bar {
    height: 65px;
    padding: 10px 15px;
    background: var(--bg-white);
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-sm);
}

.chat-input-bar input {
    flex: 1;
    padding: 10px;
    background: var(--gray-50);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.attach-btn,
.emoji-btn,
.send-btn {
    background: var(--primary);
    color: #fff;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
}

/* ----------------------------- */
/* SETTINGS LAYOUT (shared)      */
/* ----------------------------- */
.settings-layout {
    display: flex;
    width: 100%;
    height: calc(100vh - 60px);
}

.settings-menu {
    width: 260px;
    background: var(--bg-white);
    border-right: 1px solid var(--border);
    padding: 20px;
}

.settings-menu ul li {
    padding: 10px;
    margin-bottom: 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    background: var(--gray-50);
}

.settings-menu ul li.active {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}

.settings-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    background: var(--bg-main);
}

.settings-panel {
    max-width: 820px;
}

.hint {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.avatar-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.avatar-preview {
    width: 64px;
    height: 64px;
    border-radius: 999px;
    object-fit: cover;
    border: 1px solid var(--border);
    background: var(--surface-2);
}

.avatar-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

.form-status {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.form-status.ok {
    color: var(--success);
}

.form-status.err {
    color: var(--danger);
}

/* ----------------------------- */
/* SETTINGS (MOBILE)             */
/* ----------------------------- */
@media (max-width: 768px) {
    .settings-layout{
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 60px);
    }

    .settings-menu{
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 10px 12px;
    }

    .settings-menu ul{
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 6px;
        -webkit-overflow-scrolling: touch;
    }

    .settings-menu ul li{
        margin-bottom: 0;
        white-space: nowrap;
        flex: 0 0 auto;
        padding: 10px 12px;
    }

    .settings-content{
        padding: 16px;
    }

    .settings-panel{
        max-width: 100%;
    }

    .avatar-row{
        flex-direction: column;
        align-items: flex-start;
    }

    .form-actions{
        flex-direction: column;
        align-items: stretch;
    }

    .form-actions button{
        width: 100%;
    }

    .danger-zone button{
        width: 100%;
    }
}


/* Settings: theme grid */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.theme-card {
    width: 100%;
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px;
    cursor: pointer;
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
    transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.theme-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: 0 10px 26px rgba(0,0,0,0.45);
}

.theme-card.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary), 0 14px 30px var(--primary-shadow);
}

.theme-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.theme-card-title {
    font-weight: 800;
    letter-spacing: 0.2px;
}

.theme-card-tag {
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--chip-bg);
    color: var(--text-muted);
    font-weight: 700;
}

.theme-card-swatches {
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-card-swatches .theme-dot {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ----------------------------- */
/* TABLES (Admin)                */
/* ----------------------------- */
.admin-table {
    width: 100%;
    background: var(--bg-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.admin-table th {
    background: var(--surface-2);
    font-weight: 600;
}

.admin-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}


/* Removed temporarily */
/* .search-box {
    padding: 1px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-300);
    background: var(--gray-50);
} */


/* =====================================================
   CHAT HUB TABS (Mobile)
   Keeps the left hub clean: switch between lists.
   ===================================================== */
.chat-hub-tabs{
    display: none;
    gap: 8px;
    padding: 6px 0 10px;
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
}
.chat-hub-tab{
    appearance: none;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-main);
    border-radius: 999px;
    padding: 10px 12px;
    font-weight: 600;
    font-size: 0.85rem;
    min-height: 44px;
    flex: 1;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}
.chat-hub-tab:hover{ transform: translateY(-1px); }
.chat-hub-tab.active{
    background: var(--primary);
    color: white;
    border-color: transparent;
}

/* Conversation list item layout (user) */
.conversation-item{
    justify-content: space-between;
}
.conversation-main{
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}
.conversation-text{
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.conversation-name{
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-main);
    line-height: 1.2;
}
.conversation-last{
    color: var(--text-muted);
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.conversation-meta{
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 10px;
}
.conversation-time{
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Student list item layout (facilitator) */
.user-avatar img{
    width: 34px;
    height: 34px;
    border-radius: 999px;
    object-fit: cover;
    border: 1px solid var(--border);
    background: var(--surface-2);
    display: block;
}
.user-info{
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}
.user-meta{
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}
.user-info .user-name{
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-main);
    line-height: 1.2;
}
.user-info .last-active{
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* =====================================================
   PHASE 2.1: Conversation / Active Chats polish
   - unread highlighting
   - typing preview styling
   - skeleton loading rows
   ===================================================== */

.conversation-item.has-unread,
.student-item.has-unread {
    background: var(--gray-100);
}

.conversation-item.has-unread .conversation-name,
.student-item.has-unread .user-name {
    color: var(--text-main);
}

.conversation-item.has-unread .conversation-last,
.student-item.has-unread .last-active {
    color: var(--text-main);
}

.conversation-preview.typing {
    color: var(--primary);
    font-weight: 600;
}

/* Skeleton rows */
.skeleton-item {
    position: relative;
    overflow: hidden;
}
.skeleton-item .skeleton-avatar {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: var(--gray-100);
    border: 1px solid var(--border);
    flex-shrink: 0;
}
.skeleton-item .skeleton-line {
    height: 10px;
    border-radius: 6px;
    background: var(--gray-100);
    margin: 4px 0;
}
.skeleton-item .skeleton-pill {
    width: 60px;
    height: 16px;
    border-radius: 999px;
    background: var(--gray-100);
}
.skeleton-item .skeleton-badge {
    width: 22px;
    height: 16px;
    border-radius: 999px;
    background: var(--gray-100);
}
.skeleton-item.shimmer::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
    animation: shimmer 1.2s infinite;
}
@keyframes shimmer {
    to { transform: translateX(100%); }
}

/* =====================================================
   RESPONSIVE: CHAT LAYOUT (USER + FACILITATOR)
   ===================================================== */

/* Default (desktop/tablet): both sidebar + chat visible */
.chat-header .back-btn {
    display: none; /* sa maliliit na screen lang natin ipapakita */
}

@media (min-width: 769px) {
    .layout-container {
        flex-direction: row;
    }

    .sidebar-left {
        display: block;
    }

    .chat-window {
        display: flex;
    }

    .chat-header .back-btn {
        display: none;
    }
}

/* Mobile layout: Chat Hub vs Conversation view */
@media (max-width: 768px) {
    .chat-layout {
        flex-direction: column;
        height: 92%;                    /* umaasa lang sa .layout-container height */
    }

    .chat-layout .sidebar-left {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 12px 16px;

        display: flex;
        flex-direction: column;
        gap: 12px;
        max-height: 40%;                 /* list area lang, hindi buong screen */
        overflow-y: auto;                /* scroll list kung mahaba */
    }

    .chat-layout .chat-window {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;                   /* para magkasya sa loob ng layout-container */
    }

    /* STATE 1: Chat Hub (show list, hide chat) */
    .chat-layout.mobile-chat-list .sidebar-left {
        display: flex;
        max-height: 100%;                /* pwede siyang kumain ng height kapag list view lang */
    }

    .chat-layout.mobile-chat-list .chat-window {
        display: none;
    }

    /* STATE 2: Conversation (hide list, show chat full-screen) */
    .chat-layout.mobile-chat-conversation .sidebar-left {
        display: none;
    }

    .chat-layout.mobile-chat-conversation .chat-window {
        display: flex;
    }

    .chat-layout .chat-header .back-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-right: 8px;
    }

        /* Make topbar more compact on mobile */
    .topbar {
        padding: 0 10px;              /* mas maliit na side padding */
    }

    .topbar .logo {
        font-size: 1.1rem;            /* konting liit ng logo text */
    }

    .topnav a {
        margin-left: 10px;            /* bawas spacing sa pagitan ng links */
        font-size: 0.8rem;            /* paliitin para magkasya sa width */
    }

    .topbar-actions {
        gap: 8px;                     /* mas dikit ng konti notif + avatar */
    }

    /* Para di na sumikip: avatar na lang, hide username text sa topbar */
    .topbar-user span {
        display: none;
    }

    .top-avatar {
        width: 28px;    /*28*/
        height: 28px;
    }



/* Mobile hub tabs visibility + section switching */
.chat-hub-tabs{
    display: flex;
}

/* User chat: conversations/facilitators */
.chat-layout[data-active-hub="conversations"] .facilitators-section{
    display: none;
}
.chat-layout[data-active-hub="facilitators"] .conversations-section{
    display: none;
}

/* Facilitator chat: active/students */
.chat-layout[data-active-hub="active"] .facilitators-section{
    display: none;
}
.chat-layout[data-active-hub="students"] .conversations-section{
    display: none;
}

/* When only one section is shown, let it take the space */
.chat-layout .facilitators-section,
.chat-layout .conversations-section{
    flex: 1 1 auto;
}

}



/* FACILITATORS SECTION – mas maliit (around 35%) */
.chat-layout .facilitators-section {
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
    background: var(--surface-2);
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 8px 10px;

    flex: 0 0 35%;   /* ~35% ng sidebar height */
}

/* CONVERSATIONS SECTION – mas malaki, takes remaining space */
.chat-layout .conversations-section {
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
    background: var(--surface-2);
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 8px 10px;

    flex: 1 1 auto;  /* kukunin ang natitirang space */
}


/* Only the lists scroll */
.chat-layout .facilitators-section .user-list,
.chat-layout .conversations-section .conversation-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

/* Optional spacing */
.chat-layout .facilitators-section {
    margin-bottom: 12px;
}


.section-hint {
    font-size: 11px;
    color: var(--gray-500);
    margin-bottom: 4px;
    display: block;
}

.sidebar-title + .section-hint,
.sidebar-subtitle + .section-hint {
    margin-top: 2px;
}



.typing-indicator {
    font-size: 12px;
    color: var(--text-dim);
    margin: 4px 4px 0 4px;
}

.typing-indicator.hidden {
    display: none;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-dim);
}

.message-status {
    font-size: 11px;
    margin-left: 4px;
    color: var(--success);
}

.message-status.sending {
    color: var(--text-dim);
}

.message-status.failed {
    color: var(--danger);
    cursor: pointer;
}

/* =====================================================
   MOBILE NAV DRAWER (Topbar + Sidebar nav)
   Injected via JS (core/global.js)
   ===================================================== */

.topbar{ gap: 12px; }

.topbar-brand,
.topbar-left{
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.topbar-right{
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-end;
    min-width: 0;
}

.nav-toggle{
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.12s ease;
}

.nav-toggle:hover{
    background: var(--surface-3);
    transform: translateY(-1px);
}

/* Drawer overlay */
.mobile-drawer-backdrop{
    position: fixed;
    inset: 0;
    background: var(--overlay);
    display: none;
    align-items: stretch;
    justify-content: flex-start;
    z-index: 2000;
    padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
}

.mobile-drawer-backdrop.open{ display: flex; }

.mobile-drawer{
    width: min(360px, 86vw);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateX(-8px);
    animation: tlwDrawerIn 0.14s ease-out forwards;
}

@keyframes tlwDrawerIn{
    to{ transform: translateX(0); }
}

.mobile-drawer-header{
    padding: 14px 14px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 70%, transparent), transparent);
}

.mobile-drawer-user{
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.mobile-drawer-user .name{
    font-weight: 900;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 190px;
}

.mobile-drawer-user .sub{
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-dim);
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 210px;
}

.mobile-drawer-close{
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    transition: background 0.12s ease, transform 0.12s ease;
}

.mobile-drawer-close:hover{
    background: var(--surface-3);
    transform: translateY(-1px);
}

.mobile-drawer-links{
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: auto;
}

.mobile-drawer-links a{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-main);
    font-weight: 750;
    letter-spacing: 0.15px;
}

.mobile-drawer-links a:hover{
    background: var(--surface-3);
    border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
}

.mobile-drawer-links a.active{
    border-color: color-mix(in srgb, var(--primary) 72%, var(--border));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}

body.mobile-nav-open{
    overflow: hidden;
    touch-action: none;
}

/* Topbar behavior on small screens */
@media (max-width: 768px){
    .topnav{ display: none; }
    .nav-toggle{ display: inline-flex; }
    .topbar{ padding: 0 10px; }
    .topbar .logo{ font-size: 1.08rem; }
    .topbar-user #top-username{ display: none; }
        .topbar-right #top-username{ display: none; }
}


/* =====================================================
   SIDEBAR LAYOUT (Admin/Counselor)
   Pages using: .layout > .sidebar + .main-content
   ===================================================== */

.layout{
    display: flex;
    min-height: calc(100dvh - 60px);
    width: 100%;
}

/* Fallback for older browsers (no dvh) */
@supports not (height: 100dvh){
    .layout{ min-height: calc(100vh - 60px); }
}

.sidebar{
    width: 250px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 16px 12px;
    overflow-y: auto;
}

.sidebar-nav{
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-nav a{
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    color: var(--text-muted);
    font-weight: 700;
    background: transparent;
    transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}

.sidebar-nav a:hover{
    background: var(--surface-2);
    border-color: var(--border);
    transform: translateY(-1px);
    color: var(--text-main);
}

.sidebar-nav a.active{
    background: color-mix(in srgb, var(--primary) 18%, var(--surface-2));
    border-color: color-mix(in srgb, var(--primary) 48%, var(--border));
    color: var(--text-main);
}

.layout > .main-content{
    flex: 1;
    min-width: 0;
    overflow: auto;
}

/* Mobile: hide sidebar and rely on drawer */
@media (max-width: 768px){
    .layout{ min-height: auto; }
    .sidebar{ display: none; }
    .layout > .main-content{ padding: 16px; }
}


/* ===== Chat UX Polish (Phase 2.2) ===== */


/* Jump to latest button */
.jump-to-latest {
    position: absolute;
    right: 18px;
    bottom: 92px; /* above input bar */
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-main);
    user-select: none;
}

.jump-to-latest.visible {
    display: inline-flex;
}

.jump-to-latest .count {
    background: var(--primary);
    color: #fff;
    border-radius: 999px;
    padding: 2px 7px;
    font-size: 0.75rem;
    line-height: 1.2;
}

.jump-to-latest:hover {
    transform: translateY(-1px);
}

/* Message highlight (jump-to-reply) */
.message.highlight {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Reply preview clickable */
.msg-reply-preview.clickable {
    cursor: pointer;
}

.msg-reply-preview.clickable:hover {
    opacity: 1;
}

/* Kebab menu button (shown on hover; always visible on touch devices) */
.msg-menu-btn {
    position: absolute;
    top: 5px;
    right: 6px;
    border: none;
    background: transparent;
    font-size: 1.05rem;
    line-height: 1;
    padding: 1px 5px;
    border-radius: 9px;
    cursor: pointer;
    opacity: 0;
}

.message:hover .msg-menu-btn {
    opacity: 1;
}

@media (hover: none) {
    /* Touch devices: keep the ⋯ button easy to tap */
    .msg-menu-btn {
        opacity: 1;
        top: 6px;
        right: 8px;
        font-size: 1.12rem;
        padding: 2px 6px;
        border-radius: 10px;
    }
}

.message.sent .msg-menu-btn {
    color: rgba(255, 255, 255, 0.95);
}

.message.received .msg-menu-btn {
    color: var(--gray-700);
}

.msg-menu-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

.message.sent .msg-menu-btn:hover {
    background: rgba(255, 255, 255, 0.14);
}

/* Context menu */
.chat-context-menu {
    position: fixed;
    z-index: 99999;
    min-width: 170px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    padding: 6px;
    display: none;
}

.chat-context-menu.visible {
    display: block;
}

.chat-context-menu button {
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 9px 10px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.92rem;
    color: var(--text-main);
}

.chat-context-menu button:hover {
    background: var(--gray-50);
}

.chat-context-menu button.danger {
    color: var(--danger);
}

.chat-context-menu .separator {
    height: 1px;
    background: var(--border);
    margin: 6px 6px;
}

/* Chat bubble inner structure (ChatCommon) */
.message-bubble {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.message-text {
    white-space: pre-wrap;
}

.message-meta {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    font-size: 0.75rem;
    opacity: 0.9;
}

.message.sent .message-meta {
    color: rgba(255, 255, 255, 0.85);
}

.message.received .message-meta {
    color: var(--gray-600);
}

.message-status.sending {
    opacity: 0.9;
}

.message-status.failed {
    color: var(--danger);
    opacity: 1;
}

.edited-label {
    opacity: 0.85;
}

.message-deleted .message-text {
    font-style: italic;
    opacity: 0.9;
}

/* ----------------------------- */
/* Reactions UI (Phase 3.2.1)    */
/* ----------------------------- */
.message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}

.message.sent .message-reactions {
    justify-content: flex-end;
}

.message.received .message-reactions {
    justify-content: flex-start;
}

.reaction-chip {
    border: 1px solid var(--border);
    background: var(--bg-white);
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 0.8rem;
    cursor: pointer;
}

.reaction-chip.mine {
    font-weight: 600;
}

.message.sent .reaction-chip {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.95);
}

.message.sent .reaction-chip.mine {
    background: rgba(255, 255, 255, 0.24);
}

.reaction-chip:hover {
    opacity: 0.95;
}

.quick-reactions {
    position: absolute;
    top: -38px;
    display: flex;
    gap: 6px;
    padding: 6px 8px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 10;
}

.message.sent .quick-reactions { right: 30px; }
.message.received .quick-reactions { left: 8px; }

.message:hover .quick-reactions {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

@media (hover: none) {
    .quick-reactions { display: none; }
}

.quick-reaction-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 3px 5px;
    border-radius: 10px;
    font-size: 1rem;
}

.quick-reaction-btn:hover {
    background: var(--gray-50);
}

.quick-reaction-btn.active {
    background: rgba(0, 0, 0, 0.08);
}

.chat-context-reactions {
    display: flex;
    gap: 6px;
    padding: 6px 6px 2px 6px;
}

.ctx-reaction-btn {
    flex: 1;
    border: none;
    background: var(--gray-50);
    padding: 8px 0;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.02rem;
}

.ctx-reaction-btn.active {
    background: rgba(0, 0, 0, 0.08);
}

.quick-reaction-btn.more,
.ctx-reaction-btn.more {
    font-weight: 700;
}


/* ==============================
   Phase 3.2.2: Emoji picker
   ============================== */
.emoji-picker-popover {
    position: fixed;
    width: 320px;
    max-width: calc(100vw - 16px);
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    z-index: 9999;
    display: none;
    overflow: hidden;
}

.emoji-picker-popover.visible { display: block; }

.emoji-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.emoji-picker-title {
    font-weight: 700;
    font-size: 0.95rem;
}

.emoji-picker-close {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 10px;
}

.emoji-picker-close:hover { background: var(--gray-50); }

.emoji-picker-search-wrap { padding: 10px 12px; }

.emoji-picker-search {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    outline: none;
}

.emoji-picker-search:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0,0,0,0.04);
}

.emoji-picker-tabs {
    display: flex;
    gap: 6px;
    padding: 0 10px 10px 10px;
    overflow-x: auto;
}

.emoji-tab {
    border: 1px solid var(--border);
    background: var(--bg-white);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    white-space: nowrap;
}

.emoji-tab.active {
    border-color: var(--accent);
    font-weight: 700;
}

.emoji-picker-grid {
    padding: 10px 12px 12px 12px;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
    max-height: 260px;
    overflow: auto;
}

.emoji-cell {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 8px 0;
    border-radius: 12px;
    font-size: 1.25rem;
}

.emoji-cell:hover { background: var(--gray-50); }

.emoji-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--gray-500);
    padding: 18px 0;
}


/* ==============================
   Phase 3.2.2: Reactions modal
   ============================== */
.rx-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.rx-modal {
    width: 440px;
    max-width: 100%;
    background: var(--bg-white);
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.rx-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}

.rx-modal-title { font-weight: 800; }

.rx-close {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px 10px;
    border-radius: 10px;
}

.rx-close:hover { background: var(--gray-50); }

.rx-tabs {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border);
}

.rx-tab {
    border: 1px solid var(--border);
    background: var(--bg-white);
    cursor: pointer;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.85rem;
    white-space: nowrap;
}

.rx-tab.active {
    border-color: var(--accent);
    font-weight: 800;
}

.rx-list {
    padding: 12px 14px;
    max-height: 320px;
    overflow: auto;
}

.rx-group-header {
    font-weight: 900;
    padding: 10px 0 6px 0;
}

.rx-item {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 8px;
    background: var(--gray-50);
}

.rx-empty {
    text-align: center;
    padding: 24px 0;
    color: var(--gray-500);
}
.rx-retry-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 auto 10px auto;
    border: 1px solid var(--border);
    background: var(--bg-white);
    color: var(--gray-900);
    border-radius: 999px;
    padding: 8px 12px;
    font-weight: 800;
    cursor: pointer;
}

.rx-retry-btn:hover { border-color: var(--accent); }
.rx-retry-btn:active { transform: scale(0.98); }


/* === Phase 2.4: Focus-visible accessibility improvements (chat) === */
.conversation-item:focus-visible,
.user-item:focus-visible,
.student-item:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.msg-menu-btn:focus-visible,
.back-btn:focus-visible,
.chat-header-icon-btn:focus-visible,
.send-btn:focus-visible,
.emoji-btn:focus-visible,
.attach-btn:focus-visible,
.chat-search-nav:focus-visible,
.chat-search-close:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.chat-context-menu .chat-context-item:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ===============================
   Phase 3.1: Chat attachments UI
   =============================== */

.visually-hidden {
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
}

.chat-upload-queue {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 14px 8px;
}

.chat-upload-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.15);
    border-radius: 12px;
}

.chat-upload-item .upload-name {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    opacity: 0.95;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-upload-item .upload-meta {
    font-size: 12px;
    opacity: 0.75;
    white-space: nowrap;
}

.chat-upload-item .upload-bar {
    flex: 1.2;
    height: 8px;
    background: rgba(255,255,255,0.08);
    border-radius: 999px;
    overflow: hidden;
}

.chat-upload-item .upload-bar > div {
    height: 100%;
    width: 0%;
    background: rgba(255,255,255,0.55);
}

.chat-upload-item .upload-cancel {
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.75);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 4px;
    border-radius: 8px;
}

.chat-upload-item .upload-cancel:hover {
    background: rgba(255,255,255,0.08);
}

/* Attachment message bubble */
.message-bubble.message-attachment {
    padding: 10px 10px;
}

.attachment-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(0,0,0,0.18);
}

.attachment-thumb {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(255,255,255,0.10);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex: 0 0 auto;
}

.attachment-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.attachment-icon {
    font-size: 20px;
    opacity: 0.9;
}

.attachment-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.attachment-name {
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-sub {
    font-size: 12px;
    opacity: 0.75;
}

.attachment-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.attachment-actions .attachment-btn {
    border: none;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 12px;
    background: rgba(255,255,255,0.10);
    color: rgba(255,255,255,0.92);
}

.attachment-actions .attachment-btn:hover {
    background: rgba(255,255,255,0.16);
}

/* ========================= */
/* Icon (data-icon) tweaks   */
/* ========================= */

.theme-icon,
.notif-icon-symbol {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.theme-icon .tlw-icon { --tlw-icon-size: 20px; }
.notif-icon-symbol .tlw-icon { --tlw-icon-size: 20px; }

.nav-toggle .tlw-icon { --tlw-icon-size: 20px; }
.mobile-drawer-close .tlw-icon { --tlw-icon-size: 20px; }

/* Chat header/buttons - enterprise look */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: 12px;
    font-size: 0.95rem;
}
.back-btn .tlw-icon { --tlw-icon-size: 18px; }
.back-btn .back-label { line-height: 1; }

.chat-header-icon-btn,
.chat-search-nav,
.chat-search-close {
    width: 38px;
    height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}
.chat-header-icon-btn .tlw-icon,
.chat-search-nav .tlw-icon,
.chat-search-close .tlw-icon { --tlw-icon-size: 18px; }

.chat-options { margin-left: 0; }

.reply-preview button {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.reply-preview button .tlw-icon { --tlw-icon-size: 16px; }

/* Chat input buttons */
.attach-btn,
.emoji-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.attach-btn .tlw-icon,
.emoji-btn .tlw-icon { --tlw-icon-size: 18px; }

.send-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
}
.send-btn .tlw-icon { --tlw-icon-size: 18px; }

/* Attachment icons inside chat */
.attachment-icon { font-size: 0; }
.attachment-icon .tlw-icon { --tlw-icon-size: 18px; }