/* === CRM Design System === */
:root {
    --bg-primary: #F0F2F5;
    --bg-secondary: #E8ECF1;
    --bg-card: #FFFFFF;
    --bg-hover: #F0F3F7;
    --bg-sidebar: #1C2536;
    --surface: #FFFFFF;
    --primary: #4C6FFF;
    --accent: #4C6FFF;
    --accent-hover: #3B5EF0;
    --accent-dim: rgba(76,111,255,.1);
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text-primary: #1A1D2B;
    --text-secondary: #5E6B7F;
    --text-muted: #9BA5B5;
    --border: #E0E4EB;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-card: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-lg: 0 8px 24px rgba(0,0,0,.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg-primary); color: var(--text-primary); line-height: 1.5; font-size: 14px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* === Initial loading screen === */
.loading-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1C2536;
    z-index: 9999;
}
.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.15);
    border-top-color: #fff;
    border-radius: 50%;
    animation: crm-spin 0.8s linear infinite;
}
@keyframes crm-spin {
    to { transform: rotate(360deg); }
}

/* === Login === */
.login-screen {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: #1C2536;
}
.login-card {
    background: #fff; border: none; border-radius: var(--radius-lg);
    padding: 40px 32px; width: 100%; max-width: 380px; box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.login-logo { font-size: 24px; font-weight: 700; text-align: center; color: var(--accent); }
.login-subtitle { font-size: 13px; color: var(--text-muted); text-align: center; margin-bottom: 28px; }
.login-error {
    background: rgba(239,68,68,.15); color: var(--danger); border: 1px solid rgba(239,68,68,.3);
    padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px;
}

/* === Forms === */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 5px; font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 10px 12px; background: #fff; border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text-primary); font-size: 14px; outline: none; font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--accent); }
.form-group textarea { resize: vertical; min-height: 70px; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

/* Searchable Select Widget */
.searchable-select { position: relative; }
.searchable-select .ss-input {
    width: 100%;
    padding: 10px 32px 10px 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    font-family: inherit;
}
.searchable-select .ss-input:focus { border-color: var(--accent); }
.searchable-select .ss-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 0;
    color: var(--text-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}
.searchable-select .ss-clear:hover { color: var(--text-primary); }
.searchable-select .ss-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-height: 260px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.searchable-select .ss-dropdown.open { display: block; }
.searchable-select .ss-option {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.searchable-select .ss-option:last-child { border-bottom: none; }
.searchable-select .ss-option:hover { background: var(--bg-hover); }
.searchable-select .ss-empty {
    padding: 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.inline-input {
    background: transparent; border: 1px solid transparent; color: var(--text-primary);
    padding: 4px 8px; border-radius: var(--radius); font-size: 13px; outline: none; font-family: inherit;
}
.inline-input:hover { border-color: var(--border); }
.inline-input:focus { border-color: var(--accent); background: var(--bg-secondary); }

/* === Buttons === */
.btn {
    padding: 10px 20px; border: none; border-radius: var(--radius); font-size: 14px;
    cursor: pointer; font-weight: 600; transition: all .2s; display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text-primary); border-color: var(--text-muted); }
.btn-danger { background: rgba(239,68,68,.15); color: var(--danger); border: 1px solid rgba(239,68,68,.3); }
.btn-danger:hover { background: rgba(239,68,68,.25); }
.btn-success { background: rgba(34,197,94,.15); color: var(--success); border: 1px solid rgba(34,197,94,.3); }
.btn-success:hover { background: rgba(34,197,94,.25); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px 8px; border-radius: var(--radius); font-size: 16px; }
.btn-icon:hover { color: var(--text-primary); background: var(--bg-hover); }

/* === App Layout === */
.crm-app { display: flex; min-height: 100vh; }

/* Sidebar — always dark navy */
.crm-sidebar {
    width: 240px; background: #1C2536; border-right: none;
    display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
    transition: transform .3s;
}
.sidebar-header { padding: 20px 16px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-logo { font-size: 18px; font-weight: 700; color: #fff; letter-spacing: -0.3px; }
.sidebar-subtitle { font-size: 10px; color: rgba(255,255,255,.35); letter-spacing: 2px; text-transform: uppercase; margin-top: 2px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 0; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 4px; }
.sidebar-nav-item {
    display: flex; align-items: center; gap: 12px; padding: 9px 14px; margin: 1px 8px;
    color: rgba(255,255,255,.55); cursor: pointer; border-radius: 8px; transition: all .15s; font-size: 13px;
    font-weight: 500; user-select: none; position: relative; text-decoration: none;
}
.sidebar-nav-item:hover { background: rgba(255,255,255,.06); color: rgba(255,255,255,.9); }
.sidebar-nav-item.active { background: rgba(76,111,255,.18); color: #fff; }
.sidebar-nav-item.active::before {
    content: ''; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px;
    background: #4C6FFF; border-radius: 0 3px 3px 0;
}
.sidebar-nav-item .nav-icon {
    width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: color .15s;
}
.sidebar-nav-item .nav-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-nav-item.active .nav-icon { color: #4C6FFF; }
.sidebar-divider { height: 1px; background: rgba(255,255,255,.06); margin: 6px 20px; }
.sidebar-footer { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-user { font-size: 13px; color: rgba(255,255,255,.7); margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.sidebar-logout {
    background: none; border: none; color: rgba(255,255,255,.35); cursor: pointer; font-size: 12px;
    padding: 6px 0; transition: color .2s;
}
.sidebar-logout:hover { color: #ef4444; }
.sidebar-badge { background: #ef4444; color: #fff; }
.sidebar-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 99;
}

/* Main */
.crm-main { flex: 1; margin-left: 240px; min-height: 100vh; display: flex; flex-direction: column; min-width: 0; }
.crm-topbar {
    height: 56px; border-bottom: 1px solid var(--border); display: flex; align-items: center;
    padding: 0 28px; gap: 16px; position: sticky; top: 0; background: rgba(255,255,255,.85);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); z-index: 50;
}
.page-title { font-size: 18px; font-weight: 600; flex: 1; letter-spacing: -0.3px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.menu-toggle { display: none; background: none; border: none; cursor: pointer; padding: 4px; flex-direction: column; gap: 4px; }
.menu-toggle span { display: block; width: 20px; height: 2px; background: var(--text-secondary); border-radius: 1px; }
.maintenance-notice {
    display: flex; align-items: center; gap: 8px; padding: 9px 28px; background: #fff7ed; color: #9a3412;
    border-bottom: 1px solid #fed7aa; font-size: 13px; font-weight: 500; line-height: 1.4;
}
.maintenance-notice-icon { flex: 0 0 auto; }
.crm-content { padding: 24px; flex: 1; min-width: 0; overflow-x: hidden; }

/* === Cards === */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-card); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 600; }

/* Inline editable fields in deal overview */
.ov-inline-input {
    width: 100%; font-size: 13px; color: var(--text-primary); background: transparent;
    border: 1px solid transparent; border-radius: var(--radius); padding: 4px 6px;
    outline: none; transition: border-color .2s, background .2s; font-family: inherit;
}
.ov-inline-input:hover { border-color: var(--border); background: var(--bg-secondary); }
.ov-inline-input:focus { border-color: var(--accent); background: var(--bg-card); box-shadow: 0 0 0 2px rgba(76,111,255,.15); }
select.ov-inline-input { cursor: pointer; -webkit-appearance: auto; appearance: auto; }
textarea.ov-inline-input { resize: vertical; min-height: 60px; }

/* Stat cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 20px; box-shadow: var(--shadow-card); transition: border-color .2s, transform .2s;
}
.stat-card:hover { border-color: rgba(76,111,255,.25); transform: translateY(-1px); }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text-primary); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .5px; }
.stat-card.accent .stat-value { color: var(--accent); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card .stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.stat-card .stat-icon svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.stat-card.accent .stat-icon { background: rgba(76,111,255,.1); color: var(--accent); }
.stat-card.success .stat-icon { background: rgba(34,197,94,.1); color: var(--success); }
.stat-card.warning .stat-icon { background: rgba(245,158,11,.1); color: var(--warning); }
.stat-card.danger .stat-icon { background: rgba(239,68,68,.1); color: var(--danger); }
.stat-card.danger .stat-value { color: var(--danger); }

/* Dashboard stats banner — gradient blue bar */
.dash-stats-banner {
    display: flex; gap: 0; align-items: stretch;
    background: linear-gradient(135deg, #4361EE 0%, #4C6FFF 40%, #5B7CF5 100%);
    border-radius: var(--radius-lg); margin-bottom: 24px;
    box-shadow: 0 4px 16px rgba(67,97,238,.3); overflow: hidden;
}
.dash-stats-banner .dash-stat {
    flex: 1; padding: 22px 24px; position: relative; text-align: center;
}
.dash-stats-banner .dash-stat + .dash-stat::before {
    content: ''; position: absolute; left: 0; top: 20%; bottom: 20%;
    width: 1px; background: rgba(255,255,255,.2);
}
.dash-stats-banner .dash-stat-label {
    font-size: 12px; color: rgba(255,255,255,.7); font-weight: 500; margin-bottom: 4px;
}
.dash-stats-banner .dash-stat-value {
    font-size: 28px; font-weight: 700; color: #fff;
}

/* Dashboard widgets */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.dash-widget {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card); overflow: hidden;
}
.dash-widget-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.dash-widget-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.dash-widget-link { font-size: 12px; color: var(--accent); cursor: pointer; font-weight: 500; transition: color .15s; }
.dash-widget-link:hover { color: var(--accent-hover); }
.dash-widget-body { padding: 12px 20px; }
.dash-widget-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 0;
    border-bottom: 1px solid var(--border); font-size: 13px; cursor: pointer; transition: background .1s;
}
.dash-widget-item:last-child { border-bottom: none; }
.dash-widget-item:hover { background: var(--bg-hover); margin: 0 -20px; padding-left: 20px; padding-right: 20px; }
.dash-widget-item-info { flex: 1; min-width: 0; }
.dash-widget-item-title { font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-widget-item-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.dash-widget-item-right { font-size: 12px; color: var(--text-secondary); flex-shrink: 0; text-align: right; }
.dash-widget-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 13px; }

@media (max-width: 900px) {
    .dash-grid { grid-template-columns: 1fr; }
    .dash-stats-banner { flex-wrap: wrap; }
    .dash-stats-banner .dash-stat { min-width: 50%; }
    .dash-stats-banner .dash-stat + .dash-stat::before { display: none; }
}

/* === Tables === */
.table-wrap {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
    overflow-x: auto; box-shadow: var(--shadow-card);
}
table { width: 100%; border-collapse: collapse; }
thead th {
    text-align: left; padding: 12px 16px; font-size: 12px; font-weight: 600;
    color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap;
    text-transform: uppercase; letter-spacing: .5px;
}
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }

/* === Tags === */
.tag {
    display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
}
.tag-active { background: rgba(34,197,94,.15); color: var(--success); }
.tag-paused { background: rgba(245,158,11,.15); color: var(--warning); }
.tag-churned { background: rgba(239,68,68,.15); color: var(--danger); }
.tag-completed { background: rgba(99,102,241,.15); color: var(--accent); }
.tag-inactive { background: rgba(100,116,139,.15); color: var(--text-muted); }

.dept-tag {
    display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
    background: var(--accent-dim); color: var(--accent);
}

.role-tag { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.role-superadmin { background: rgba(239,68,68,.15); color: var(--danger); }
.role-admin { background: rgba(245,158,11,.15); color: var(--warning); }
.role-department_head { background: rgba(34,197,94,.15); color: var(--success); }
.role-employee { background: var(--accent-dim); color: var(--accent); }
.role-client { background: rgba(100,116,139,.15); color: var(--text-muted); }

.grade-tag { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.grade-Junior { background: rgba(100,116,139,.15); color: var(--text-muted); }
.grade-Middle { background: var(--accent-dim); color: var(--accent); }
.grade-Senior { background: rgba(245,158,11,.15); color: var(--warning); }
.grade-Lead { background: rgba(34,197,94,.15); color: var(--success); }
.grade-Head { background: rgba(239,68,68,.15); color: var(--danger); }

/* === Tabs === */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); padding-bottom: 0; }
.tab-btn, .tabs > .tab {
    padding: 10px 16px; background: none; border: none; border-bottom: 2px solid transparent;
    color: var(--text-muted); cursor: pointer; font-size: 13px; font-weight: 500; transition: all .2s;
}
.tab-btn:hover, .tabs > .tab:hover { color: var(--text-secondary); }
.tab-btn.active, .tabs > .tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* === Autocomplete dropdown === */
.ac-dropdown {
    display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 300;
    max-height: 200px; overflow-y: auto;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.ac-item {
    padding: 8px 12px; cursor: pointer; transition: background .1s;
}
.ac-item:hover { background: var(--bg-hover); }

/* === Modal === */
.modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45);
    z-index: 200; align-items: flex-start; justify-content: center; padding: 40px 20px; overflow-y: auto;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
    width: 100%; max-width: 640px; max-height: none;
}
.modal-wide { max-width: 900px; }
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 16px; font-weight: 600; flex: 1; min-width: 0; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 24px; cursor: pointer; padding: 0 4px; }
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 24px; max-height: calc(100vh - 160px); overflow-y: auto; }

/* === Pagination === */
.pagination { display: flex; align-items: center; gap: 4px; margin-top: 16px; justify-content: center; flex-wrap: wrap; }
.pagination-btn {
    padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--bg-card); color: var(--text-secondary); font-size: 12px; cursor: pointer;
    transition: all 0.15s; min-width: 32px; text-align: center;
}
.pagination-btn:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); border-color: var(--accent); }
.pagination-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.pagination-btn:disabled { opacity: 0.4; cursor: default; }
.pagination-info { font-size: 12px; color: var(--text-muted); margin-left: 8px; }

/* === Toast === */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 12px 20px; font-size: 13px; color: var(--text-primary); box-shadow: 0 4px 20px rgba(0,0,0,.4);
    animation: toastIn .3s ease;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* === Activity Feed === */
.activity-feed { list-style: none; }
.activity-item {
    display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex-shrink: 0; }
.activity-dot.created { background: var(--success); }
.activity-dot.updated { background: var(--warning); }
.activity-dot.deleted { background: var(--danger); }
.activity-text { flex: 1; color: var(--text-secondary); }
.activity-text strong { color: var(--text-primary); }
.activity-time { color: var(--text-muted); font-size: 12px; white-space: nowrap; }

/* === Empty State === */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .5; }
.empty-state p { font-size: 14px; }

/* === Search === */
.search-bar {
    display: flex; gap: 12px; margin-bottom: 20px; align-items: center;
}
.search-input {
    flex: 1; padding: 10px 14px; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text-primary); font-size: 14px; outline: none;
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-muted); }

/* === Avatar === */
.avatar {
    width: 36px; height: 36px; border-radius: 50%; background: var(--accent-dim); color: var(--accent);
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
    flex-shrink: 0; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }

/* === Detail header === */
.detail-header {
    display: flex; gap: 16px; align-items: center; margin-bottom: 24px;
    padding-bottom: 20px; border-bottom: 1px solid var(--border);
}
.detail-info h2 { font-size: 20px; font-weight: 600; }
.detail-info p { font-size: 13px; color: var(--text-muted); }
.detail-actions { margin-left: auto; display: flex; gap: 8px; }

/* === Section === */
.section { margin-bottom: 24px; }
.section-title { font-size: 14px; font-weight: 600; color: var(--text-secondary); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }

/* === Kanban Board === */
.kanban-board {
    display: flex; gap: 16px; overflow-x: auto; padding-bottom: 16px;
    min-height: 400px;
}
.kanban-column {
    min-width: 280px; max-width: 320px; flex-shrink: 0;
    background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-lg);
    display: flex; flex-direction: column;
}
.kanban-column-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.kanban-column-title { font-weight: 700; font-size: 14px; color: var(--accent); }
.kanban-column-count { font-size: 12px; color: var(--text-muted); }
.kanban-cards { padding: 12px; display: flex; flex-direction: column; gap: 10px; flex: 1; overflow-y: auto; }
.kanban-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 12px; cursor: pointer; transition: border-color .15s; position: relative;
}
.kanban-card:hover { border-color: var(--accent); }
.kanban-card-status {
    position: absolute; top: 0; left: 0; width: 4px; height: 100%;
    border-radius: var(--radius) 0 0 var(--radius);
}
.kanban-card-title { font-size: 13px; font-weight: 600; padding-left: 8px; margin-bottom: 8px; line-height: 1.4; }
.kanban-card-meta {
    display: flex; gap: 8px; align-items: center; padding-left: 8px; flex-wrap: wrap;
}
.kanban-card-tag { font-size: 11px; font-weight: 600; }
.kanban-card-deadline { font-size: 11px; color: var(--text-muted); }
.kanban-card-deadline.overdue { color: var(--danger); font-weight: 600; }
.kanban-card-assignee {
    display: flex; align-items: center; gap: 6px; padding-left: 8px; margin-top: 8px;
    font-size: 11px; color: var(--text-secondary);
}
.kanban-card-assignee .avatar { width: 22px; height: 22px; font-size: 9px; }
.kanban-card[draggable="true"] { cursor: grab; }
.kanban-card[draggable="true"]:active { cursor: grabbing; }
.kanban-column[data-status] { transition: background 0.15s; }

/* === Deal Pipeline === */
.deal-pipeline { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 16px; min-height: 500px; }
.deal-pipeline-col {
    min-width: 260px; max-width: 300px; flex-shrink: 0;
    background: var(--bg-secondary); border-radius: var(--radius); border: 1px solid var(--border);
    display: flex; flex-direction: column;
}
.deal-pipeline-header { padding: 14px; border-bottom: 1px solid var(--border); }
.deal-pipeline-title { font-weight: 700; font-size: 13px; color: var(--text-primary); }
.deal-pipeline-count {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--accent-dim); color: var(--accent); font-size: 11px; font-weight: 700;
}
.deal-pipeline-amount { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.deal-pipeline-cards { padding: 10px; display: flex; flex-direction: column; gap: 8px; flex: 1; overflow-y: auto; max-height: 600px; }
.deal-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
    padding: 12px; cursor: pointer; position: relative; transition: border-color 0.15s, box-shadow 0.15s;
}
.deal-card:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(76, 111, 255, 0.15); }
.deal-card[draggable="true"] { cursor: grab; }
.deal-card-stripe { position: absolute; top: 0; left: 0; width: 4px; height: 100%; border-radius: 8px 0 0 8px; }
.deal-card-title { font-size: 13px; font-weight: 600; padding-left: 8px; margin-bottom: 6px; line-height: 1.3; }
.deal-card-contact { font-size: 12px; color: var(--text-secondary); padding-left: 8px; margin-bottom: 4px; }
.deal-card-phone { font-size: 12px; padding-left: 8px; margin-bottom: 4px; }
.deal-card-phone a { color: var(--accent); text-decoration: none; }
.deal-card-phone a:hover { text-decoration: underline; }
.deal-card-site { font-size: 11px; color: var(--text-muted); padding-left: 8px; margin-bottom: 4px; }
.deal-card-amount { font-size: 13px; font-weight: 700; color: var(--accent); padding-left: 8px; margin-bottom: 4px; }
.deal-card-inn { font-size: 11px; color: var(--text-muted); padding-left: 8px; margin-bottom: 4px; }
.deal-card-services { padding-left: 8px; margin-bottom: 6px; display: flex; flex-wrap: wrap; gap: 3px; }
.deal-card-footer { display: flex; justify-content: space-between; align-items: center; padding-left: 8px; }
.deal-card-channel { font-size: 10px; color: var(--text-muted); }
.deal-card-resp .avatar { width: 22px; height: 22px; font-size: 9px; }

.deal-lost-section { margin-top: 16px; border: 1px solid var(--border); border-radius: var(--radius); }
.deal-lost-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; cursor: pointer; font-size: 13px; color: var(--text-secondary);
}
.deal-lost-header:hover { color: var(--text-primary); }

/* File list */
.file-item {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 0; border-bottom: 1px solid var(--border);
}
.file-item:last-child { border-bottom: none; }

/* === View Toggle === */
.view-toggle {
    display: flex; gap: 2px; background: var(--bg-secondary); border-radius: var(--radius);
    padding: 3px; border: 1px solid var(--border);
}
.view-toggle-btn {
    padding: 6px 14px; background: none; border: none; border-radius: 6px;
    color: var(--text-muted); cursor: pointer; font-size: 13px; font-weight: 500;
    transition: all 0.15s; white-space: nowrap;
}
.view-toggle-btn:hover { color: var(--text-secondary); }
.view-toggle-btn.active { background: var(--accent); color: #fff; }

/* === Org Tree === */
.org-tree-container { overflow-x: auto; padding: 20px 0 40px; }

.org-tree, .org-tree ul { list-style: none; margin: 0; padding: 0; }
.org-tree { display: flex; justify-content: center; }

.org-tree ul {
    display: flex; justify-content: center; position: relative; padding-top: 28px;
}

/* Vertical connector: parent card down to children horizontal bar */
.org-tree ul::before {
    content: ''; position: absolute; top: 0; left: 50%;
    height: 28px; border-left: 2px solid var(--border);
}

.org-tree li {
    display: flex; flex-direction: column; align-items: center;
    position: relative; padding: 28px 8px 0;
}

/* Vertical connector: horizontal bar down to child card */
.org-tree li::before {
    content: ''; position: absolute; top: 0; left: 50%;
    height: 28px; border-left: 2px solid var(--border);
}

/* Horizontal bar connecting siblings */
.org-tree li::after {
    content: ''; position: absolute; top: 0;
    left: 0; right: 0; border-top: 2px solid var(--border);
}

.org-tree li:first-child::after { left: 50%; }
.org-tree li:last-child::after { right: 50%; left: auto; }
.org-tree li:only-child::after { display: none; }

/* Root item: no connectors going up */
.org-tree > li { padding-top: 0; }
.org-tree > li::before, .org-tree > li::after { display: none; }

/* Org card */
.org-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 14px 18px; min-width: 180px; max-width: 260px;
    cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; text-align: left;
}
.org-card:hover {
    border-color: var(--accent); box-shadow: 0 2px 12px rgba(99, 102, 241, 0.15);
}

.org-card-name {
    font-size: 14px; font-weight: 600; margin-bottom: 6px;
    display: flex; justify-content: space-between; align-items: center;
}

.org-card-edit {
    font-size: 12px; color: var(--text-muted); cursor: pointer;
    padding: 2px 4px; border-radius: 4px; opacity: 0; transition: opacity 0.15s;
}
.org-card:hover .org-card-edit { opacity: 1; }
.org-card-edit:hover { color: var(--accent); background: var(--accent-dim); }

.org-card-head {
    font-size: 12px; color: var(--text-secondary); margin-bottom: 8px;
    display: flex; align-items: center; gap: 6px;
}

.org-card-meta {
    display: flex; gap: 10px; font-size: 11px; color: var(--text-muted);
}

/* === Responsive === */
@media (max-width: 768px) {
    /* Layout */
    .crm-sidebar { transform: translateX(-100%); }
    .crm-sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }
    .crm-main { margin-left: 0; }
    .menu-toggle { display: flex; }
    .crm-content { padding: 12px; }
    .crm-topbar { padding: 0 12px; gap: 8px; height: 48px; }
    .maintenance-notice { padding: 8px 12px; font-size: 12px; }
    .page-title { font-size: 15px; }
    .sidebar-nav a { padding: 12px 20px; min-height: 44px; }

    /* Forms */
    .form-row { flex-direction: column; gap: 0; }

    /* Grids */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .dash-grid { gap: 14px; }

    /* Cards */
    .card { padding: 14px; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 22px; }

    /* Tables */
    table th, table td { padding: 8px 6px; font-size: 12px; }

    /* Tabs — horizontal scroll */
    .tabs { overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .tabs::-webkit-scrollbar { display: none; }
    .tab { padding: 10px 14px; font-size: 12px; flex-shrink: 0; }
    .profile-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .profile-tabs::-webkit-scrollbar { display: none; }
    .profile-tab { padding: 10px 14px; font-size: 12px; white-space: nowrap; }

    /* Buttons */
    .btn-sm { padding: 6px 10px; font-size: 11px; }

    /* Kanban */
    .kanban-board { gap: 10px; min-height: 300px; -webkit-overflow-scrolling: touch; }
    .kanban-column { min-width: 260px; max-width: 260px; }
    .kanban-column-header { padding: 10px 12px; }
    .kanban-cards { padding: 8px; gap: 8px; }
    .kanban-card { padding: 14px; }

    /* Deal pipeline */
    .deal-pipeline { gap: 10px; min-height: 350px; -webkit-overflow-scrolling: touch; }
    .deal-pipeline-col { min-width: 240px; max-width: 260px; }
    .deal-pipeline-cards { max-height: 400px; }
    .deal-card { padding: 14px; }

    /* Modals */
    .modal { margin: 10px; max-width: calc(100vw - 20px); }

    /* Task filters */
    .task-filter-row { flex-wrap: wrap !important; gap: 8px !important; }
    .task-filter-row select { min-width: 0 !important; flex: 1 1 auto !important; max-width: 100% !important; }
    .task-filter-row .task-filter-actions { width: 100%; margin-left: 0 !important; justify-content: flex-start; }

    /* Detail pages */
    .detail-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .detail-actions { margin-left: 0; flex-wrap: wrap; }
    .detail-info h2 { font-size: 17px; }

    /* Deal detail header buttons */
    .deal-detail-actions { flex-wrap: wrap !important; gap: 6px !important; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .dash-stats-banner { flex-direction: column; }
    .dash-stat { min-width: 100%; }
    /* Full-screen modals */
    .modal-overlay { padding: 0; }
    .modal { margin: 0; max-width: 100vw; border-radius: 0; min-height: 100vh; }
    .modal-body { max-height: calc(100vh - 56px); }
    .modal-xlarge { margin: 0; max-width: 100vw; border-radius: 0; }
    /* Metrics grid (ekonomika, admin-violations, KPI) */
    .metrics-grid { grid-template-columns: 1fr !important; }
}
/* === XLarge Modal === */
.modal-xlarge { max-width: 1100px; }

/* === Task Detail Layout === */
.task-detail-layout {
    display: flex; gap: 24px;
}
.task-detail-left { flex: 1; min-width: 0; }
.task-detail-right { width: 300px; flex-shrink: 0; }

.task-detail-left .task-field { margin-bottom: 16px; }
.task-detail-left .task-field label {
    display: block; font-size: 11px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px;
}
.task-detail-left .task-field input,
.task-detail-left .task-field textarea {
    width: 100%; background: var(--bg-main); border: 1px solid var(--border);
    color: var(--text-primary); padding: 8px 10px; border-radius: var(--radius);
    font-size: 13px; font-family: inherit; transition: border-color .3s;
}
.task-detail-left .task-field input.task-title-input {
    font-size: 16px; font-weight: 600; padding: 10px 12px;
}
.task-detail-left .task-field textarea { min-height: 80px; resize: vertical; }

.task-section { margin-bottom: 20px; }
.task-section-title {
    font-size: 12px; font-weight: 600; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px;
    display: flex; align-items: center; gap: 8px;
}

/* Checklists */
.checklist-items { margin-bottom: 8px; }
.checklist-item {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 8px; border-radius: var(--radius);
    transition: background .15s;
}
.checklist-item:hover { background: var(--bg-hover); }
.checklist-item.checked .checklist-text {
    text-decoration: line-through; color: var(--text-muted);
}
.checklist-text { flex: 1; font-size: 13px; }
.checklist-item .checklist-del {
    opacity: 0; cursor: pointer; color: var(--danger); font-size: 14px;
    background: none; border: none; padding: 2px 4px;
}
.checklist-item:hover .checklist-del { opacity: 1; }
.checklist-add {
    display: flex; gap: 6px; margin-top: 6px;
}
.checklist-add input {
    flex: 1; background: var(--bg-main); border: 1px solid var(--border);
    color: var(--text-primary); padding: 6px 10px; border-radius: var(--radius);
    font-size: 12px;
}
.checklist-progress {
    height: 4px; background: var(--border); border-radius: 2px;
    margin-bottom: 8px; overflow: hidden;
}
.checklist-progress-bar {
    height: 100%; background: var(--accent); border-radius: 2px;
    transition: width .3s;
}

/* Task Files */
.task-file-item {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 8px; border-radius: var(--radius);
    font-size: 12px; transition: background .15s;
}
.task-file-item:hover { background: var(--bg-hover); }
.task-file-item a { color: var(--accent); text-decoration: none; flex: 1; }
.task-file-item a:hover { text-decoration: underline; }
.task-file-size { color: var(--text-muted); font-size: 11px; }
.task-file-del {
    opacity: 0; cursor: pointer; color: var(--danger); font-size: 14px;
    background: none; border: none; padding: 2px 4px;
}
.task-file-item:hover .task-file-del { opacity: 1; }

/* Right sidebar meta */
.task-meta { margin-bottom: 12px; }
.task-meta label {
    display: block; font-size: 10px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 3px;
}
.task-meta select,
.task-meta input {
    width: 100%; background: var(--bg-main); border: 1px solid var(--border);
    color: var(--text-primary); padding: 6px 8px; border-radius: var(--radius);
    font-size: 13px; font-family: inherit; transition: border-color .3s;
}

/* Timer */
.task-timer-block {
    padding: 12px; background: var(--bg-hover); border-radius: var(--radius-lg);
    margin-bottom: 16px; text-align: center;
}
.timer-total {
    font-size: 22px; font-weight: 700; color: var(--text-primary);
    display: block; margin-bottom: 4px;
}
.timer-session {
    font-size: 11px; color: var(--text-muted); margin-bottom: 8px;
}
.btn-timer-start {
    background: #22c55e; color: #fff; border: none; padding: 8px 20px;
    border-radius: var(--radius); cursor: pointer; font-size: 13px; font-weight: 600;
}
.btn-timer-start:hover { background: #16a34a; }
.btn-timer-stop {
    background: var(--danger); color: #fff; border: none; padding: 8px 20px;
    border-radius: var(--radius); cursor: pointer; font-size: 13px; font-weight: 600;
}
.btn-timer-stop:hover { background: #dc2626; }

/* Field save flash */
.field-saved { border-color: #22c55e !important; }
.field-error { border-color: var(--danger) !important; }

/* Responsive task detail */
@media (max-width: 768px) {
    .task-detail-layout { flex-direction: column; }
    .task-detail-right { width: 100%; }
    .modal-xlarge { margin: 10px; max-width: calc(100vw - 20px); }
}

/* === Profile Tabs === */
.profile-tabs {
    display: flex; gap: 0; margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
}
.profile-tab {
    padding: 12px 20px; background: none; border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted); cursor: pointer; font-size: 14px;
    font-weight: 500; transition: all .2s; white-space: nowrap;
}
.profile-tab:hover { color: var(--text-secondary); }
.profile-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.profile-tab-content { min-height: 400px; }

/* === My Tasks Filters === */
.my-tasks-filters {
    display: flex; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap;
}
.my-tasks-filters select {
    padding: 7px 12px; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text-primary); font-size: 13px;
}
.my-tasks-table { width: 100%; }
.my-tasks-table th {
    cursor: pointer; user-select: none;
}
.my-tasks-table th:hover { color: var(--text-secondary); }

/* === Calendar === */
.calendar-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px;
}
.calendar-header h3 { font-size: 18px; font-weight: 600; }
.calendar-nav {
    display: flex; gap: 8px; align-items: center;
}
.calendar-nav-btn {
    background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary);
    width: 32px; height: 32px; border-radius: var(--radius); cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-size: 16px;
    transition: all .15s;
}
.calendar-nav-btn:hover { color: var(--text-primary); border-color: var(--accent); }

.calendar-grid {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px;
    background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-lg);
    overflow: hidden;
}
.calendar-day-header {
    background: var(--bg-secondary); padding: 8px 4px; text-align: center;
    font-size: 11px; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px;
}
.calendar-day {
    background: var(--bg-card); min-height: 90px; padding: 6px;
    position: relative; vertical-align: top; cursor: default;
    min-width: 0; overflow: hidden;
}
.calendar-day.other-month { background: var(--bg-primary); opacity: 0.4; }
.calendar-day.today { background: rgba(99,102,241,.08); }
.calendar-day.weekend { background: rgba(100,116,139,.06); }
.calendar-day.holiday { background: rgba(239,68,68,.06); }
.calendar-day.weekend.holiday { background: rgba(239,68,68,.08); }

.calendar-day-num {
    font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px;
    display: flex; justify-content: space-between; align-items: center;
}
.calendar-day.today .calendar-day-num {
    color: var(--accent);
}
.calendar-day.holiday .calendar-day-num {
    color: var(--danger);
}

.calendar-holiday-name {
    font-size: 9px; color: var(--danger); opacity: 0.7;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 100%;
}

.calendar-events { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }

.calendar-event {
    font-size: 10px; padding: 2px 5px; border-radius: 3px;
    background: var(--accent-dim); color: var(--accent);
    cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    transition: background .15s; line-height: 1.3;
}
.calendar-event:hover { background: rgba(99,102,241,.25); }

.calendar-deadline-dot {
    width: 6px; height: 6px; border-radius: 50%;
    display: inline-block; margin-right: 2px; flex-shrink: 0;
}

.calendar-deadline-item {
    font-size: 10px; color: var(--text-secondary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    display: flex; align-items: center; gap: 3px; line-height: 1.3;
}

/* === Gantt Chart === */
.gantt-container {
    overflow-x: auto; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); position: relative;
}
.gantt-header-row {
    display: flex; position: sticky; top: 0; z-index: 2;
    background: var(--bg-secondary); border-bottom: 1px solid var(--border);
}
.gantt-label-col {
    width: 220px; min-width: 220px; flex-shrink: 0;
    padding: 8px 12px; font-size: 11px; font-weight: 600;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
    border-right: 1px solid var(--border);
}
.gantt-timeline-header {
    display: flex; flex: 1; min-width: 0;
}
.gantt-day-header {
    min-width: 32px; flex: 1; text-align: center; padding: 8px 0;
    font-size: 10px; color: var(--text-muted); border-right: 1px solid var(--border);
    position: relative;
}
.gantt-day-header.weekend { background: rgba(100,116,139,.06); }
.gantt-day-header.today { background: rgba(99,102,241,.1); color: var(--accent); font-weight: 700; }
.gantt-day-header.holiday { color: var(--danger); }

.gantt-body { position: relative; }

.gantt-row {
    display: flex; border-bottom: 1px solid var(--border); min-height: 36px;
}
.gantt-row:last-child { border-bottom: none; }
.gantt-row:hover { background: var(--bg-hover); }

.gantt-row-label {
    width: 220px; min-width: 220px; flex-shrink: 0;
    padding: 8px 12px; font-size: 12px; color: var(--text-primary);
    border-right: 1px solid var(--border);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    display: flex; align-items: center; gap: 6px;
}
.gantt-row-label-project {
    font-size: 10px; color: var(--text-muted);
}

.gantt-row-timeline {
    flex: 1; display: flex; position: relative; min-width: 0;
}
.gantt-cell {
    min-width: 32px; flex: 1; border-right: 1px solid var(--border);
    position: relative;
}
.gantt-cell.weekend { background: rgba(100,116,139,.04); }

.gantt-bar {
    position: absolute; top: 6px; height: 24px; border-radius: 4px;
    display: flex; align-items: center; padding: 0 6px;
    font-size: 10px; color: #fff; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    z-index: 1; min-width: 4px;
}
.gantt-bar.status-in_progress { background: var(--accent); }
.gantt-bar.status-completed { background: var(--success); opacity: 0.7; }
.gantt-bar.status-needs_client { background: var(--warning); }
.gantt-bar.status-blocker { background: var(--danger); }
.gantt-bar.status-needs_employee { background: var(--text-muted); }

.gantt-today-line {
    position: absolute; top: 0; bottom: 0; width: 2px;
    background: var(--danger); z-index: 3; pointer-events: none;
}

.gantt-empty {
    padding: 40px; text-align: center; color: var(--text-muted); font-size: 13px;
}

/* Meeting form */
.meeting-attendees-list {
    max-height: 200px; overflow-y: auto; border: 1px solid var(--border);
    border-radius: var(--radius); padding: 8px;
    background: var(--bg-secondary);
}
.meeting-attendee-item {
    display: flex; align-items: center; gap: 8px; padding: 4px 0;
    font-size: 13px;
}
.meeting-attendee-item input[type="checkbox"] {
    accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer;
}

/* === Responsive Calendar & Gantt === */
@media (max-width: 768px) {
    .profile-tabs { overflow-x: auto; }
    .calendar-day { min-height: 60px; padding: 4px; }
    .calendar-event { font-size: 9px; }
    .calendar-deadline-item { font-size: 9px; }
    .gantt-label-col, .gantt-row-label { width: 140px; min-width: 140px; }
    .my-tasks-filters { flex-direction: column; align-items: stretch; }
}

/* ══════════════════════════════════════════════════════════════════
   SPRINT MODULE
   ══════════════════════════════════════════════════════════════════ */
.sprint-wrap { max-width: 1200px; }

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

/* --- Stats --- */
.sprint-stats {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
    margin-bottom: 24px;
}
.sprint-stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; padding: 18px 20px;
}
.sprint-stat-card.sprint-stat-over {
    border-color: rgba(239,68,68,.4);
    background: rgba(239,68,68,.04);
}
.sprint-stat-title {
    font-size: 13px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .5px; color: var(--text-muted); margin-bottom: 2px;
}
.sprint-stat-period {
    font-size: 12px; color: var(--text-muted); margin-bottom: 12px;
}
.sprint-stat-bar {
    height: 6px; background: var(--border); border-radius: 3px;
    overflow: hidden; margin-bottom: 8px;
}
.sprint-stat-fill {
    height: 100%; border-radius: 3px;
    background: var(--accent);
    transition: width .4s ease;
}
.sprint-stat-over .sprint-stat-fill { background: #ef4444; }
.sprint-stat-nums {
    display: flex; justify-content: space-between;
    font-size: 13px; color: var(--text-secondary);
}
.sprint-stat-nums b { color: var(--text-primary); }

/* --- Tabs --- */
.sprint-tabs {
    display: flex; gap: 4px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 16px;
}
.sprint-tab {
    background: none; border: none;
    padding: 10px 20px; font-size: 14px; font-weight: 500;
    color: var(--text-muted); cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px; transition: all .15s;
}
.sprint-tab:hover { color: var(--text-primary); background: rgba(0,0,0,.04); }
.sprint-tab.active {
    color: var(--accent); border-bottom-color: var(--accent);
}
.sprint-tab-badge {
    display: inline-block; font-size: 11px; font-weight: 600;
    background: var(--border); color: var(--text-muted);
    padding: 1px 7px; border-radius: 10px; margin-left: 6px;
}
.sprint-tab.active .sprint-tab-badge {
    background: var(--accent); color: #fff;
}

/* --- Task table --- */
.sprint-task-section { margin-top: 20px; }
.sprint-task-section-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; font-weight: 600; color: var(--text-primary);
    margin-bottom: 8px;
}
.sprint-task-section-badge {
    padding: 1px 7px; border-radius: 10px;
    background: var(--border); color: var(--text-muted);
    font-size: 11px; font-weight: 600;
}
.sprint-table { display: flex; flex-direction: column; gap: 2px; }

.sprint-row {
    display: grid;
    grid-template-columns: 36px 130px 1fr 160px 160px;
    align-items: center; gap: 12px;
    padding: 10px 14px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 8px; cursor: pointer;
    transition: background .15s;
}
.sprint-row:hover { background: rgba(0,0,0,.03); }

.sprint-row.sprint-row-head {
    background: none; border: none; cursor: default;
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .5px; color: var(--text-muted);
    padding: 4px 14px;
}
.sprint-row.sprint-row-head:hover { background: none; }

/* When project column visible */
.sprint-row:not(.sprint-row-head) { /* default 4 cols */ }

.sprint-col-check { display: flex; align-items: center; justify-content: center; }

.sprint-bulk-bar {
    display: flex; align-items: center; gap: 12px; padding: 10px 16px; margin-bottom: 8px;
    background: var(--accent); border-radius: 8px; color: #fff;
}
.sprint-bulk-bar .btn { color: #fff; border-color: rgba(255,255,255,.3); }
.sprint-bulk-bar .btn:hover { background: rgba(255,255,255,.15); }

.sprint-col-status {}
.sprint-col-title {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    font-size: 14px;
}
.sprint-col-project {
    font-size: 12px; color: var(--text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sprint-project-link:hover { color: var(--accent); text-decoration: underline; }
.sprint-col-deadline { font-size: 13px; }
.sprint-col-time { display: flex; flex-direction: column; gap: 3px; }

/* Status badges */
.sprint-status {
    display: inline-block; font-size: 11px; font-weight: 600;
    padding: 3px 10px; border-radius: 10px;
    white-space: nowrap;
}
.sprint-st-notstarted { background: rgba(148,163,184,.15); color: #94a3b8; }
.sprint-st-progress  { background: rgba(99,102,241,.15); color: #6366f1; }
.sprint-st-client    { background: rgba(245,158,11,.15); color: #f59e0b; }
.sprint-st-employee  { background: rgba(59,130,246,.15); color: #3b82f6; }
.sprint-st-blocker   { background: rgba(239,68,68,.15);  color: #ef4444; }
.sprint-st-done      { background: rgba(34,197,94,.15);  color: #22c55e; }

/* Deadline colors */
.sprint-overdue { color: #ef4444; font-weight: 600; }
.sprint-today   { color: #f59e0b; font-weight: 600; }

/* Time bar */
.sprint-time-bar {
    height: 4px; background: var(--border); border-radius: 2px;
    overflow: hidden;
}
.sprint-time-fill {
    height: 100%; border-radius: 2px; background: var(--accent);
    transition: width .3s;
}
.sprint-time-over .sprint-time-fill { background: #ef4444; }
.sprint-time-label { font-size: 11px; color: var(--text-muted); }

/* Tag + checklist */
.sprint-tag {
    display: inline-block; font-size: 10px; font-weight: 600;
    padding: 2px 7px; border-radius: 8px; color: #fff;
    vertical-align: middle; margin-right: 4px;
}
.sprint-check {
    font-size: 11px; color: var(--text-muted);
    margin-left: 6px;
}

/* Completed task — strikethrough */
.sprint-row.sprint-completed {
    opacity: .55;
}
.sprint-row.sprint-completed .sprint-col-title {
    text-decoration: line-through;
}
.sprint-row.sprint-completed:hover { opacity: .75; }

/* Reopen button */
.sprint-reopen-btn {
    background: none; border: 1px solid var(--border); color: var(--text-muted);
    font-size: 14px; cursor: pointer; padding: 1px 6px; border-radius: 4px;
    margin-left: 6px; line-height: 1.2; vertical-align: middle;
    transition: all .15s;
}
.sprint-reopen-btn:hover { color: var(--accent); border-color: var(--accent); }

/* Filter bar */
.form-input {
    padding: 8px 12px; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text-primary); font-size: 13px; font-family: inherit;
}
.form-input:focus { border-color: var(--accent); outline: none; }

.sprint-filter-bar {
    display: flex; gap: 10px; margin-bottom: 10px;
}
.sprint-filter-search {
    max-width: 280px;
}
.sprint-filter-select {
    max-width: 200px;
}

/* Sort icons in header */
.sprint-sortable {
    cursor: pointer; user-select: none;
    display: flex; align-items: center; gap: 4px;
}
.sprint-sortable:hover { color: var(--text-primary); }
.sprint-sort-icon {
    font-size: 12px; opacity: .3; line-height: 1;
}
.sprint-sort-icon.active { opacity: 1; color: var(--accent); }

/* --- Internal grid for project tasks (5 cols) --- */
.sprint-row.has-project {
    grid-template-columns: 36px 130px 1fr 180px 100px 140px;
}

/* --- Create form --- */
.sprint-form { display: flex; flex-direction: column; gap: 14px; }
.sprint-form .form-group { margin: 0; }
.sprint-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Checklist in modal */
.sprint-checklist-add {
    display: flex; gap: 6px; margin-top: 6px;
}
.sprint-checklist-add .form-input { flex: 1; }
.sprint-checklist-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 10px; margin-bottom: 4px;
    background: rgba(0,0,0,.02); border: 1px solid var(--border);
    border-radius: 6px; font-size: 13px;
}
.sprint-checklist-rm {
    background: none; border: none; color: var(--text-muted);
    font-size: 18px; cursor: pointer; padding: 0 4px; line-height: 1;
}
.sprint-checklist-rm:hover { color: #ef4444; }

/* Files in modal */
.sprint-file-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 10px; margin-bottom: 4px;
    background: rgba(0,0,0,.02); border: 1px solid var(--border);
    border-radius: 6px; font-size: 13px;
}
.sprint-file-item small { color: var(--text-muted); }
.sprint-file-btn { display: inline-block; margin-top: 6px; cursor: pointer; }

/* --- Responsive --- */
@media (max-width: 900px) {
    .sprint-stats { grid-template-columns: 1fr; }
    .sprint-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    .sprint-row.sprint-row-head { display: none; }
    .sprint-col-check { order: 0; }
    .sprint-col-status { order: 1; }
    .sprint-col-title { order: 2; white-space: normal; }
    .sprint-col-project { order: 3; }
    .sprint-col-deadline { order: 4; }
    .sprint-col-time { order: 5; }
    .sprint-bulk-bar { flex-wrap: wrap; }
    .sprint-form-row { grid-template-columns: 1fr; }
    .sprint-filter-bar { flex-direction: column; }
    .sprint-filter-search, .sprint-filter-select { max-width: 100%; }
}

/* ═══ Vacation Calendar ═══════════════════════════════════════════ */
.vac-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 16px;
}
.vac-cal-header {
    font-size: 11px; font-weight: 600;
    text-align: center; padding: 8px 0;
}
.vac-cal-cell {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    min-height: 56px;
    padding: 4px 6px;
    font-size: 12px;
}
.vac-cal-empty {
    background: transparent; border-color: transparent;
}
.vac-cal-today {
    border-color: var(--accent); border-width: 2px;
}
.vac-cal-weekend {
    background: rgba(0,0,0,.02);
}
.vac-cal-holiday {
    background: rgba(239,68,68,.06);
}
.vac-cal-day {
    font-weight: 600; margin-bottom: 2px;
}
.vac-cal-dots {
    display: flex; flex-wrap: wrap; gap: 3px;
}
.vac-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-muted);
}
.vac-dot-vacation { background: var(--accent); }
.vac-dot-dayoff   { background: #f59e0b; }
.vac-dot-pending  { background: transparent; border: 2px dashed var(--text-muted); width: 6px; height: 6px; }
.vac-dot-mine     { width: 10px; height: 10px; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--accent); }

/* Legend */
.vac-legend {
    display: inline-block; width: 10px; height: 10px;
    border-radius: 50%; margin-right: 4px; vertical-align: middle;
}
.vac-legend-vacation { background: var(--accent); }
.vac-legend-dayoff   { background: #f59e0b; }
.vac-legend-pending  { background: transparent; border: 2px dashed var(--text-muted); width: 8px; height: 8px; }
.vac-legend-mine     { background: var(--accent); box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--accent); }
.vac-dot-meeting     { background: #22c55e; }
.vac-legend-meeting  { background: #22c55e; }

/* Clickable calendar cells */
.vac-cal-clickable { cursor: pointer; transition: background 0.15s, border-color 0.15s; position: relative; }
.vac-cal-clickable:hover { background: rgba(99,102,241,0.06); border-color: var(--primary); }
.vac-date-btn { cursor: pointer; min-height: 38px; display: flex; align-items: center; }
.vac-date-btn:hover { border-color: var(--primary); }
.calendar-day-click { cursor: pointer; position: relative; }
.calendar-day-click:hover { background: rgba(99,102,241,0.08); }

/* Vacation days in profile calendar */
.calendar-day.vacation-day {
    background: linear-gradient(135deg, rgba(167,139,250,0.18), rgba(167,139,250,0.08));
    border-color: rgba(167,139,250,0.4);
}
.calendar-day.vacation-day:hover {
    background: linear-gradient(135deg, rgba(167,139,250,0.28), rgba(167,139,250,0.12));
}
.calendar-day.vacation-pending {
    background: repeating-linear-gradient(45deg, rgba(167,139,250,0.10), rgba(167,139,250,0.10) 6px, transparent 6px, transparent 12px);
    border-color: rgba(167,139,250,0.35);
}

.calendar-vacation-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    color: #7c3aed;
    background: rgba(167,139,250,0.18);
    border: 1px solid rgba(167,139,250,0.35);
    border-radius: 4px;
    padding: 2px 5px;
    margin-bottom: 2px;
    cursor: pointer;
    line-height: 1.2;
}
.calendar-vacation-badge:hover {
    background: rgba(167,139,250,0.28);
}
.calendar-vacation-badge.pending {
    border-style: dashed;
    opacity: 0.85;
}
.calendar-vacation-badge.colleague {
    color: #a78bfa;
    background: rgba(167,139,250,0.10);
    cursor: default;
}

/* Birthday days */
.calendar-day.birthday-day {
    background: linear-gradient(135deg, rgba(251,191,36,0.12), rgba(251,191,36,0.04));
}
.calendar-day.birthday-day.vacation-day {
    background: linear-gradient(135deg, rgba(167,139,250,0.18), rgba(251,191,36,0.16));
}
.calendar-birthday-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    color: #d97706;
    background: rgba(251,191,36,0.18);
    border: 1px solid rgba(251,191,36,0.4);
    border-radius: 4px;
    padding: 2px 5px;
    margin-bottom: 2px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ─────────── Google-style calendar ─────────── */

/* View toggle (Месяц / Неделя) */
.cal-view-toggle {
    display: inline-flex;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
}
.cal-view-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 999px;
    cursor: pointer;
    transition: all .15s;
}
.cal-view-btn:hover { color: var(--text-primary); }
.cal-view-btn.active {
    background: var(--bg-card);
    color: var(--accent);
    box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}

/* ── Month view: clean Google-style cells ── */
.calendar-day-num-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1;
}
.calendar-day-num-badge.today-circle {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.calendar-day.today { background: transparent; }
.calendar-day.today .calendar-day-num { color: var(--text-secondary); }

/* Event row: dot + time + title */
.cal-event-row {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    line-height: 1.3;
    color: var(--text-primary);
    padding: 2px 6px;
    margin-bottom: 2px;
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: filter .12s;
    min-width: 0;
    max-width: 100%;
}
.cal-event-row > * { min-width: 0; }
.cal-event-row.meeting {
    background: rgba(34, 197, 94, 0.14);
    color: #15803d;
    border-left: 3px solid #22c55e;
    font-weight: 600;
}
.cal-event-row.meeting:hover { filter: brightness(0.96); }
.cal-event-row.meeting .cal-event-dot { display: none; }
.cal-event-row.meeting .cal-event-time {
    color: inherit;
    opacity: 0.85;
    font-weight: 600;
    flex-shrink: 0;
}
.cal-event-row.deadline {
    background: transparent;
    color: var(--text-primary);
    padding: 1px 4px;
    cursor: default;
    font-weight: 500;
}
.cal-event-row.deadline:hover { background: transparent; }
.cal-event-dot {
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
}
.cal-event-time {
    color: var(--text-muted);
    font-weight: 500;
    flex-shrink: 0;
}

/* Event pill: full-width colored bar */
.cal-event-pill {
    display: block;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.3;
    padding: 2px 6px;
    margin-bottom: 2px;
    border-radius: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}
.cal-event-pill.holiday {
    background: #16a34a;
    color: #fff;
    cursor: default;
}
.cal-event-pill.vacation {
    background: #a78bfa;
    color: #fff;
}
.cal-event-pill.vacation.pending {
    background: rgba(167, 139, 250, 0.45);
    border: 1px dashed #a78bfa;
    color: #6d4dd6;
}
.cal-event-pill.vacation.colleague {
    background: rgba(167, 139, 250, 0.18);
    color: #7c5fd6;
    border: 1px solid rgba(167, 139, 250, 0.4);
    cursor: default;
}
.cal-event-pill.birthday {
    background: #fbbf24;
    color: #78350f;
    cursor: default;
}

/* Events container — allow shrinking inside grid cell */
.calendar-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    overflow: hidden;
}

/* ── Week view: Google-style time grid ── */
.gcal-week {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(100vh - 240px);
    user-select: none;
    position: relative;
}
.gcal-week-row {
    display: grid;
    grid-template-columns: 60px repeat(7, minmax(0, 1fr));
}

/* Headers row — sticky at top during scroll */
.gcal-week-headers {
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
}
.gcal-time-corner {
    border-right: 1px solid var(--border);
}
.gcal-day-header {
    text-align: center;
    padding: 10px 4px;
    border-right: 1px solid var(--border);
}
.gcal-day-header:last-child { border-right: none; }
.gcal-day-header-name {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.gcal-day-header-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
}
.gcal-day-header-num.today-circle {
    background: var(--accent);
    color: #fff;
}
.gcal-day-header.today .gcal-day-header-name {
    color: var(--accent);
}

/* All-day row — sticky below headers */
.gcal-week-allday {
    border-bottom: 1px solid var(--border);
    min-height: 32px;
    background: var(--bg-card);
    position: sticky;
    top: 56px;
    z-index: 9;
}
.gcal-allday-label {
    font-size: 9px;
    text-align: right;
    padding: 6px 6px 0 0;
    color: var(--text-muted);
    line-height: 1.1;
    text-transform: uppercase;
}
.gcal-allday-cell {
    border-right: 1px solid var(--border);
    padding: 4px 3px;
    min-height: 32px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.gcal-allday-cell:last-child { border-right: none; }
.gcal-allday-cell:hover { background: var(--bg-hover); }
.gcal-allday-pill {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    cursor: pointer;
}
.gcal-allday-pill.holiday {
    background: #16a34a;
    color: #fff;
    cursor: default;
}
.gcal-allday-pill.vacation {
    background: #a78bfa;
    color: #fff;
}
.gcal-allday-pill.vacation.pending {
    background: rgba(167, 139, 250, 0.45);
    border: 1px dashed #a78bfa;
    color: #6d4dd6;
}
.gcal-allday-pill.vacation.colleague {
    background: rgba(167, 139, 250, 0.18);
    color: #7c5fd6;
    border: 1px solid rgba(167, 139, 250, 0.4);
    cursor: default;
}
.gcal-allday-pill.birthday {
    background: #fbbf24;
    color: #78350f;
    cursor: default;
}
.gcal-allday-pill.deadline {
    background: rgba(239, 68, 68, 0.15);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.3);
    cursor: default;
}
.gcal-allday-pill.deadline.done {
    background: rgba(34, 197, 94, 0.15);
    color: #15803d;
    border-color: rgba(34, 197, 94, 0.3);
}
.gcal-allday-pill.deadline.colleague {
    background: rgba(167, 139, 250, 0.10);
    color: #7c5fd6;
    border-color: rgba(167, 139, 250, 0.3);
}

/* Time grid (hour rows × day columns) — no own scroll, parent .gcal-week scrolls */
.gcal-week-grid {
    position: relative;
}
.gcal-time-axis {
    border-right: 1px solid var(--border);
    background: var(--bg-card);
    position: sticky;
    left: 0;
    z-index: 2;
}
.gcal-hour-row {
    border-bottom: 1px solid var(--border);
    position: relative;
    box-sizing: border-box;
}
.gcal-hour-row:last-child { border-bottom: none; }
.gcal-hour-label {
    position: absolute;
    top: -7px;
    right: 6px;
    font-size: 10px;
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 0 2px;
    line-height: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
}
.gcal-hour-msk {
    color: var(--text-secondary);
    font-weight: 600;
}
.gcal-hour-loc {
    color: var(--text-muted);
    font-size: 9px;
}
.gcal-hour-single {
    color: var(--text-muted);
}

/* Day columns */
.gcal-day-col {
    position: relative;
    border-right: 1px solid var(--border);
    cursor: pointer;
    background: transparent;
}
.gcal-day-col:last-child { border-right: none; }
.gcal-day-col.weekend { background: rgba(127, 127, 127, 0.04); }
.gcal-day-col.today { background: rgba(59, 130, 246, 0.04); }
.gcal-day-col.vacation-day {
    background: repeating-linear-gradient(
        135deg,
        rgba(167, 139, 250, 0.08),
        rgba(167, 139, 250, 0.08) 8px,
        rgba(167, 139, 250, 0.14) 8px,
        rgba(167, 139, 250, 0.14) 16px
    );
}
.gcal-day-col.vacation-pending {
    background: repeating-linear-gradient(
        135deg,
        rgba(167, 139, 250, 0.04),
        rgba(167, 139, 250, 0.04) 8px,
        rgba(167, 139, 250, 0.08) 8px,
        rgba(167, 139, 250, 0.08) 16px
    );
}
.gcal-hour-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 0;
    border-bottom: 1px solid var(--border);
    pointer-events: none;
}
.gcal-half-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 0;
    border-bottom: 1px dashed rgba(127, 127, 127, 0.12);
    pointer-events: none;
}

/* Event blocks */
.gcal-event {
    position: absolute;
    background: #22c55e;
    color: #fff;
    border-radius: 4px;
    padding: 3px 6px;
    font-size: 11px;
    line-height: 1.3;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.18);
    border-left: 3px solid #15803d;
    transition: filter .12s;
    z-index: 1;
}
.gcal-event:hover {
    filter: brightness(1.1);
    z-index: 5;
}
.gcal-event-title {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.gcal-event-time {
    font-size: 10px;
    opacity: 0.9;
    margin-top: 1px;
}

/* Current time indicator */
.gcal-now-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: #ef4444;
    pointer-events: none;
    z-index: 3;
}
.gcal-now-line::before {
    content: '';
    position: absolute;
    left: -5px;
    top: -4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ef4444;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .gcal-week-row { grid-template-columns: 42px repeat(7, 1fr); }
    .gcal-day-header-name { font-size: 9px; }
    .gcal-day-header-num { width: 26px; height: 26px; font-size: 14px; }
    .gcal-hour-label { font-size: 9px; right: 3px; }
    .gcal-event { font-size: 10px; padding: 2px 4px; }
    .gcal-event-time { font-size: 9px; }
}

/* Calendar action buttons */
.cal-action-btns { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.btn-success { background: #22c55e; color: #fff; border: none; cursor: pointer; border-radius: var(--radius); font-weight: 600; }
.btn-success:hover { background: #16a34a; }

/* Day popup */
.cal-day-popup {
    position: absolute; z-index: 100;
    top: 100%; left: 50%; transform: translateX(-50%);
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    padding: 10px; min-width: 180px; font-size: 12px;
    margin-top: 2px;
}
.cal-day-popup-header { font-weight: 700; margin-bottom: 6px; font-size: 13px; }
.cal-day-popup-section { margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.cal-day-popup-actions { display: flex; gap: 6px; }

/* Meeting employee row in form */
.meet-emp-row {
    display: flex; align-items: center; gap: 8px; padding: 6px 10px;
    cursor: pointer; font-size: 13px; border-bottom: 1px solid var(--border);
}
.meet-emp-row:hover { background: var(--bg-hover); }

/* Weekday toggles */
.weekday-toggles { display: flex; gap: 6px; flex-wrap: wrap; }
.weekday-toggle {
    display: flex; align-items: center; gap: 4px;
    padding: 6px 10px; border: 1px solid var(--border);
    border-radius: var(--radius); cursor: pointer; font-size: 13px;
}
.weekday-toggle:has(input:checked) { background: var(--primary); color: #fff; border-color: var(--primary); }

@media (max-width: 900px) {
    .vac-cal-cell { min-height: 40px; padding: 2px 4px; }
    .vac-cal-header { font-size: 10px; padding: 4px 0; }
    .vac-dot { width: 6px; height: 6px; }
}

/* ============ Topbar Icon Buttons ============ */
.topbar-icon-btn { cursor: pointer; padding: 6px 10px; border-radius: var(--radius); transition: background 0.2s; position: relative; display: flex; align-items: center; }
.topbar-icon-btn:hover { background: var(--bg-hover); }
.topbar-icon-svg svg { width: 20px; height: 20px; fill: none; stroke: var(--text-secondary); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.topbar-icon-btn:hover .topbar-icon-svg svg { stroke: var(--text-primary); }

/* ============ Notification Bell ============ */
.notif-bell { cursor: pointer; font-size: 20px; padding: 6px 10px; border-radius: var(--radius); transition: background 0.2s; position: relative; }
.notif-bell:hover { background: var(--bg-hover); }
.notif-badge { position: absolute; top: 2px; right: 2px; background: #ef4444; color: #fff; font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 700; pointer-events: none; }
.notif-dropdown { position: absolute; top: calc(100% + 4px); right: 0; width: 360px; max-height: 420px; overflow-y: auto; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.3); z-index: 200; }
.notif-header { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.notif-item { padding: 10px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s; }
.notif-item:hover { background: var(--bg-hover); }
.notif-item.unread { background: rgba(99,102,241,.06); }
@media (max-width: 500px) {
    .notif-dropdown { width: 300px; right: -60px; }
}

/* ============ Task Comments ============ */
.task-comment { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); position: relative; }
.task-comment:last-child { border-bottom: none; }
.task-comment-body { flex: 1; min-width: 0; }
.task-comment-author { font-weight: 600; font-size: 12px; color: var(--text-primary); }
.task-comment-time { font-size: 11px; color: var(--text-muted); margin-left: 8px; }
.task-comment-text { font-size: 13px; margin-top: 4px; white-space: pre-wrap; word-break: break-word; color: var(--text-secondary); }
.tc-actions { float: right; opacity: 0; transition: opacity 0.15s; }
.task-comment:hover .tc-actions { opacity: 1; }
.tc-act-btn { background: none; border: none; cursor: pointer; font-size: 12px; padding: 2px 5px; border-radius: 3px; color: var(--text-muted); transition: color 0.15s, background 0.15s; }
.tc-act-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.tc-act-del:hover { color: var(--danger); }

/* ============ Messenger ============ */
.msg-layout { display: flex; height: calc(100vh - 104px); overflow: hidden; }
.msg-sidebar { width: 320px; border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
.msg-sidebar-header { padding: 12px; border-bottom: 1px solid var(--border); display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.msg-search { flex: 1; padding: 8px 12px; background: var(--bg-hover); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-primary); font-size: 13px; }
.msg-actions { display: flex; gap: 4px; flex-shrink: 0; }
.msg-actions .btn-sm { padding: 6px 8px; font-size: 14px; background: transparent; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; color: var(--text-secondary); transition: background 0.15s; }
.msg-actions .btn-sm:hover { background: var(--bg-hover); }
.msg-conv-list { flex: 1; overflow-y: auto; }
.msg-conv-item { padding: 12px 16px; cursor: pointer; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: center; transition: background 0.15s; }
.msg-conv-item:hover, .msg-conv-item.active { background: var(--bg-hover); }
.msg-conv-unread .msg-conv-name { font-weight: 700; }
.msg-conv-icon { font-size: 18px; flex-shrink: 0; width: 36px; height: 36px; background: var(--bg-hover); border-radius: 50%; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.msg-conv-avatar { font-size: 13px; font-weight: 600; background: var(--accent, #6366f1); color: #fff; }
.msg-conv-avatar img { width: 100%; height: 100%; object-fit: cover; }
.msg-conv-inactive { opacity: 0.45; }
.msg-conv-inactive .msg-conv-avatar { filter: grayscale(1); }
.msg-conv-info { flex: 1; min-width: 0; }
.msg-conv-name { font-size: 13px; font-weight: 600; color: var(--text-primary); display: flex; justify-content: space-between; align-items: baseline; }
.msg-conv-time { font-size: 11px; color: var(--text-muted); font-weight: 400; flex-shrink: 0; }
.msg-conv-last { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.msg-conv-badge { background: var(--accent); color: #fff; font-size: 10px; min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }

.msg-chat { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.msg-chat-header { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.msg-chat-title { font-weight: 600; font-size: 14px; }
.msg-chat-subtitle { font-size: 11px; color: var(--text-muted); }
.msg-back-btn { display: none; background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-primary); padding: 4px 8px; }
.msg-chat-messages { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 16px; }
.msg-chat-input { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: flex-end; flex-shrink: 0; position: relative; }
.msg-chat-input textarea { flex: 1; padding: 8px 12px; background: var(--bg-hover); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-primary); font-size: 13px; font-family: inherit; resize: none; max-height: 100px; }
.msg-empty-state { flex: 1; display: flex; align-items: center; justify-content: center; }

.msg-row { display: flex; gap: 8px; margin-bottom: 4px; align-items: flex-end; }
.msg-row-mine { flex-direction: row-reverse; }
.msg-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--bg-hover); font-size: 10px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); flex-shrink: 0; overflow: hidden; }
.msg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.msg-bubble { padding: 8px 14px; border-radius: 12px; font-size: 13px; line-height: 1.4; }
.msg-bubble-mine { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg-bubble-other { background: var(--bg-card); color: var(--text-primary); border-bottom-left-radius: 4px; border: 1px solid var(--border); }
.msg-bubble-author { font-size: 11px; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.msg-bubble-text { white-space: pre-wrap; word-break: break-word; }
.msg-bubble-time { font-size: 10px; opacity: 0.6; text-align: right; margin-top: 2px; }
.msg-date-sep { text-align: center; font-size: 11px; color: var(--text-muted); margin: 16px 0 8px; }

/* -- File attach & emoji buttons -- */
.msg-attach-btn, .msg-emoji-btn { background: none; border: none; cursor: pointer; font-size: 18px; padding: 4px 6px; border-radius: var(--radius); color: var(--text-muted); transition: background 0.15s, color 0.15s; flex-shrink: 0; }
.msg-attach-btn:hover, .msg-emoji-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* -- File preview above input -- */
.msg-file-preview { padding: 8px 16px; border-top: 1px solid var(--border); background: var(--bg-secondary); }
.msg-file-preview-inner { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-secondary); }
.msg-file-preview-inner img { border: 1px solid var(--border); }

/* -- Image in bubble -- */
.msg-bubble-img { margin: 6px 0 2px; }
.msg-bubble-img img { max-width: 260px; max-height: 200px; border-radius: 8px; cursor: pointer; display: block; }
.msg-bubble-mine .msg-bubble-img img { border: 1px solid rgba(255,255,255,0.2); }

/* -- File link in bubble -- */
.msg-file-link { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; margin-top: 4px; background: rgba(0,0,0,0.08); border-radius: 12px; font-size: 12px; color: inherit; text-decoration: none; transition: background 0.15s; }
.msg-file-link:hover { background: rgba(0,0,0,0.15); }
.msg-bubble-mine .msg-file-link { background: rgba(255,255,255,0.2); }
.msg-bubble-mine .msg-file-link:hover { background: rgba(255,255,255,0.3); }

/* -- File attachments (multiple) -- */
.file-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.file-attach-img { border-radius: 8px; overflow: hidden; }
.file-attach-img img { max-width: 220px; max-height: 160px; border-radius: 8px; cursor: pointer; display: block; }
.file-attach-audio { width: 100%; }
.file-attach-audio audio { width: 100%; max-width: 300px; height: 36px; }
.file-attach-video { display: flex; flex-direction: column; gap: 4px; max-width: 320px; }
.file-attach-video video { width: 100%; max-width: 320px; max-height: 240px; border-radius: 8px; background: #000; display: block; }
.file-attach-video-name { font-size: 11px; color: var(--text-muted); text-decoration: none; word-break: break-all; }
.file-attach-video-name:hover { text-decoration: underline; }
.msg-bubble-mine .file-attach-video video { border: 1px solid rgba(255,255,255,0.2); }
.msg-bubble-mine .file-attach-video-name { color: rgba(255,255,255,0.8); }
.file-attach-link { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; background: rgba(0,0,0,0.06); border-radius: 8px; font-size: 12px; color: var(--accent); text-decoration: none; transition: background 0.15s; word-break: break-all; }
.file-attach-link:hover { background: rgba(0,0,0,0.12); }
.msg-bubble-mine .file-attach-link { background: rgba(255,255,255,0.2); color: inherit; }
.msg-bubble-mine .file-attach-link:hover { background: rgba(255,255,255,0.3); }
.msg-bubble-mine .file-attach-img img { border: 1px solid rgba(255,255,255,0.2); }
.file-preview-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 0; }
.file-preview-item { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 6px; font-size: 12px; color: var(--text-secondary); }
.file-preview-icon { font-size: 14px; }
.file-preview-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-preview-remove { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 16px; padding: 0 2px; line-height: 1; }
.file-preview-remove:hover { color: var(--danger); }

/* -- Bubble wrap (for reaction positioning) -- */
.msg-bubble-wrap { position: relative; display: inline-flex; flex-direction: column; max-width: 70%; }
.msg-row-mine .msg-bubble-wrap { align-items: flex-end; }
.msg-bubble-wrap .msg-bubble { max-width: 100%; }

/* -- Action bar (on hover) -- */
/* For other-user messages (on the left side) — action bar appears to the RIGHT of the bubble */
.msg-action-bar { display: none; position: absolute; top: 2px; left: 100%; right: auto; margin-left: 6px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px; padding: 2px 4px; gap: 2px; z-index: 3; box-shadow: 0 2px 8px rgba(0,0,0,0.12); white-space: nowrap; }
/* For own messages (on the right side) — action bar appears to the LEFT of the bubble */
.msg-row-mine .msg-action-bar { left: auto; right: 100%; margin-left: 0; margin-right: 6px; }
.msg-bubble-wrap::before { content: ''; position: absolute; top: 0; left: 100%; width: 16px; height: 100%; }
.msg-row-mine .msg-bubble-wrap::before { left: auto; right: 100%; }
.msg-bubble-wrap:hover .msg-action-bar { display: flex; }
.msg-action-btn { background: none; border: none; cursor: pointer; font-size: 14px; padding: 3px 6px; border-radius: 6px; color: var(--text-muted); transition: background 0.15s, color 0.15s; }
.msg-action-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* -- More dropdown -- */
.msg-dropdown { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0,0,0,0.2); z-index: 100; min-width: 160px; overflow: hidden; }
.msg-dropdown-item { padding: 8px 14px; font-size: 13px; cursor: pointer; color: var(--text-primary); transition: background 0.15s; }
.msg-dropdown-item:hover { background: var(--bg-hover); }

/* -- Reaction badges under bubble -- */
.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.msg-reaction-badge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; background: var(--bg-hover); border: 1px solid var(--border); border-radius: 12px; font-size: 12px; cursor: pointer; transition: background 0.15s, border-color 0.15s; color: var(--text-secondary); }
.msg-reaction-badge:hover { background: var(--bg-secondary); }
.msg-reaction-badge.mine { background: rgba(59,130,246,0.15); border-color: rgba(59,130,246,0.4); color: var(--text-primary); }

/* -- Quote block in bubble -- */
.msg-quote { padding: 4px 8px; margin-bottom: 4px; border-left: 3px solid var(--accent); background: rgba(0,0,0,0.06); border-radius: 0 6px 6px 0; cursor: pointer; transition: background 0.15s; }
.msg-quote:hover { background: rgba(0,0,0,0.1); }
.msg-bubble-mine .msg-quote { background: rgba(255,255,255,0.15); border-left-color: rgba(255,255,255,0.5); }
.msg-bubble-mine .msg-quote:hover { background: rgba(255,255,255,0.2); }
.msg-quote-author { font-size: 11px; font-weight: 700; color: var(--accent); }
.msg-bubble-mine .msg-quote-author { color: rgba(255,255,255,0.8); }
.msg-quote-text { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.msg-bubble-mine .msg-quote-text { color: rgba(255,255,255,0.6); }

/* -- Forwarded label -- */
.msg-forwarded { font-size: 11px; color: var(--text-muted); font-style: italic; margin-bottom: 2px; }
.msg-bubble-mine .msg-forwarded { color: rgba(255,255,255,0.6); }

/* -- Edited mark -- */
.msg-edited { font-style: italic; opacity: 0.7; }

/* -- Reply preview above input -- */
.msg-reply-preview { padding: 8px 16px; border-top: 1px solid var(--border); background: var(--bg-secondary); flex-shrink: 0; }
.msg-reply-preview-inner { display: flex; align-items: center; gap: 10px; font-size: 12px; border-left: 3px solid var(--accent); padding-left: 8px; }
.msg-reply-preview-author { font-weight: 700; color: var(--accent); }
.msg-reply-preview-text { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* -- Edit bar above input -- */
.msg-edit-bar { padding: 8px 16px; border-top: 1px solid var(--border); background: var(--bg-secondary); flex-shrink: 0; }
.msg-edit-bar-inner { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--accent); font-weight: 500; }

/* -- Emoji picker -- */
.msg-emoji-picker { position: fixed; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-lg); width: 320px; max-height: 300px; z-index: 100; box-shadow: 0 4px 20px rgba(0,0,0,0.2); overflow: hidden; display: flex; flex-direction: column; }
.emoji-tabs { display: flex; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.emoji-tab { flex: 1; padding: 6px 4px; background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; font-size: 11px; color: var(--text-muted); transition: color 0.15s, border-color 0.15s; }
.emoji-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.emoji-tab:hover { color: var(--text-primary); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); padding: 8px; gap: 2px; overflow-y: auto; max-height: 240px; }
.emoji-item { cursor: pointer; font-size: 20px; padding: 4px; text-align: center; border-radius: var(--radius); transition: background 0.15s, transform 0.15s; }
.emoji-item:hover { background: var(--bg-hover); transform: scale(1.2); }

/* -- Voice record button -- */
.msg-voice-btn { background: none; border: none; cursor: pointer; font-size: 18px; padding: 4px 6px; border-radius: var(--radius); color: var(--text-muted); transition: background 0.15s, color 0.15s; flex-shrink: 0; }
.msg-voice-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* -- Voice recording bar -- */
.msg-voice-rec { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 12px; flex-shrink: 0; background: var(--bg-card); }
.msg-voice-cancel { background: none; border: none; cursor: pointer; font-size: 16px; padding: 4px 8px; border-radius: var(--radius); color: var(--danger); transition: background 0.15s; }
.msg-voice-cancel:hover { background: rgba(239,68,68,0.1); }
.msg-voice-indicator { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--danger); }
.msg-voice-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: voicePulse 1s ease-in-out infinite; display: inline-block; }
@keyframes voicePulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.msg-voice-send { background: var(--accent); color: #fff; border: none; cursor: pointer; padding: 8px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 600; transition: opacity 0.15s; }
.msg-voice-send:hover { opacity: 0.85; }

/* -- Voice player in bubble -- */
.msg-voice-player { display: flex; align-items: center; gap: 8px; padding: 4px 0; margin-top: 2px; min-width: 180px; }
.msg-vp-play { background: none; border: none; cursor: pointer; font-size: 16px; padding: 2px 4px; color: inherit; opacity: 0.8; transition: opacity 0.15s; flex-shrink: 0; }
.msg-vp-play:hover { opacity: 1; }
.msg-vp-wave { flex: 1; height: 6px; background: rgba(128,128,128,0.3); border-radius: 3px; cursor: pointer; position: relative; overflow: hidden; min-width: 100px; }
.msg-vp-progress { height: 100%; background: currentColor; opacity: 0.6; border-radius: 3px; width: 0%; transition: width 0.1s linear; }
.msg-bubble-mine .msg-vp-wave { background: rgba(255,255,255,0.25); }
.msg-bubble-mine .msg-vp-progress { background: #fff; opacity: 0.8; }
.msg-vp-time { font-size: 11px; opacity: 0.7; flex-shrink: 0; min-width: 30px; }

/* -- Conversation sections (pinned / folders / all) -- */
.msg-conv-section { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); background: var(--bg-secondary); cursor: pointer; user-select: none; border-bottom: 1px solid var(--border); transition: background 0.15s; }
.msg-conv-section:hover { background: var(--bg-hover); }
.msg-conv-section-arrow { font-size: 10px; color: var(--text-muted); }

/* -- Pin / more buttons on conv-item -- */
.msg-conv-item { position: relative; }
.msg-conv-pin-btn, .msg-conv-more-btn { position: absolute; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 13px; padding: 4px 6px; border-radius: var(--radius); color: var(--text-muted); opacity: 0; transition: opacity 0.15s, background 0.15s, color 0.15s; z-index: 2; }
.msg-conv-pin-btn { right: 30px; }
.msg-conv-more-btn { right: 6px; }
.msg-conv-item:hover .msg-conv-pin-btn,
.msg-conv-item:hover .msg-conv-more-btn { opacity: 1; }
.msg-conv-pin-btn:hover, .msg-conv-more-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.msg-conv-pin-btn.pinned { opacity: 1; color: var(--accent); }

/* -- Pinned bar (in chat header area) -- */
.msg-pinned-bar { padding: 8px 16px; border-bottom: 1px solid var(--border); background: var(--bg-secondary); flex-shrink: 0; cursor: pointer; }
.msg-pinned-bar-inner { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--accent); transition: opacity 0.15s; }
.msg-pinned-bar-inner:hover { opacity: 0.8; }

/* -- Pinned panel (expandable list) -- */
.msg-pinned-panel { max-height: 200px; overflow-y: auto; border-bottom: 1px solid var(--border); background: var(--bg-card); flex-shrink: 0; }
.msg-pinned-item { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-bottom: 1px solid var(--border); transition: background 0.15s; }
.msg-pinned-item:last-child { border-bottom: none; }
.msg-pinned-item:hover { background: var(--bg-hover); }
.msg-pinned-item-content { flex: 1; min-width: 0; cursor: pointer; }
.msg-pinned-item-author { font-size: 11px; font-weight: 700; color: var(--accent); }
.msg-pinned-item-text { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.msg-pinned-scope { font-weight: 400; font-size: 10px; color: var(--text-muted); background: var(--bg-hover); padding: 1px 6px; border-radius: 8px; margin-left: 4px; }

@media (max-width: 768px) {
    .msg-sidebar { width: 100%; }
    .msg-chat { display: none; }
    .msg-layout.chat-open .msg-sidebar { display: none; }
    .msg-layout.chat-open .msg-chat { display: flex; }
    .msg-layout.chat-open .msg-back-btn { display: block; }
    .msg-emoji-picker { width: 280px; left: 0; }
    .msg-conv-pin-btn, .msg-conv-more-btn { opacity: 1; }
}

/* === Knowledge Base === */
.kb-layout { display: flex; gap: 16px; min-height: 400px; }
.kb-sidebar { width: 240px; flex-shrink: 0; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 8px 0; max-height: calc(100vh - 200px); overflow-y: auto; }
.kb-content { flex: 1; min-width: 0; }

.kb-tree-item { display: flex; align-items: center; padding: 8px 12px; font-size: 13px; cursor: pointer; color: var(--text-secondary); border-left: 3px solid transparent; transition: all .15s; }
.kb-tree-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.kb-tree-item.active { background: var(--accent-dim); color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.kb-tree-actions { display: none; margin-left: auto; }
.kb-tree-item:hover .kb-tree-actions { display: flex; gap: 4px; }

.kb-item-card { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; cursor: pointer; transition: all .15s; }
.kb-item-card:hover { border-color: var(--accent); background: var(--bg-hover); }
.kb-item-icon { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; background: var(--bg-secondary); border-radius: var(--radius); flex-shrink: 0; }
.kb-item-info { flex: 1; min-width: 0; }
.kb-item-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kb-item-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-item-meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kb-item-actions { display: flex; gap: 4px; flex-shrink: 0; opacity: .4; }
.kb-item-card:hover .kb-item-actions { opacity: 1; }

.kb-type-badge { font-size: 10px; padding: 1px 6px; border-radius: 4px; color: #fff; font-weight: 600; white-space: nowrap; }

@media (max-width: 768px) {
    .kb-layout { flex-direction: column; }
    .kb-sidebar { width: 100%; max-height: none; }
}

/* === Ekonomika === */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.metric-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 20px; transition: border-color .15s;
}
.metric-card:hover { border-color: var(--accent); }
.metric-title { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.metric-value { font-size: 24px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.metric-sub { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.metric-good { border-left: 3px solid var(--success); }
.metric-good .metric-value { color: var(--success); }
.metric-bad { border-left: 3px solid var(--danger); }
.metric-bad .metric-value { color: var(--danger); }
.metric-warn { border-left: 3px solid var(--warning); }
.metric-warn .metric-value { color: var(--warning); }

.tag-payroll { background: rgba(99,102,241,.15); color: var(--accent); }
.tag-admin { background: rgba(100,116,139,.15); color: var(--text-muted); }
.tag-commercial { background: rgba(245,158,11,.15); color: var(--warning); }
.tag-direct { background: rgba(34,197,94,.15); color: var(--success); }
.tag-tax { background: rgba(239,68,68,.15); color: var(--danger); }

.eko-row { margin-top: 24px; }

@media (max-width: 768px) {
    .metrics-grid { grid-template-columns: repeat(2, 1fr); }
    .eko-row { grid-template-columns: 1fr !important; }
}

/* === Activity Log === */
.activity-log-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.activity-log-table th { text-align: left; padding: 10px 12px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); border-bottom: 1px solid var(--border); background: var(--bg-secondary); }
.activity-log-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.activity-log-table tbody tr:hover { background: rgba(0,0,0,.02); }
.activity-log-table tbody tr:last-child td { border-bottom: none; }

/* === Project Chat === */
.project-chat { display: flex; flex-direction: column; height: calc(70vh - 60px); min-height: 300px; }
.project-chat-messages { flex: 1; overflow-y: auto; padding: 16px 8px; display: flex; flex-direction: column; gap: 8px; }
.pchat-msg { display: flex; gap: 8px; max-width: 80%; align-items: flex-start; }
.pchat-msg.pchat-msg-mine { margin-left: auto; flex-direction: row-reverse; }
.pchat-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--bg-secondary); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: var(--text-muted); flex-shrink: 0; overflow: hidden; }
.pchat-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pchat-bubble-wrap { max-width: calc(100% - 40px); }
.pchat-author { font-size: 12px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.pchat-position { font-weight: 400; color: var(--text-muted); font-size: 11px; }
.pchat-bubble { padding: 8px 12px; border-radius: 12px; position: relative; }
.pchat-other { background: var(--bg-card); border-top-left-radius: 4px; border: 1px solid var(--border); }
.pchat-mine { background: var(--accent); color: #fff; border-top-right-radius: 4px; }
.pchat-text { font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.pchat-meta { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.pchat-time { font-size: 10px; color: var(--text-muted); }
.pchat-mine .pchat-time { color: rgba(255,255,255,0.6); }
.pchat-edited { font-size: 10px; color: var(--text-muted); font-style: italic; }
.pchat-mine .pchat-edited { color: rgba(255,255,255,0.5); }
.pchat-actions { display: none; position: absolute; top: -6px; right: 4px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; padding: 2px; }
.pchat-msg-mine .pchat-actions { right: auto; left: 4px; }
.pchat-bubble:hover .pchat-actions { display: flex; gap: 2px; }
.pchat-action-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 12px; padding: 2px 4px; border-radius: 4px; }
.pchat-action-btn:hover { background: var(--bg-secondary); color: var(--text-primary); }
.project-chat-input { display: flex; gap: 8px; align-items: flex-end; padding: 12px 8px; border-top: 1px solid var(--border); background: var(--bg-secondary); border-radius: 0 0 var(--radius) var(--radius); }
.pchat-input { flex: 1; background: var(--bg-primary); border: 1px solid var(--border); border-radius: 8px; color: var(--text-primary); padding: 8px 12px; font-size: 13px; font-family: inherit; resize: none; min-height: 38px; max-height: 100px; }
.pchat-input:focus { border-color: var(--accent); outline: none; }
.pchat-send-btn { background: var(--accent); color: #fff; border: none; border-radius: 8px; width: 38px; height: 38px; cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pchat-send-btn:hover { opacity: 0.9; }
.pchat-attach-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 18px; padding: 8px; border-radius: 8px; flex-shrink: 0; }
.pchat-attach-btn:hover { color: var(--text-primary); background: var(--bg-primary); }
.pchat-file-preview { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--bg-primary); border: 1px solid var(--border); border-radius: 6px; font-size: 12px; color: var(--text-secondary); }
.pchat-file-remove { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 12px; padding: 2px 4px; margin-left: auto; }
.pchat-file-remove:hover { color: var(--danger); }
.pchat-file { margin-top: 6px; }
.pchat-file-img { max-width: 240px; max-height: 180px; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; }
.pchat-file-link { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--accent); text-decoration: none; padding: 4px 0; }
.pchat-file-link:hover { text-decoration: underline; }
.auto-link { color: var(--accent); word-break: break-all; text-decoration: underline; }
.auto-link:hover { opacity: 0.8; }
.pchat-mine .auto-link { color: #fff; }
.pchat-mine .pchat-file-link { color: #fff; }
.msg-bubble-mine .auto-link { color: #fff; }

/* === Mentions === */
.mention-dropdown { position: fixed; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.4); z-index: 10001; max-height: 240px; overflow-y: auto; display: none; }
.mention-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; }
.mention-item:hover, .mention-item-active { background: var(--bg-secondary); }
.mention-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--bg-secondary); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; color: var(--text-muted); flex-shrink: 0; overflow: hidden; }
.mention-avatar img { width: 100%; height: 100%; object-fit: cover; }
.mention-info { min-width: 0; }
.mention-name { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.mention-pos { font-size: 11px; color: var(--text-muted); }
.mention-highlight { color: var(--accent); font-weight: 500; }
.mention-highlight-client { color: #f59e0b; }
/* Упоминания в "своих" пузырях чатов — белые на цветной полупрозрачной плашке, чтобы не сливались с фоном */
.msg-bubble-mine .mention-highlight,
.pchat-mine .mention-highlight { color: #fff; background: rgba(255,255,255,0.18); padding: 0 4px; border-radius: 4px; }
.msg-bubble-mine .mention-highlight-client,
.pchat-mine .mention-highlight-client { color: #fff8e1; background: rgba(245,158,11,0.35); }
.mention-client-tag { font-size: 9px; padding: 1px 5px; border-radius: 9999px; background: #f59e0b22; color: #f59e0b; font-weight: 600; margin-left: 4px; vertical-align: middle; }
.mention-item-client { border-left: 2px solid #f59e0b; }

/* === Message author position === */
.msg-author-position { color: var(--text-muted); font-size: 11px; font-weight: 400; }

/* === Sidebar badge === */
.sidebar-badge { display: inline-flex; align-items: center; justify-content: center; background: var(--danger, #ef4444); color: #fff; font-size: 10px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px; margin-left: auto; }

/* === New messages separator === */
.msg-new-sep { display: flex; align-items: center; gap: 12px; padding: 6px 16px; margin: 4px 0; }
.msg-new-sep::before, .msg-new-sep::after { content: ''; flex: 1; height: 1px; background: var(--danger, #ef4444); opacity: 0.5; }
.msg-new-sep span { font-size: 11px; color: var(--danger, #ef4444); font-weight: 600; white-space: nowrap; }

/* === Read receipts === */
.msg-read-check { font-size: 12px; margin-left: 4px; letter-spacing: -2px; opacity: 1; color: rgba(255,255,255,0.5); }
.msg-read-check.read { color: #fff; }
.msg-bubble-other .msg-read-check { color: var(--text-muted); }
.msg-bubble-other .msg-read-check.read { color: var(--accent); }

/* === Online status indicator === */
.online-dot { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; margin-top: 2px; }
.online-dot .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.online-dot .dot.green { background: #22c55e; box-shadow: 0 0 4px rgba(34,197,94,0.5); }
.online-dot .dot.red { background: #ef4444; }

/* === Skeleton shimmer === */
@keyframes shimmer {
    0% { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}
.skeleton {
    background: linear-gradient(90deg, var(--bg-hover) 25%, rgba(255,255,255,0.15) 50%, var(--bg-hover) 75%);
    background-size: 800px 100%;
    animation: shimmer 1.5s infinite ease-in-out;
    border-radius: var(--radius);
}
.skeleton-line { height: 14px; margin-bottom: 10px; border-radius: 6px; }
.skeleton-line:nth-child(odd) { width: 80%; }
.skeleton-line:nth-child(even) { width: 55%; }
.skeleton-line:last-child { width: 40%; margin-bottom: 0; }
.skeleton-card { height: 80px; border-radius: var(--radius); }
.skeleton-row { height: 44px; margin-bottom: 6px; border-radius: var(--radius); }
.skeleton-circle { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }
.skeleton-widget-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.skeleton-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; margin-bottom: 20px; }

/* === Global Search === */
.global-search-wrap { position: relative; margin-right: 8px; }
.global-search-input {
    width: 220px; padding: 7px 12px; font-size: 13px;
    background: var(--bg-hover); border: 1px solid var(--border); border-radius: 8px;
    color: var(--text-primary); outline: none; transition: border-color 0.15s, width 0.2s;
}
.global-search-input:focus { border-color: var(--accent); width: 280px; }
.global-search-input::placeholder { color: var(--text-muted); }
.global-search-results {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0; min-width: 320px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px rgba(0,0,0,0.25); max-height: 420px; overflow-y: auto; z-index: 1000;
}
.global-search-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px;
    cursor: pointer; transition: background 0.1s; border-bottom: 1px solid var(--border);
}
.global-search-item:last-child { border-bottom: none; }
.global-search-item:hover { background: var(--bg-hover); }
.global-search-icon { font-size: 16px; flex-shrink: 0; width: 24px; text-align: center; }
.global-search-item-info { flex: 1; min-width: 0; }
.global-search-item-title { font-size: 13px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.global-search-item-sub { font-size: 11px; color: var(--text-muted); }
@media (max-width: 768px) {
    .global-search-input { width: 140px; }
    .global-search-input:focus { width: 180px; }
    .global-search-results { min-width: 260px; left: auto; right: 0; }
}

/* === Credential Vault === */
.cred-group { margin-bottom: 12px; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.cred-group-header {
    display: flex; align-items: center; gap: 8px; padding: 12px 16px;
    background: var(--bg-secondary); cursor: pointer; user-select: none;
    font-size: 14px; font-weight: 600; color: var(--text-primary);
}
.cred-group-header:hover { background: var(--bg-hover); }
.cred-group-arrow { font-size: 10px; transition: transform 0.2s; color: var(--text-muted); }
.cred-group.collapsed .cred-group-arrow { transform: rotate(-90deg); }
.cred-group.collapsed .cred-group-body { display: none; }
.cred-group-count {
    margin-left: auto; font-size: 11px; font-weight: 500;
    background: var(--accent-dim); color: var(--accent); padding: 2px 8px; border-radius: 10px;
}
.cred-group-body { border-top: 1px solid var(--border); }
.cred-group-body .table-wrap { margin: 0; border-radius: 0; box-shadow: none; }
.cred-copy-field { display: inline-flex; align-items: center; gap: 4px; }
.cred-copy-btn {
    background: none; border: none; cursor: pointer; font-size: 14px; padding: 2px 4px;
    opacity: 0.4; transition: opacity 0.15s;
}
.cred-copy-btn:hover { opacity: 1; }
.cred-pass-field { display: inline-flex; align-items: center; gap: 4px; }
.cred-pass-dots { font-size: 12px; color: var(--text-secondary); font-family: monospace; letter-spacing: 1px; }

/* === Project Reports === */
.report-header-card {
    background: linear-gradient(135deg, var(--accent) 0%, #3B5EF0 100%);
    border-radius: var(--radius-lg); padding: 24px 28px; margin-bottom: 20px; color: #fff;
}
.report-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.report-period { font-size: 13px; opacity: 0.85; }
.report-section { margin-bottom: 24px; }
.report-section-title {
    font-size: 15px; font-weight: 700; color: var(--text-primary);
    margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid var(--border);
}
.report-task-list {
    border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden;
}
.report-task-item {
    display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px;
    border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.1s;
}
.report-task-item:last-child { border-bottom: none; }
.report-task-item:hover { background: var(--bg-hover); }
.report-task-item.completed { background: rgba(34,197,94,0.04); }
.report-task-status { flex-shrink: 0; padding-top: 3px; }
.report-task-info { flex: 1; min-width: 0; }
.report-task-title { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.report-task-result { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.report-task-assignee { font-size: 12px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
@media (max-width: 768px) {
    .report-header-card { padding: 16px 20px; }
    .report-title { font-size: 17px; }
    .report-task-assignee { display: none; }
}

/* ============================================================
   RICH TEXT EDITOR — TinyMCE overrides + display styles
   ============================================================ */

/* Editor container */
.tox.tox-tinymce { border: 1px solid var(--border) !important; border-radius: var(--radius) !important; }
.tox .tox-toolbar-overlord { background: var(--bg-secondary) !important; }
.tox .tox-toolbar__primary { background: transparent !important; }
.tox .tox-tbtn { color: var(--text-secondary) !important; border-radius: 4px !important; }
.tox .tox-tbtn:hover { background: var(--bg-hover) !important; color: var(--text-primary) !important; }
.tox .tox-tbtn--enabled, .tox .tox-tbtn--enabled:hover { background: rgba(79,125,243,0.12) !important; color: var(--accent) !important; }
.tox .tox-tbtn svg { fill: currentColor !important; }
.tox .tox-toolbar__group:not(:last-of-type) { border-right: 1px solid var(--border) !important; }
.tox .tox-statusbar { background: var(--bg-secondary) !important; border-top: 1px solid var(--border) !important; }
.tox .tox-statusbar__text-container { color: var(--text-muted) !important; }

/* Rich content display */
.rich-content { word-break: break-word; line-height: 1.5; font-size: 13px; }
.rich-content p { margin: 0 0 6px 0; }
.rich-content p:last-child { margin-bottom: 0; }
.rich-content ul, .rich-content ol { margin: 4px 0; padding-left: 20px; }
.rich-content li { margin: 2px 0; }
.rich-content table { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 12px; }
.rich-content table td, .rich-content table th { border: 1px solid var(--border); padding: 6px 10px; }
.rich-content table th { background: var(--bg-secondary); font-weight: 600; }
.rich-content img { max-width: 100%; height: auto; border-radius: 6px; margin: 4px 0; cursor: pointer; }
.rich-content a { color: var(--accent); text-decoration: underline; }
.rich-content a:hover { opacity: 0.8; }
/* Ссылки в "своих" пузырях чатов — белые, чтобы не сливались с фоном-акцентом */
.msg-bubble-mine .rich-content a,
.msg-bubble-mine.rich-content a,
.pchat-mine .rich-content a,
.pchat-mine.rich-content a { color: #fff; text-decoration: underline; }
.msg-bubble-mine .rich-content a:hover,
.pchat-mine .rich-content a:hover { opacity: 0.85; }
.rich-content blockquote { border-left: 3px solid var(--border); padding-left: 12px; margin: 8px 0; color: var(--text-muted); }
.rich-content h1, .rich-content h2, .rich-content h3, .rich-content h4 { margin: 12px 0 6px; color: var(--text-primary); }
.rich-content h1 { font-size: 18px; } .rich-content h2 { font-size: 16px; } .rich-content h3 { font-size: 14px; }

/* Bubbles with rich content */
.msg-bubble-text.rich-content, .task-comment-text.rich-content, .pchat-text.rich-content { white-space: normal; }

/* ==================================================================
 * EXTENDED SEO REPORT — full-page view for print/PDF export
 * ================================================================== */

.report-ext-header {
    padding: 18px 22px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border-left: 4px solid var(--accent);
    margin-bottom: 24px;
}
.report-ext-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.report-ext-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}
.report-ext-period {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.report-ext-period-prev {
    font-size: 12px;
    color: var(--text-muted);
}
.report-ext-fetched {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}

.report-ext-section {
    background: var(--bg-card, var(--bg-secondary));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    padding: 18px 20px;
    margin-bottom: 18px;
    page-break-inside: avoid;
    break-inside: avoid;
}
.report-ext-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.report-ext-section-head h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}
.report-ext-section-hide {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    padding: 0;
}
.report-ext-section-hide:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.report-ext-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.report-ext-table thead th {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 8px 10px;
    font-weight: 600;
    text-align: left;
    border-bottom: 2px solid var(--border);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.report-ext-table tbody td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: top;
}
.report-ext-table tbody tr:last-child td { border-bottom: none; }
.report-ext-table tbody tr:nth-child(even) { background: rgba(255,255,255,0.015); }

.ext-up   { color: #22c55e; font-weight: 600; }
.ext-down { color: #ef4444; font-weight: 600; }

.report-ext-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    font-style: italic;
}

.report-ext-blockers {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    min-height: 60px;
}

/* Alert state — when there are actual blockers, draw client's attention */
.report-ext-section--alert {
    border: 2px solid #ef4444 !important;
    background: rgba(239, 68, 68, 0.06);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.12);
    border-radius: var(--radius);
    padding: 4px;
}
.report-ext-section--alert .report-ext-section-head h3 {
    color: #ef4444;
    font-weight: 700;
}
.report-ext-section--alert .report-ext-section-head h3::before {
    content: '\26A0\FE0F';
    margin-right: 8px;
    font-size: 1.1em;
}
.report-ext-blockers.has-blockers {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-left: 4px solid #ef4444;
    color: #fecaca;
    font-size: 14px;
    font-weight: 500;
    padding: 16px 18px;
}
.report-ext-blockers.has-blockers .report-ext-blockers-icon {
    font-size: 28px;
    line-height: 1;
    color: #ef4444;
    flex-shrink: 0;
}
.report-ext-blockers.has-blockers .report-ext-blockers-text {
    flex: 1;
    color: var(--text-primary);
    line-height: 1.6;
}
.report-ext-blockers-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.report-ext-blockers-list li {
    padding: 6px 0 6px 18px;
    position: relative;
    line-height: 1.5;
    font-size: 13px;
    border-bottom: 1px solid rgba(239, 68, 68, 0.18);
}
.report-ext-blockers-list li:last-child {
    border-bottom: none;
}
.report-ext-blockers-list li::before {
    content: '\25CF';
    position: absolute;
    left: 4px;
    top: 6px;
    color: #ef4444;
    font-size: 10px;
}

.report-ext-task-list {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ext-task-card {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
    background: var(--bg-primary);
}
.ext-task-card.ext-done { border-color: rgba(34,197,94,0.3); background: rgba(34,197,94,0.03); }
.ext-task-card.ext-needs-client { border-color: #f59e0b; border-left: 3px solid #f59e0b; background: rgba(245,158,11,0.04); }
.ext-task-card.ext-client-task { border-color: rgba(232,121,249,0.4); border-left: 3px solid #e879f9; background: rgba(232,121,249,0.04); }
.ext-task-card.ext-client-task.ext-needs-client { border-color: #f59e0b; border-left: 3px solid #f59e0b; }
.ext-task-header { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ext-task-header .ext-check { color: #22c55e; font-size: 13px; flex-shrink: 0; }
.ext-task-header .ext-bullet { color: var(--text-muted); font-size: 8px; flex-shrink: 0; }
.ext-task-header .ext-task-name { flex: 1; min-width: 0; }
.report-ext-task-list .ext-assignee { color: var(--text-muted); font-size: 11px; font-weight: 400; white-space: nowrap; }
.report-ext-task-list .ext-status-badge { display: inline-block; padding: 1px 7px; border-radius: 9999px; font-size: 10px; font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.report-ext-task-list .ext-status-needs-client { background: rgba(245,158,11,0.15); color: #b45309; }
.report-ext-task-list .ext-status-client { background: rgba(232,121,249,0.15); color: #a21caf; }
.report-ext-task-list .ext-result { font-size: 12px; color: var(--text-muted); margin-top: 6px; padding-left: 18px; border-left: 2px solid var(--border); word-break: break-word; }
.report-ext-task-list .ext-result a { color: var(--accent); text-decoration: underline; }
.report-ext-task-list .ext-result p { margin: 2px 0; }
.report-ext-task-list .ext-result img { max-width: 320px; max-height: 240px; height: auto; border-radius: 4px; margin: 4px 0; display: block; object-fit: contain; }

/* ===== PDF-style blocks ===== */

.ext-delta {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    margin-left: 4px;
    vertical-align: baseline;
    white-space: nowrap;
}

/* Large metric cards grid (overview) */
.rpt-metric-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 4px;
}
.rpt-metric-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
}
.rpt-metric-card .rpt-metric-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 4px;
}
.rpt-metric-card .rpt-metric-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Behavior factor cards (overview block) */
.rpt-behavior-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 14px;
}
.rpt-behavior-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.rpt-behavior-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59,130,246,0.12);
    border-radius: 50%;
    color: #3b82f6;
}
.rpt-behavior-body {
    flex: 1;
    min-width: 0;
}
.rpt-behavior-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}
.rpt-behavior-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}
.rpt-behavior-prev {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Horizontal bar cards (channels, geo, devices) */
.rpt-bar-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}
.rpt-bar-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
}
.rpt-bar-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 6px;
}
.rpt-bar-label {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}
.rpt-bar-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}
.rpt-bar-track {
    height: 4px;
    background: rgba(255,255,255,0.05);
    border-radius: 2px;
    overflow: hidden;
}
.rpt-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Engine cards grid (search engines) */
.rpt-engine-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.rpt-engine-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    text-align: left;
}
.rpt-engine-card .rpt-engine-name {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}
.rpt-engine-card .rpt-engine-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

/* 4-column tile row (under charts) */
.rpt-tile-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 14px;
}
.rpt-tile {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    text-align: center;
}
.rpt-tile-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}
.rpt-tile-cur {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}
.rpt-tile-prev {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}
.rpt-tile-arrow {
    font-size: 14px;
    margin-left: 4px;
}

/* Brand block */
.rpt-brand-summary {
    margin-bottom: 12px;
}
.rpt-brand-share {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    min-width: 220px;
}
.rpt-brand-share-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.rpt-brand-share-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.1;
}

.rpt-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

/* Numbered column for tables */
.report-ext-table th.num-col,
.report-ext-table td.num-col {
    width: 36px;
    text-align: center;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.report-ext-table td.url-col {
    max-width: 0;
    word-break: break-all;
}
.report-ext-table td.url-col a {
    color: var(--text-primary);
    text-decoration: none;
}
.report-ext-table td.url-col a:hover {
    text-decoration: underline;
}

/* Responsive: stack on small screens */
@media (max-width: 720px) {
    .rpt-metric-cards,
    .rpt-engine-cards,
    .rpt-behavior-cards { grid-template-columns: repeat(2, 1fr); }
    .rpt-tile-row { grid-template-columns: repeat(2, 1fr); }
}

@media print {
    body, .crm-app, .crm-main, .crm-content {
        background: #ffffff !important;
        color: #000000 !important;
    }
    .crm-sidebar, .crm-topbar, .sidebar-overlay,
    .toast-container, #modalOverlay, .menu-toggle,
    .topbar-actions, .report-ext-actions,
    .report-ext-section-hide, .project-tabs, .project-header-row,
    .project-header-actions, .project-nav-tabs, .back-btn,
    .detail-header, .tabs {
        display: none !important;
    }
    .crm-main { margin-left: 0 !important; padding: 0 !important; }
    .crm-content { margin: 0 !important; padding: 20px !important; max-width: 100% !important; overflow: visible !important; }

    .report-ext-header {
        background: #f5f5f5 !important;
        border-left-color: #000 !important;
        color: #000 !important;
        page-break-after: avoid;
    }
    .report-ext-title, .report-ext-subtitle, .report-ext-period,
    .report-ext-period-prev, .report-ext-fetched { color: #000 !important; }

    .report-ext-section {
        background: #fff !important;
        border: 1px solid #ccc !important;
        margin-bottom: 14px !important;
        padding: 14px 16px !important;
    }
    .report-ext-section-head {
        page-break-inside: avoid;
        break-inside: avoid;
        page-break-after: avoid;
        break-after: avoid;
    }
    .report-ext-section-head h3 {
        color: #000 !important;
        border-bottom: 2px solid #000 !important;
        padding-bottom: 6px;
        width: 100%;
    }
    #projectTabContent { overflow: visible !important; }
    .report-ext-table, .report-ext-table thead th, .report-ext-table tbody td {
        color: #000 !important;
        background: #fff !important;
        border-color: #ccc !important;
        font-size: 10px !important;
    }
    .report-ext-table thead th { background: #f5f5f5 !important; }
    .report-ext-table tbody tr:nth-child(even) { background: #fafafa !important; }
    .ext-up   { color: #0a7a3a !important; }
    .ext-down { color: #a31a1a !important; }

    .ext-task-card { color: #000 !important; border-color: #ccc !important; font-size: 11px !important; background: #fff !important; }
    .ext-task-card.ext-needs-client { background: rgba(245,158,11,0.06) !important; border-left: 3px solid #f59e0b !important; }
    .ext-task-card.ext-client-task { background: rgba(232,121,249,0.04) !important; border-left: 3px solid #e879f9 !important; }
    .ext-task-card.ext-client-task.ext-needs-client { border-left-color: #f59e0b !important; }
    .report-ext-task-list .ext-status-needs-client { background: rgba(245,158,11,0.2) !important; color: #92400e !important; }
    .report-ext-task-list .ext-status-client { background: rgba(232,121,249,0.2) !important; color: #7e22ce !important; }
    .report-ext-task-list .ext-assignee, .report-ext-task-list .ext-result { color: #555 !important; }
    .report-ext-task-list .ext-result img { max-width: 260px !important; max-height: 200px !important; }
    .report-ext-blockers { background: #f5f5f5 !important; color: #000 !important; border: 1px solid #ccc; }
    /* Blockers alert in print */
    .report-ext-section--alert {
        border: 2px solid #ef4444 !important;
        background: #fff5f5 !important;
        box-shadow: none !important;
        padding: 8px !important;
    }
    .report-ext-section--alert .report-ext-section-head h3 { color: #c0392b !important; }
    .report-ext-blockers.has-blockers {
        background: #fee2e2 !important;
        border: 1px solid #ef4444 !important;
        border-left: 4px solid #ef4444 !important;
        color: #000 !important;
    }
    .report-ext-blockers.has-blockers .report-ext-blockers-icon { color: #c0392b !important; }
    .report-ext-blockers.has-blockers .report-ext-blockers-text { color: #000 !important; }
    .report-ext-blockers-list li {
        border-bottom: 1px solid #fca5a5 !important;
        color: #000 !important;
    }
    .report-ext-blockers-list li::before { color: #c0392b !important; }

    canvas { max-width: 100% !important; height: auto !important; }

    /* PDF-style blocks in print */
    .rpt-metric-card, .rpt-bar-card, .rpt-engine-card, .rpt-tile, .rpt-brand-share {
        background: #fafafa !important;
        border: 1px solid #ccc !important;
        color: #000 !important;
        page-break-inside: avoid;
    }
    .rpt-metric-card .rpt-metric-value,
    .rpt-tile-cur,
    .rpt-engine-card .rpt-engine-value,
    .rpt-bar-value {
        color: #000 !important;
    }
    .rpt-metric-card .rpt-metric-label,
    .rpt-tile-label,
    .rpt-tile-prev,
    .rpt-engine-card .rpt-engine-name,
    .rpt-brand-share-label,
    .rpt-subtitle {
        color: #555 !important;
    }
    .rpt-brand-share-value { color: #000 !important; }
    .rpt-bar-track { background: #e5e5e5 !important; }
    .rpt-bar-fill  { background: #444 !important; }

    .report-ext-table td.num-col { color: #666 !important; }
    .report-ext-table td.url-col a { color: #000 !important; }

    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

    @page { margin: 15mm; size: A4; }
}

/* === Mobile Touch Fixes === */
@media (max-width: 768px) {
    /* Touch-friendly buttons in message input */
    .msg-chat-input { padding: 8px 10px; gap: 6px; }
    .msg-attach-btn, .msg-emoji-btn { font-size: 22px; padding: 8px; min-width: 40px; min-height: 40px; display: flex; align-items: center; justify-content: center; }
    .msg-chat-input .btn-primary { min-width: 44px; min-height: 40px; padding: 8px 12px; font-size: 18px; }
    .msg-voice-btn { font-size: 20px; padding: 8px; min-width: 40px; min-height: 40px; }

    /* Message action bar: always visible on mobile (no hover) */
    .msg-action-bar { display: flex !important; position: static; margin: 2px 0 0; border-radius: 8px; background: transparent; border: none; box-shadow: none; padding: 0; gap: 4px; }
    .msg-row-mine .msg-action-bar { margin-left: 0; margin-right: 0; justify-content: flex-end; }
    .msg-bubble-wrap::before { display: none; }
    .msg-action-btn { min-width: 32px; min-height: 32px; font-size: 16px; opacity: 0.5; }
    .msg-action-btn:active { opacity: 1; }

    /* Wider bubbles on mobile */
    .msg-bubble-wrap { max-width: 85%; }
    .msg-bubble-img img { max-width: 100%; }

    /* File preview in compose */
    .file-preview-list { gap: 6px; }
    .file-preview-item { padding: 8px 10px; font-size: 13px; }
    .file-preview-remove { min-width: 32px; min-height: 32px; font-size: 18px; }

    /* Conversation list items touch target */
    .msg-conv-item { min-height: 56px; padding: 10px 14px; }

    /* Voice record bar */
    .msg-voice-rec { padding: 10px 12px; }
    .msg-voice-cancel, .msg-voice-send { min-height: 40px; padding: 8px 14px; }

    /* Safe area for notch devices */
    .msg-chat-input { padding-bottom: max(8px, env(safe-area-inset-bottom)); }

    /* TinyMCE iframe override (in case it loads on mobile) */
    .tox-tinymce { max-height: 80px !important; }
    .tox .tox-toolbar__group { flex-wrap: nowrap; }

    /* Task detail comments touch targets */
    .td-comment-actions { opacity: 1; }
    .td-comment-actions button { min-width: 32px; min-height: 32px; }

    /* Deal cards touch targets */
    .deal-card { min-height: 60px; padding: 14px; }

    /* Global: prevent double-tap zoom on interactive elements */
    button, a, input, select, textarea, .sidebar-nav-item, .msg-conv-item, .kanban-card, .deal-card { touch-action: manipulation; }
}

/* === Achievements Timeline === */
.achieve-timeline { padding: 20px 24px 12px; }

.achieve-month { position: relative; padding-left: 28px; padding-bottom: 20px; }
.achieve-month::before {
    content: '';
    position: absolute; left: 7px; top: 8px; bottom: 0;
    width: 2px; background: var(--border);
}
.achieve-month:last-child::before { display: none; }

.achieve-month-label {
    position: relative;
    font-size: 13px; font-weight: 700; color: var(--text-primary);
    margin-bottom: 10px; padding: 2px 0;
}
.achieve-month-label::before {
    content: '';
    position: absolute; left: -24px; top: 5px;
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--accent); border: 2px solid var(--bg-card);
    box-shadow: 0 0 0 2px var(--accent);
}
.achieve-month--current .achieve-month-label { color: var(--accent); }
.achieve-month--current .achieve-month-label::before {
    background: var(--accent);
    box-shadow: 0 0 0 2px var(--accent), 0 0 8px rgba(99,102,241,.4);
}

.achieve-month-items { display: flex; flex-direction: column; gap: 8px; }

.achieve-item {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 10px 12px; border-radius: 8px;
    background: var(--bg-hover); transition: background .15s;
}
.achieve-item:hover { background: var(--bg-active, rgba(99,102,241,.06)); }

.achieve-icon {
    font-size: 20px; flex-shrink: 0;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
}
.achieve-info { flex: 1; min-width: 0; }
.achieve-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.achieve-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }

/* Vacation palm tooltip (instant) */
.msg-vac-palm {
    position: relative;
    cursor: help;
}
.msg-vac-palm::after {
    content: attr(data-vac-tip);
    position: absolute;
    bottom: calc(100% + 4px);
    left: 0;
    background: #1a1a2e;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s;
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.msg-vac-palm:hover::after {
    opacity: 1;
}

/* Online status green dot */
.msg-online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background: var(--success);
    border-radius: 50%;
    border: 2px solid var(--bg-card);
    box-sizing: content-box;
}
.msg-conv-icon { position: relative; }
.msg-avatar { position: relative; }
.msg-avatar .msg-online-dot { width: 8px; height: 8px; }

/* Last seen subtitle in DM header */
.msg-chat-lastseen {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 1px;
}
.msg-chat-lastseen.online {
    color: var(--success);
}

/* Typing indicator */
.msg-typing-bar {
    padding: 4px 16px;
    font-size: 12px;
    color: var(--text-muted);
    min-height: 20px;
}
.msg-typing-bar:empty { display: none; }
.msg-typing-dots {
    display: inline-block;
    margin-left: 2px;
}
.msg-typing-dots span {
    display: inline-block;
    width: 4px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 50%;
    margin: 0 1px;
    animation: msg-typing-bounce 1.4s infinite ease-in-out both;
}
.msg-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.msg-typing-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes msg-typing-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Link preview card */
.msg-link-preview {
    display: flex;
    gap: 10px;
    background: var(--bg-hover);
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 10px 12px;
    margin-top: 6px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    max-width: 400px;
    transition: background 0.15s;
}
.msg-link-preview:hover { background: var(--bg-secondary); }
.msg-link-preview-info { flex: 1; min-width: 0; }
.msg-link-preview-domain {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 2px;
    text-transform: lowercase;
}
.msg-link-preview-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.msg-link-preview-desc {
    font-size: 12px;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.msg-link-preview-img {
    width: 80px;
    height: 80px;
    border-radius: var(--radius);
    object-fit: cover;
    flex-shrink: 0;
}
