/* ═══════════════════════════════════════════════════════
   COMMUNICATOR — Design System
   Modern, dark-first, premium UI inspired by Slack/Notion
   ═══════════════════════════════════════════════════════ */

/* ── CSS Custom Properties ──────────────────────────── */
:root {
    /* Colors */
    --primary: #667eea;
    --primary-dark: #5a6fd6;
    --primary-light: #7c8eee;
    --accent: #764ba2;
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-hover: linear-gradient(135deg, #5a6fd6 0%, #6a4292 100%);

    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Dark Theme (default) */
    --bg-body: #0f1117;
    --bg-surface: #1a1d28;
    --bg-surface-2: #222536;
    --bg-surface-hover: #282b3d;
    --bg-card: rgba(26, 29, 40, 0.9);
    --bg-sidebar: #13151e;
    --bg-input: rgba(255, 255, 255, 0.05);
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --text: #e4e4e7;
    --text-muted: #71717a;
    --text-heading: #fafafa;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);
}

[data-bs-theme="light"] {
    --bg-body: #f5f5f7;
    --bg-surface: #ffffff;
    --bg-surface-2: #f0f0f2;
    --bg-surface-hover: #e8e8ec;
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-sidebar: #1e1e2e;
    --bg-input: rgba(0, 0, 0, 0.04);
    --border: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.15);
    --text: #27272a;
    --text-muted: #71717a;
    --text-heading: #18181b;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
}

/* ── Reset & Base ───────────────────────────────────── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-body);
    color: var(--text);
    overflow-x: hidden;
    min-height: 100vh;
}

::selection {
    background: var(--primary);
    color: #fff;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

a {
    color: var(--primary-light);
}

a:hover {
    color: var(--primary);
}

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
    height: 64px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.brand-icon {
    font-size: 1.5rem;
}

.brand-text {
    font-size: 1.15rem;
    font-weight: 700;
    background: var(--gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    margin-bottom: 2px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s;
    position: relative;
}

.sidebar-nav .nav-link:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-nav .nav-link.active {
    color: #fff;
    background: rgba(102, 126, 234, 0.15);
}

.sidebar-nav .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 3px;
    background: var(--gradient);
}

.sidebar-nav .nav-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 12px 14px;
}

.nav-label {
    padding: 8px 14px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 600;
}

.badge-notif {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 100px;
}

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    position: relative;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.user-avatar img,
.avatar-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: cover;
}

.avatar-placeholder {
    background: var(--gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.status-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bg-sidebar);
    background: #71717a;
}

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

.status-dot.lg {
    width: 14px;
    height: 14px;
    bottom: 0;
    right: 0;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
}

.user-role {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: capitalize;
}

/* ── Main Wrapper ────────────────────────────────────── */
.main-wrapper {
    margin-left: 260px;
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-content {
    padding: 24px;
}

/* ── Top Bar ──────────────────────────────────────────── */
.topbar {
    height: 64px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.topbar-search {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.topbar-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.topbar-search input {
    width: 100%;
    padding: 8px 14px 8px 38px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 0.85rem;
    outline: none;
    transition: all 0.2s;
}

.topbar-search input:focus {
    border-color: var(--primary);
    background: var(--bg-surface-2);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.btn-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-icon:hover {
    background: var(--bg-surface-hover);
    color: var(--text);
}

.notif-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--danger);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 100px;
    line-height: 1.2;
}

/* Notification Dropdown */
.notif-dropdown {
    width: 360px;
    max-height: 420px;
    background: var(--bg-surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: 16px !important;
    box-shadow: var(--shadow-lg) !important;
    overflow: hidden;
}

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

.notif-header h6 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.notif-list {
    max-height: 300px;
    overflow-y: auto;
}

.notif-empty {
    padding: 40px 16px;
    text-align: center;
    color: var(--text-muted);
}

.notif-footer {
    display: block;
    padding: 12px 16px;
    text-align: center;
    font-size: 0.8rem;
    text-decoration: none;
    color: var(--primary);
    border-top: 1px solid var(--border);
}

/* ── Page Header ──────────────────────────────────────── */
.page-header {
    margin-bottom: 24px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-heading);
}

.page-subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Content Cards ────────────────────────────────────── */
.content-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: all 0.3s;
}

.content-card:hover {
    border-color: var(--border-hover);
}

.card-header-custom {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.card-header-custom h5,
.card-header-custom h6 {
    margin: 0;
    font-weight: 600;
}

.card-body-custom {
    padding: 20px;
}

/* ── Stat Cards ───────────────────────────────────────── */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.stat-card-purple .stat-icon {
    background: rgba(102, 126, 234, 0.15);
    color: var(--primary);
}

.stat-card-blue .stat-icon {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
}

.stat-card-amber .stat-icon {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.stat-card-green .stat-icon {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-heading);
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Auth Pages ───────────────────────────────────────── */
.auth-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 440px;
}

.auth-card {
    background: rgba(30, 30, 50, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

.auth-brand {
    font-size: 1.75rem;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-title {
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    color: #fff;
}

.auth-subtitle {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    margin-bottom: 1.5rem;
}

.input-icon-wrap {
    position: relative;
}

.input-icon-wrap i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.3);
}

.input-icon-wrap .form-control {
    padding-left: 40px;
}

/* ── Buttons ──────────────────────────────────────────── */
.btn-primary-gradient {
    background: var(--gradient) !important;
    border: none !important;
    color: #fff !important;
    font-weight: 600;
    border-radius: 12px;
    padding: 10px 24px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary-gradient:hover {
    background: var(--gradient-hover) !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    color: #fff !important;
}

/* ── Form Controls ────────────────────────────────────── */
.form-control,
.form-select {
    background: var(--bg-input) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    border-radius: 12px !important;
    padding: 10px 14px;
    font-size: 0.88rem;
    transition: all 0.2s;
}

.form-control:focus,
.form-select:focus {
    background: var(--bg-surface-2) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15) !important;
    color: var(--text) !important;
}

.form-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}

/* ── Task List ────────────────────────────────────────── */
.task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

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

.task-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-todo {
    background: #94a3b8;
}

.status-in_progress {
    background: var(--info);
}

.status-review {
    background: var(--warning);
}

.status-completed {
    background: var(--success);
}

.task-info {
    flex: 1;
    min-width: 0;
}

.task-name {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 4px;
}

.task-meta {
    display: flex;
    gap: 8px;
    align-items: center;
}

.task-due {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.task-due.overdue {
    color: var(--danger);
}

/* Priority Badges */
.priority-low {
    background: rgba(148, 163, 184, 0.15) !important;
    color: #94a3b8 !important;
    font-size: 0.7rem;
}

.priority-medium {
    background: rgba(59, 130, 246, 0.15) !important;
    color: #3b82f6 !important;
    font-size: 0.7rem;
}

.priority-high {
    background: rgba(245, 158, 11, 0.15) !important;
    color: #f59e0b !important;
    font-size: 0.7rem;
}

.priority-urgent {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444 !important;
    font-size: 0.7rem;
}

/* Role Badge */
.role-badge {
    background: rgba(102, 126, 234, 0.15) !important;
    color: var(--primary-light) !important;
    font-size: 0.72rem;
    text-transform: capitalize;
}

/* Status Badges */
.status-badge-todo {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
}

.status-badge-in_progress {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.status-badge-review {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.status-badge-completed {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

/* ── Activity Feed ────────────────────────────────────── */
.activity-feed {}

.activity-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

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

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    margin-top: 6px;
    flex-shrink: 0;
}

.activity-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Activity Timeline */
.activity-timeline {
    position: relative;
    padding-left: 24px;
}

.activity-timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-dot {
    position: absolute;
    left: -20px;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--bg-body);
}

.timeline-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Empty State ──────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2.5rem;
    opacity: 0.3;
    display: block;
    margin-bottom: 12px;
}

/* ── Member Cards ─────────────────────────────────────── */
.member-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    transition: all 0.3s;
}

.member-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.member-avatar {
    position: relative;
    display: inline-block;
    margin-bottom: 12px;
}

.member-avatar img {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    object-fit: cover;
}

.avatar-placeholder-lg {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: var(--gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
}

.avatar-placeholder-xl {
    width: 100px;
    height: 100px;
    border-radius: 20px;
    background: var(--gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
}

.member-name {
    font-weight: 600;
    margin-bottom: 6px;
}

.member-actions .btn {
    font-size: 0.78rem;
}

.profile-avatar-lg {
    position: relative;
    display: inline-block;
}

.profile-avatar-lg img {
    width: 100px;
    height: 100px;
    border-radius: 20px;
    object-fit: cover;
}

/* ── Search ───────────────────────────────────────────── */
.search-input-wrap {
    position: relative;
}

.search-input-wrap i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input-wrap .form-control {
    padding-left: 40px !important;
}

.filter-bar {}

/* ── Chat Layout ──────────────────────────────────────── */
.chat-layout {
    display: flex;
    height: calc(100vh - 64px);
    margin: -24px;
    /* full-bleed within main-content */
}

.chat-sidebar {
    width: 340px;
    flex-shrink: 0;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-sidebar-header {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.chat-sidebar-header h5 {
    margin: 0;
    font-weight: 700;
}

.chat-search {
    padding: 12px 16px;
    position: relative;
}

.chat-search i {
    position: absolute;
    left: 28px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.chat-search input {
    width: 100%;
    padding: 8px 14px 8px 36px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.85rem;
    outline: none;
}

.chat-room-list {
    flex: 1;
    overflow-y: auto;
}

.chat-room-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.chat-room-item:hover,
.chat-room-item.active {
    background: var(--bg-surface-hover);
}

.room-avatar {
    position: relative;
    flex-shrink: 0;
}

.room-avatar img,
.room-avatar .avatar-placeholder {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    object-fit: cover;
}

.room-avatar .avatar-placeholder.group {
    background: rgba(102, 126, 234, 0.15);
    color: var(--primary);
}

.room-info {
    flex: 1;
    min-width: 0;
}

.room-name {
    font-size: 0.88rem;
    font-weight: 600;
}

.room-last-msg {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-meta {
    text-align: right;
    flex-shrink: 0;
}

.room-time {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.unread-badge {
    background: var(--primary);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 100px;
    display: inline-block;
    margin-top: 4px;
}

.chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--bg-body);
}

.chat-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.chat-window-header {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
}

.chat-room-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.room-avatar-sm img {
    width: 36px;
    height: 36px;
    border-radius: 10px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.message-bubble {
    max-width: 65%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.88rem;
    position: relative;
    word-wrap: break-word;
    line-height: 1.45;
}

.message-bubble.sent {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    margin-left: 20%;
}

.message-bubble.received {
    background: var(--bg-surface-2);
    color: var(--text);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border);
    margin-right: 20%;
}

.message-sender {
    font-size: 0.72rem;
    font-weight: 600;
    margin-bottom: 3px;
    color: var(--primary-light);
}

.message-bubble.sent .message-sender {
    color: rgba(255, 255, 255, 0.7);
}

.message-time {
    font-size: 0.62rem;
    opacity: 0.6;
    margin-top: 4px;
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.message-bubble.sent .message-time {
    color: rgba(255, 255, 255, 0.7);
}

.message-bubble.received .message-time {
    color: var(--text-muted);
}

/* Jumbo emoji — emoji-only messages display large without bubble */
.message-bubble.jumbo-emoji {
    background: transparent !important;
    padding: 4px 0 !important;
    box-shadow: none !important;
}

.message-bubble.jumbo-emoji .message-text {
    font-size: 2.8rem;
    line-height: 1.2;
    letter-spacing: 2px;
}

.message-bubble.jumbo-emoji .message-text img.emoji {
    width: 48px;
    height: 48px;
    vertical-align: middle;
    margin: 0 2px;
}

/* Twemoji sizing in normal chat messages */
.message-bubble .message-text img.emoji {
    width: 1.25em;
    height: 1.25em;
    vertical-align: -0.15em;
    margin: 0 1px;
}

/* Bounce-in animation for new messages */
.message-bubble.msg-animated {
    animation: msgBounceIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.message-bubble.msg-animated.jumbo-emoji {
    animation: emojiBounceIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes msgBounceIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }

    60% {
        transform: translateY(-4px) scale(1.02);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes emojiBounceIn {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.3);
    }

    50% {
        transform: translateY(-8px) scale(1.1);
    }

    70% {
        transform: translateY(3px) scale(0.95);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Typing indicator */
.typing-indicator {
    padding: 8px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.typing-dots span {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingPulse 1.2s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingPulse {

    0%,
    60%,
    100% {
        opacity: 0.3;
    }

    30% {
        opacity: 1;
    }
}

/* Chat Input */
.chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-surface);
}

.chat-input-toolbar {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.chat-input-wrap {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-input-wrap textarea {
    flex: 1;
    resize: none;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    max-height: 120px;
    transition: border-color 0.2s;
}

.chat-input-wrap textarea:focus {
    border-color: var(--primary);
}

.btn-send {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--gradient);
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-send:hover {
    transform: scale(1.05);
}

/* User select list for modals */
.user-select-list {
    max-height: 300px;
    overflow-y: auto;
}

.user-select-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.user-select-item:hover {
    background: var(--bg-surface-hover);
}

/* ── Kanban Board ─────────────────────────────────────── */
.kanban-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 16px;
    min-height: 70vh;
}

.kanban-column {
    min-width: 280px;
    max-width: 320px;
    flex-shrink: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
}

.kanban-column-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.88rem;
}

.kanban-column-body {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 100px;
}

.kanban-card {
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    cursor: grab;
    transition: all 0.2s;
}

.kanban-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.kanban-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.kanban-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 8px;
}

.kanban-card-title {
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.kanban-card-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.kanban-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.due-tag {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.due-tag.overdue {
    color: var(--danger);
}

.assignee-tag {
    display: flex;
    align-items: center;
}

.assignee-avatar-sm {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    object-fit: cover;
}

.assignee-avatar-sm.placeholder {
    background: var(--gradient);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
}

/* Drag Over State */
.kanban-column-body.drag-over {
    background: rgba(102, 126, 234, 0.05);
    border: 2px dashed var(--primary);
    border-radius: 12px;
}

/* ── Calendar ─────────────────────────────────────────── */
.calendar-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 4px;
}

.calendar-weekday {
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 8px;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day {
    min-height: 80px;
    padding: 8px;
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: all 0.2s;
}

.calendar-day.empty {
    background: transparent;
    border: none;
}

.calendar-day.today {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.08);
}

.day-number {
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.calendar-task {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Group Cards ──────────────────────────────────────── */
.group-card {
    transition: all 0.3s;
    cursor: pointer;
}

.group-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
}

.group-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(102, 126, 234, 0.15);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 12px;
}

/* Nav pills for group tabs */
.nav-pills-custom .nav-link {
    color: var(--text-muted);
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    padding: 8px 16px;
}

.nav-pills-custom .nav-link.active {
    background: var(--gradient);
    color: #fff;
}

/* ── File Items ───────────────────────────────────────── */
.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

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

.file-item i {
    font-size: 1.3rem;
    color: var(--primary);
}

.file-info {
    flex: 1;
}

/* ── Notification Items ───────────────────────────────── */
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.notif-item.unread {
    background: rgba(102, 126, 234, 0.05);
}

.notif-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(102, 126, 234, 0.15);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notif-content {
    flex: 1;
}

.notif-title {
    font-size: 0.88rem;
    font-weight: 500;
}

.notif-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Status Indicator */
.status-indicator {
    font-size: 0.78rem;
}

.status-indicator.online {
    color: var(--success);
}

.status-indicator.offline {
    color: var(--text-muted);
}

/* ── Chart Bars (Analytics) ───────────────────────────── */
.chart-bar-container {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 180px;
    padding-top: 20px;
}

.chart-bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.chart-bar {
    width: 100%;
    max-width: 24px;
    background: var(--gradient);
    border-radius: 4px 4px 0 0;
    margin-top: auto;
    transition: height 0.3s;
}

.chart-bar-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* ── Tables ───────────────────────────────────────────── */
.table-dark {
    --bs-table-bg: transparent !important;
    --bs-table-hover-bg: var(--bg-surface-hover) !important;
    --bs-table-border-color: var(--border) !important;
}

.table-dark th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom-width: 1px !important;
    padding: 12px 16px;
}

.table-dark td {
    padding: 12px 16px;
    font-size: 0.88rem;
    vertical-align: middle;
}

/* Avatar Sm for tables */
.avatar-sm img {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    object-fit: cover;
}

.avatar-placeholder-sm {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--gradient);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
}

.member-avatar-sm img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
}

/* ── Project Cards ────────────────────────────────────── */
.project-card {
    transition: all 0.3s;
}

.project-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
}

.project-views {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

/* ── Animations ───────────────────────────────────────── */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.content-card {
    animation: fadeIn 0.3s ease;
}

/* ── Mobile Responsive ────────────────────────────────── */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1035;
    display: none;
    backdrop-filter: blur(4px);
}


/* ── Sidebar Collapsed State ──────────────────────────── */
.sidebar.collapsed {
    width: 72px;
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .user-details,
.sidebar.collapsed .badge-notif {
    display: none;
}

.sidebar.collapsed~.main-wrapper {
    margin-left: 72px;
}

.sidebar.collapsed .sidebar-nav .nav-link {
    justify-content: center;
    padding: 12px;
}

.sidebar.collapsed .sidebar-nav .nav-link i {
    width: auto;
    font-size: 1.2rem;
}

.sidebar.collapsed .user-avatar {
    margin: 0 auto;
}

/* ── Print ────────────────────────────────────────────── */
@media print {

    .sidebar,
    .topbar,
    .sidebar-overlay {
        display: none !important;
    }

    .main-wrapper {
        margin-left: 0 !important;
    }
}

/* ── Select2 Custom Dark Theme ──────────────────────────── */
.select2-container--default .select2-selection--single {
    background-color: var(--bg-input) !important;
    border: 1px solid var(--border) !important;
    border-radius: 12px !important;
    height: 42px !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text) !important;
    line-height: 40px !important;
    padding-left: 14px !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px !important;
}

.select2-dropdown {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: 8px !important;
    overflow: hidden;
}

.select2-search--dropdown .select2-search__field {
    background-color: var(--bg-input) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    border-radius: 6px !important;
}

.select2-results__option {
    color: var(--text) !important;
    padding: 8px 14px !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--primary) !important;
    color: #fff !important;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: var(--bg-surface-2) !important;
}.read-tick{display:inline-block;margin-left:3px;font-size:0.85rem;color:rgba(255,255,255,0.4);vertical-align:middle}.read-tick.seen{color:#53bdeb}.read-tick.seen i{filter:drop-shadow(0 0 1px #53bdeb)}.read-tick i{font-size:0.85rem}



/* == RESPONSIVE & MOBILE STYLES == */

:root {
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

.chat-room-list, .chat-messages, .kanban-column-body, .main-content {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

html, body { overflow-x: hidden; max-width: 100vw; }

@media (min-width: 992px) { .sidebar-toggle { display: none; } }
@media (min-width: 768px) { .chat-back-btn { display: none !important; } }

/* == TABLET (max-width: 991.98px) == */
@media (max-width: 991.98px) {
    .btn, button, a.nav-link, .dropdown-item, .chat-room-item, .kanban-card, .member-card { -webkit-tap-highlight-color: transparent; }
    .btn-icon { min-width: 44px; min-height: 44px; }
    .sidebar {
        transform: translateX(-100%);
        z-index: 1050;
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: 280px;
        transition: transform 0.25s ease;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-toggle { display: flex !important; }
    .main-wrapper { margin-left: 0 !important; }
    .sidebar-overlay {
        position: fixed; inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1040; display: none;
        -webkit-backdrop-filter: blur(4px);
        backdrop-filter: blur(4px);
    }
    .sidebar-overlay.show { display: block; }
}

/* == TABLET ONLY (768-991px) == */
@media (max-width: 991.98px) and (min-width: 768px) {
    .main-content { padding: 20px; }
    .chat-sidebar { width: 280px; }
    .message-bubble { max-width: 75%; }
    .message-bubble.sent { margin-left: 15%; }
    .message-bubble.received { margin-right: 15%; }
}
/* == PHONE (max-width: 767.98px) == */
@media (max-width: 767.98px) {
    body { font-size: 14px; padding-bottom: var(--safe-bottom); }
    .main-content { padding: 12px !important; }
    .topbar { height: 56px; padding: 0 12px; gap: 8px; }
    .topbar-actions { gap: 2px; }
    .topbar-actions .btn-icon { min-width: 40px; min-height: 40px; padding: 0; }
    .topbar-search { display: none; }
    .notif-dropdown { width: calc(100vw - 24px) !important; max-width: 360px; right: -8px !important; }
    .row .col-md-3, .row .col-md-4, .row .col-lg-3 { flex: 0 0 50%; max-width: 50%; }
    .stat-card { padding: 14px !important; border-radius: 12px !important; }
    .stat-value { font-size: 1.15rem !important; }
    .stat-label { font-size: 0.7rem !important; }
    .stat-icon { width: 36px !important; height: 36px !important; font-size: 1rem !important; }
    .card { border-radius: 12px !important; }
    .card-body { padding: 14px !important; }
    .card-header { padding: 12px 14px !important; }
    .table-responsive { margin: 0 -12px; padding: 0 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table { font-size: 0.8rem; }
    .table th, .table td { padding: 8px 10px !important; white-space: nowrap; }
    .member-card { padding: 14px !important; }
    .member-card .d-flex { flex-wrap: wrap; gap: 8px; }
    .project-card { padding: 14px !important; }
    .auth-wrapper { padding: 16px !important; }
    .auth-card { padding: 1.25rem !important; margin: 8px !important; border-radius: 16px !important; }
    .modal-dialog { margin: 8px !important; max-width: calc(100vw - 16px) !important; }
    .modal-content { border-radius: 16px !important; }
    .modal-body { padding: 16px !important; }
    .modal-header { padding: 14px 16px !important; }
    .form-control, .form-select,
    input[type="text"], input[type="email"], input[type="password"],
    input[type="number"], input[type="tel"], input[type="url"],
    input[type="search"], input[type="date"], select, textarea {
        font-size: 16px !important;
        padding: 10px 12px !important;
        border-radius: 10px !important;
    }
    .select2-container { width: 100% !important; }
    .btn { padding: 8px 16px; font-size: 0.85rem; border-radius: 10px; }
    .kanban-board { flex-direction: column !important; gap: 12px; padding: 0; }
    .kanban-column { min-width: 100% !important; max-width: 100% !important; max-height: none !important; }
    .kanban-card { padding: 12px !important; }
    .calendar-day { min-height: 40px !important; padding: 2px !important; }
    .day-number { font-size: 0.65rem; }
    .calendar-task { display: none; }
    .alert { margin-left: 0 !important; margin-right: 0 !important; border-radius: 10px !important; font-size: 0.85rem; padding: 10px 14px !important; }
    #pwaInstallBanner > div { flex-wrap: wrap !important; gap: 8px !important; }
    .sidebar { width: 260px !important; }
    .sidebar-nav .nav-link { padding: 10px 16px !important; font-size: 0.88rem !important; }
    h1, .page-title { font-size: 1.25rem !important; }
    h2 { font-size: 1.1rem !important; }
    h3 { font-size: 1rem !important; }
}
/* == WHATSAPP-STYLE CHAT (phone) == */
@media (max-width: 767.98px) {
    .chat-layout {
        position: relative;
        overflow: hidden;
        height: calc(100vh - 56px);
        height: calc(100dvh - 56px);
        margin: -12px;
    }
    .chat-sidebar {
        width: 100% !important;
        height: 100% !important;
        max-height: none !important;
        border-right: none !important;
        position: absolute;
        inset: 0;
        z-index: 10;
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        background: var(--bg-surface, #fff);
    }
    .chat-layout.chat-open .chat-sidebar {
        transform: translateX(-100%);
        pointer-events: none;
    }
    .chat-window {
        position: absolute;
        inset: 0;
        z-index: 5;
        transform: translateX(100%);
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex !important;
        flex-direction: column;
        background: var(--bg-surface, #fff);
    }
    .chat-layout.chat-open .chat-window {
        transform: translateX(0);
    }
    .chat-back-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 36px; height: 36px;
        border-radius: 8px;
        background: var(--bg-input, #f0f0f0);
        border: none;
        color: var(--text, #333);
        cursor: pointer;
        flex-shrink: 0;
        margin-right: 4px;
        -webkit-tap-highlight-color: transparent;
    }
    .chat-back-btn:active { opacity: 0.7; }
    .chat-window-header { padding: 8px 12px !important; gap: 8px !important; }
    .chat-messages { padding: 12px !important; flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
    .message-bubble { max-width: 82% !important; font-size: 0.85rem !important; padding: 8px 11px !important; }
    .message-bubble.sent { margin-left: 10% !important; }
    .message-bubble.received { margin-right: 10% !important; }
    .chat-input-area { padding: 8px 10px !important; padding-bottom: calc(8px + var(--safe-bottom)) !important; }
    .chat-input-wrap textarea { padding: 8px 12px !important; font-size: 16px !important; border-radius: 20px !important; max-height: 80px !important; }
    .btn-send { width: 38px !important; height: 38px !important; border-radius: 50% !important; }
    .chat-input-toolbar { display: none !important; }
    .chat-sidebar-header { padding: 12px 14px !important; }
    .chat-search { padding: 8px 12px !important; }
    .chat-room-item { padding: 10px 14px !important; min-height: 60px; }
    .chat-empty-state { display: none !important; }
}
/* == SMALL PHONE (max-width: 374px) == */
@media (max-width: 374px) {
    .row .col-md-3, .row .col-md-4, .row .col-lg-3 { flex: 0 0 100%; max-width: 100%; }
    .stat-card { padding: 12px !important; }
    .sidebar { width: 240px !important; }
    .message-bubble { max-width: 88% !important; }
    .message-bubble.sent { margin-left: 5% !important; }
    .message-bubble.received { margin-right: 5% !important; }
}

/* == LANDSCAPE == */
@media (max-height: 500px) and (orientation: landscape) {
    .chat-layout { height: calc(100vh - 56px) !important; }
    .chat-messages { padding: 8px !important; }
    .sidebar { padding-top: 0; }
    .sidebar-brand { padding: 8px 16px !important; }
}

/* == PWA STANDALONE == */
@media all and (display-mode: standalone) {
    body { padding-top: var(--safe-top); }
    .topbar { padding-top: var(--safe-top); height: calc(56px + var(--safe-top)); }
    .sidebar { padding-top: var(--safe-top); }
}

/* == KANBAN & TASK BOARD MOBILE FIXES == */
@media (max-width: 767.98px) {
    .page-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
        margin-bottom: 16px !important;
    }
    .page-header > div:first-child { width: 100%; }
    .page-header .d-flex.align-items-center.gap-3 {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 8px !important;
        width: 100%;
    }
    .project-views {
        display: flex; gap: 4px; flex-wrap: wrap; width: 100%;
    }
    .project-views .btn {
        flex: 1; min-width: 0; font-size: 0.78rem !important;
        padding: 6px 10px !important; text-align: center; white-space: nowrap;
    }
    .page-header .d-flex.gap-2 { width: 100%; display: flex !important; }
    .page-header .d-flex.gap-2 .btn {
        flex: 1; font-size: 0.78rem !important;
        padding: 6px 10px !important; text-align: center;
    }
    .kanban-board {
        flex-direction: column !important;
        gap: 12px !important;
        overflow-x: visible !important;
        padding-bottom: 80px !important;
        min-height: auto !important;
    }
    .kanban-column {
        min-width: 100% !important; max-width: 100% !important;
        width: 100% !important; flex-shrink: 1 !important;
        border-radius: 12px !important;
    }
    .kanban-column-header {
        padding: 10px 14px !important; font-size: 0.82rem !important;
        position: sticky; top: 0; z-index: 5;
        background: var(--bg-surface);
    }
    .kanban-column-body {
        padding: 8px !important; gap: 8px !important;
        min-height: 40px !important; max-height: none !important;
    }
    .kanban-card { padding: 10px 12px !important; border-radius: 10px !important; }
    .kanban-card-header { margin-bottom: 6px !important; }
    .kanban-card-title { font-size: 0.82rem !important; }
    .kanban-card-desc { font-size: 0.72rem !important; margin-bottom: 6px !important; }
    .kanban-card-footer { font-size: 0.72rem !important; }
    .kanban-column-footer { padding: 6px 8px !important; }
    .column-add-btn { opacity: 1 !important; }

    /* Task modals: full-screen on mobile */
    #newTaskModal .modal-dialog,
    #editTaskModal .modal-dialog {
        margin: 0 !important; max-width: 100% !important;
        min-height: 100vh; min-height: 100dvh;
    }
    #newTaskModal .modal-content,
    #editTaskModal .modal-content {
        border-radius: 0 !important;
        min-height: 100vh; min-height: 100dvh; border: none !important;
    }
    #newTaskModal .modal-body,
    #editTaskModal .modal-body {
        padding: 16px !important; overflow-y: auto;
    }
    #newTaskModal .modal-header,
    #editTaskModal .modal-header {
        padding: 12px 16px !important; position: sticky;
        top: 0; z-index: 10; background: var(--bg-surface, #1e293b);
    }
    #newTaskModal .modal-footer,
    #editTaskModal .modal-footer {
        padding: 12px 16px !important;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
        position: sticky; bottom: 0; z-index: 10;
        background: var(--bg-surface, #1e293b);
    }
    #newTaskModal .row.g-3 > [class*="col-md-"],
    #editTaskModal .row.g-3 > [class*="col-md-"] {
        flex: 0 0 100% !important; max-width: 100% !important;
    }
    #editTaskModal .modal-dialog.modal-lg { max-width: 100% !important; }

    #collaboratorsModal .modal-dialog {
        margin: 8px !important; max-width: calc(100vw - 16px) !important;
    }
    #collaboratorsModal .input-group { flex-wrap: wrap; gap: 8px; }
    #collaboratorsModal .input-group .form-select { width: 100% !important; flex: 0 0 100%; }
    #collaboratorsModal .input-group .btn { width: 100%; }

    .badge.priority-low, .badge.priority-medium,
    .badge.priority-high, .badge.priority-urgent {
        font-size: 0.65rem !important; padding: 2px 6px !important;
    }
    .day-chip .day-label { width: 34px !important; font-size: 0.68rem !important; padding: 3px 0 !important; }
}

@media (max-width: 374px) {
    .kanban-card-header .d-flex.align-items-center.gap-2 { gap: 4px !important; flex-wrap: wrap; }
    .project-views .btn { font-size: 0.72rem !important; padding: 5px 8px !important; }
    #newTaskModal .modal-body, #editTaskModal .modal-body { padding: 12px !important; }
}

/* ═══ IN-CHAT MESSAGE SEARCH ═══ */
.msg-highlight {
    animation: msgHighlight 2s ease;
}
@keyframes msgHighlight {
    0%, 30% { background: rgba(102, 126, 234, 0.25); border-radius: 12px; }
    100% { background: transparent; }
}
.search-msg-item:hover {
    background: rgba(102, 126, 234, 0.08) !important;
}
.chat-msg-search-bar mark {
    background: rgba(255, 193, 7, 0.4);
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}


/* ══════════════════════════════════════════════════
   UI POLISH PATCH - Comprehensive improvements
   ══════════════════════════════════════════════════ */

/* Kanban Card hover */
.kanban-card { transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease; border: 1px solid rgba(255,255,255,0.06); }
.kanban-card:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0,0,0,0.3), 0 0 0 1px rgba(99,102,241,0.15); border-color: rgba(99,102,241,0.2); }

/* Priority badges */
.badge.priority-high, .badge.priority-urgent { background: rgba(239,68,68,0.15)!important; color: #f87171!important; border: 1px solid rgba(239,68,68,0.25); }
.badge.priority-medium { background: rgba(245,158,11,0.15)!important; color: #fbbf24!important; border: 1px solid rgba(245,158,11,0.25); }
.badge.priority-low { background: rgba(34,197,94,0.15)!important; color: #4ade80!important; border: 1px solid rgba(34,197,94,0.25); }
.badge { font-weight: 500; font-size: 0.7rem; padding: 3px 8px; border-radius: 4px; letter-spacing: 0.02em; }

/* Content cards */
.content-card { border: 1px solid rgba(255,255,255,0.06); border-radius: 12px; transition: border-color 0.2s; }
.content-card:hover { border-color: rgba(255,255,255,0.1); }

/* Stat cards hover */
.stat-card { transition: transform 0.2s, box-shadow 0.2s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.2); }

/* Button polish */
.btn-primary-gradient { transition: all 0.2s; }
.btn-primary-gradient:hover { transform: translateY(-1px); box-shadow: 0 4px 15px rgba(99,102,241,0.35); }
.btn-outline-light { transition: all 0.2s; }
.btn-outline-light:hover { transform: translateY(-1px); }

/* Activity timeline */
.activity-timeline { position: relative; padding-left: 20px; }
.activity-timeline::before { content:''; position:absolute; left:7px; top:8px; bottom:8px; width:2px; background:linear-gradient(to bottom,rgba(99,102,241,0.4),rgba(99,102,241,0.05)); border-radius:2px; }
.timeline-item { position:relative; padding-bottom:20px; }
.timeline-dot { position:absolute; left:-17px; top:6px; width:10px; height:10px; border-radius:50%; background:var(--accent,#6366f1); border:2px solid var(--bg-card,#1e1e2e); }
.timeline-time { font-size:0.75rem; color:var(--text-muted,#888); margin-top:4px; }
.timeline-content { padding:4px 0; }

/* Dashboard activity feed */
.activity-feed .activity-item { display:flex; align-items:flex-start; gap:12px; padding:10px 0; border-bottom:1px solid rgba(255,255,255,0.04); }
.activity-feed .activity-item:last-child { border-bottom:none; }
.activity-feed .activity-dot { width:8px; height:8px; min-width:8px; border-radius:50%; background:var(--accent,#6366f1); margin-top:7px; }
.activity-time { font-size:0.75rem; color:var(--text-muted,#888); }

/* Empty state */
.empty-state { text-align:center; padding:40px 20px; }
.empty-state i { font-size:2.5rem; opacity:0.25; display:block; margin-bottom:12px; }
.empty-state p { margin:0; font-size:0.9rem; color:var(--text-muted,#888); }

/* Project card hover */
.project-card, .member-card { transition: transform 0.2s, box-shadow 0.2s; }
.project-card:hover, .member-card:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0,0,0,0.25); }

/* Page title */
.page-title { font-size:1.5rem; font-weight:700; margin-bottom:4px; }
.page-subtitle { color:var(--text-muted,#888); font-size:0.9rem; }

/* Scrollbar */
::-webkit-scrollbar { width:6px; height:6px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:rgba(255,255,255,0.1); border-radius:3px; }
::-webkit-scrollbar-thumb:hover { background:rgba(255,255,255,0.2); }

/* Form focus */
.form-control:focus, .form-select:focus { border-color:var(--accent,#6366f1); box-shadow:0 0 0 3px rgba(99,102,241,0.15); }

/* ── MOBILE RESPONSIVE ── */
@media (max-width: 768px) {
    /* Toolbar horizontal scroll */
    .kanban-toolbar { flex-wrap:nowrap!important; overflow-x:auto; -webkit-overflow-scrolling:touch; padding-bottom:8px; scrollbar-width:none; }
    .kanban-toolbar::-webkit-scrollbar { display:none; }
    .kanban-toolbar .btn, .kanban-toolbar a { white-space:nowrap; flex-shrink:0; }

    /* Kanban board scroll */
    .kanban-board { overflow-x:auto; -webkit-overflow-scrolling:touch; scrollbar-width:none; padding-bottom:16px; }
    .kanban-board::-webkit-scrollbar { display:none; }
    .kanban-column { min-width:280px; }

    /* Page header */
    .page-title { font-size:1.25rem; }
    .page-header { padding:12px 0; }

    /* Stat cards */
    .stat-card { padding:14px; }
    .stat-value { font-size:1.4rem; }
    .stat-icon { width:40px; height:40px; font-size:1.1rem; }

    /* Modal */
    .modal-dialog { margin:10px; max-width:calc(100% - 20px); }

    /* Bottom spacing */
    .main-content { padding-bottom:80px; }
}

@media (max-width: 480px) {
    .stat-card { padding:12px; gap:10px; }
    .stat-value { font-size:1.2rem; }
    .kanban-column { min-width:260px; }
    .page-title { font-size:1.1rem; }
}

/* Smooth everything */
html { scroll-behavior:smooth; }

/* === TOOLBAR & LAYOUT FIX === */
.page-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-primary, #111827);
    padding-bottom: 12px;
}
.page-header .page-title {
    font-size: 1.5rem;
    font-weight: 700;
}
