/* ── Sidebar header ───────────────────────── */
.sidebar-header {
    background: var(--bg-header);
    display: flex;
    flex-direction: column;
    padding: 10px 14px 8px;
    gap: 8px;
    flex-shrink: 0;
}
.sidebar-header .sh-top {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-header .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,.25);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    color: #fff;
    flex-shrink: 0;
    overflow: hidden;
}
.sidebar-header .avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-header .title { flex: 1; color: #fff; }
.sidebar-header .title .sh-name { font-size: 15px; font-weight: 700; line-height: 1.2; }
.sidebar-header .title .sh-user { font-size: 11px; opacity: .75; font-weight: 400; }
.sidebar-header .sh-top .actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
}
.sidebar-header .sh-top .actions .icon-btn {
    width: 32px; height: 32px;
    min-width: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 16px;
    background: rgba(255,255,255,.18);
    border: 1.5px solid rgba(255,255,255,.3);
    transition: var(--transition);
    flex-shrink: 0;
    cursor: pointer;
    padding: 0;
}
.sidebar-header .sh-top .actions .icon-btn:hover {
    background: rgba(255,255,255,.35);
    border-color: rgba(255,255,255,.6);
    transform: scale(1.08);
}
/* Admin panel bottom actions row (kept separate) */
.sidebar-header .actions:not(.sh-top .actions) {
    display: flex;
    gap: 4px;
    padding: 2px 0;
    border-top: 1px solid rgba(255,255,255,.12);
}
.sidebar-header .actions:not(.sh-top .actions) .icon-btn {
    flex: 1;
    height: 32px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,.8);
    transition: var(--transition);
    font-size: 16px;
    font-weight: 500;
}
.sidebar-header .actions:not(.sh-top .actions) .icon-btn:hover { background: rgba(255,255,255,.15); color: #fff; }
.sidebar-header .actions:not(.sh-top .actions) .icon-btn span {
    font-size: 10px;
    display: block;
    line-height: 1;
    margin-top: 1px;
    opacity: .8;
}

/* ── Search ───────────────────────────────── */
.sidebar-search {
    padding: 8px 12px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}
.sidebar-search input {
    width: 100%;
    background: var(--bg-app);
    border-radius: var(--radius-full);
    padding: 8px 16px 8px 36px;
    font-size: 14px;
    color: var(--text-primary);
}
.sidebar-search { position: relative; }
.sidebar-search .search-icon {
    position: absolute;
    left: 24px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 15px;
    pointer-events: none;
}

/* ── Filters (admin) ──────────────────────── */
.sidebar-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}
.filter-chip {
    flex-shrink: 0;
    padding: 4px 11px;
    border-radius: 99px;
    font-size: 11.5px;
    font-weight: 500;
    background: var(--surface-2, var(--bg-app));
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
    transition: background .15s, color .15s, border-color .15s;
    cursor: pointer;
    white-space: nowrap;
}
.filter-chip:hover {
    background: var(--color-primary-light);
    border-color: var(--brand);
    color: var(--brand);
}
.filter-chip.active {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

/* ── Conversation list ────────────────────── */
#conv-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}
#conv-list::-webkit-scrollbar { width: 4px; }
#conv-list::-webkit-scrollbar-thumb { background: rgba(0,0,0,.12); border-radius: 4px; }

/* ── Conversation item ────────────────────── */
.conv-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition);
    position: relative;
}
.conv-item:hover { background: var(--bg-hover); }
.conv-item.active { background: var(--bg-selected); }
.conv-item .avatar {
    width: var(--avatar-size);
    height: var(--avatar-size);
    border-radius: 50%;
    background: var(--color-primary-light);
    color: var(--color-primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
}
.conv-item .avatar.guest { background: #e8f5e9; color: #388e3c; }
.conv-item .meta { flex: 1; min-width: 0; }
.conv-item .conv-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}
.conv-id-tag {
    font-size: 10px;
    font-weight: 700;
    font-family: monospace;
    background: var(--color-primary, #2980b9);
    color: #fff;
    border-radius: 4px;
    padding: 1px 5px;
    letter-spacing: .3px;
    flex-shrink: 0;
}
.conv-item .conv-preview {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}
.conv-item .conv-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}
.conv-item .conv-time { font-size: 11px; color: var(--text-muted); }
.sla-badge { font-size: 10px; font-weight: 700; padding: 2px 5px; border-radius: 10px; white-space: nowrap; }
.sla-badge.amber { background: #fff3e0; color: #e65100; }
.sla-badge.red   { background: #ffebee; color: #c62828; }
.conv-item .badge {
    min-width: 20px; height: 20px;
    padding: 0 6px;
    border-radius: var(--radius-full);
    background: var(--color-accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.conv-item .status-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.conv-item .status-dot.open   { background: var(--color-accent); }
.conv-item .status-dot.hold   { background: var(--color-warning); }
.conv-item .status-dot.closed { background: var(--border-medium); }

/* New chat button */
#btn-new-conv {
    margin: 12px;
    padding: 10px;
    background: var(--color-primary);
    color: #fff;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    display: flex; align-items: center; justify-content: center;
    gap: 8px;
    transition: var(--transition);
    flex-shrink: 0;
}
#btn-new-conv:hover { background: var(--color-primary-dark); }

/* ── Bulk select mode ─────────────────────────────────────────── */
.bulk-checkbox { display:none; width:18px; height:18px; margin-right:4px; cursor:pointer; flex-shrink:0; accent-color:var(--brand); }
body.bulk-mode .bulk-checkbox { display:block; }
.conv-item.bulk-selected { background: var(--bg-selected); }
#bulk-toolbar { display:none; position:sticky; bottom:0; background:var(--surface-1); border-top:2px solid var(--brand); padding:10px 12px; gap:8px; align-items:center; justify-content:space-between; }
body.bulk-mode #bulk-toolbar { display:flex; }
#bulk-count { font-size:13px; font-weight:600; }
