/* ── Notification badge (unread count) ─────────────────────────────────────── */

.crm-notif-badge {
    position: relative;
    margin: 0.2rem 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.3rem;
    background: #dc2626;
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1;
    border-radius: 999px;
    vertical-align: middle;
}

.crm-notif-badge--header {
    font-size: 0.75rem;
    min-width: 1.5rem;
    height: 1.5rem;
}

/* ── Sidebar menu badge ─────────────────────────────────────────────────────── */

.crm-menu-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.25rem;
    background: #dc2626;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 1;
    border-radius: 999px;
    margin-left: 0.4rem;
    vertical-align: middle;
}

/* ── Unread dot ─────────────────────────────────────────────────────────────── */

.crm-notif-unread-dot {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: #2563eb;
    margin-right: 0.375rem;
    vertical-align: middle;
    flex-shrink: 0;
}

/* ── Notification list (full center page) ───────────────────────────────────── */

.crm-notif-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.crm-notif-item {
    display: flex;
    background: var(--w-color-surface-page, #fff);
    border: 1px solid var(--w-color-border-furniture, #e5e7eb);
    border-radius: 0.375rem;
    overflow: hidden;
}

.crm-notif-item--unread {
    background: #eff6ff;
}

/* Left colour strip */
.crm-notif-item__strip {
    width: 4px;
    flex-shrink: 0;
}
.crm-notif-item__strip--mention {
    background: #7c3aed;
} /* purple  — @mention */
.crm-notif-item__strip--action {
    background: #d97706;
} /* amber   — action required */
.crm-notif-item__strip--update {
    background: #0891b2;
} /* cyan    — FYI update */
.crm-notif-item__strip--deadline {
    background: #ea580c;
} /* orange  — time sensitive */
.crm-notif-item__strip--system {
    background: #dc2626;
} /* red     — system error */

.crm-notif-item__body {
    flex: 1;
    padding: 0.75rem 1rem;
    min-width: 0;
}

.crm-notif-item__description {
    font-size: 0.875rem;
    color: var(--w-color-text-label, #111827);
    display: block;
    margin-bottom: 0.25rem;
}

a.crm-notif-item__description {
    color: var(--w-color-primary, #2563eb);
}

/* ── Type badge tag ─────────────────────────────────────────────────────────── */

.crm-notif-tag {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
}
.crm-notif-tag--mention {
    background: #ede9fe;
    color: #6d28d9;
} /* purple */
.crm-notif-tag--action {
    background: #fef3c7;
    color: #b45309;
} /* amber  */
.crm-notif-tag--update {
    background: #cffafe;
    color: #0e7490;
} /* cyan   */
.crm-notif-tag--deadline {
    background: #ffedd5;
    color: #c2410c;
} /* orange */
.crm-notif-tag--system {
    background: #fee2e2;
    color: #b91c1c;
} /* red    */

/* ── Notification action buttons (tick / cross) ─────────────────────────────── */

.crm-notif-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    background: none;
    border: 1px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    color: var(--w-color-text-meta, #6b7280);
    flex-shrink: 0;
}
.crm-notif-action-btn:hover {
    background: var(--w-color-surface-field, #f3f4f6);
    border-color: var(--w-color-border-furniture, #e5e7eb);
    color: var(--w-color-text-label, #111827);
}

/* ── Header bell dropdown panel ─────────────────────────────────────────────── */

.crm-notif-bell__btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 1.38rem;
    color: inherit;
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    position: relative;
}

.crm-notif-bell__btn .icon,
.crm-notif-bell__btn svg.icon {
    width: 2rem !important;
    height: 2rem !important;
    flex-shrink: 0;
}

.crm-notif-bell__count {
    position: absolute;
    top: -4px;
    right: -4px;
}

.crm-notif-panel {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 1.4rem;
    width: 32rem;
    overflow: hidden;
    background: var(--w-color-surface-page, #fff);
    border: 1px solid var(--w-color-border-furniture, #e5e7eb);
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 1000;
}

.crm-notif-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--w-color-border-furniture, #e5e7eb);
    position: sticky;
    top: 0;
    background: var(--w-color-surface-page, #fff);
}

.crm-notif-panel__mark-all {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--w-color-primary, #2563eb);
    font-size: 0.75rem;
    padding: 0;
}
.crm-notif-panel__mark-all:hover {
    text-decoration: underline;
}

.crm-notif-panel__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.crm-notif-panel__item {
    display: flex;
    border-bottom: 1px solid var(--w-color-border-furniture, #e5e7eb);
}
.crm-notif-panel__item:last-child {
    border-bottom: none;
}
.crm-notif-panel__item--unread {
    background: #eff6ff;
}

.crm-notif-panel__item-strip {
    width: 3px;
    flex-shrink: 0;
}
.crm-notif-panel__item-strip--mention {
    background: #7c3aed;
}
.crm-notif-panel__item-strip--action {
    background: #d97706;
}
.crm-notif-panel__item-strip--update {
    background: #0891b2;
}
.crm-notif-panel__item-strip--deadline {
    background: #ea580c;
}
.crm-notif-panel__item-strip--system {
    background: #dc2626;
}

.crm-notif-panel__item-body {
    flex: 1;
    padding: 0.625rem 0.75rem;
    min-width: 0;
    overflow: hidden;
}

.crm-notif-panel__item-text {
    font-size: 0.8125rem;
    color: var(--w-color-text-label, #111827);
    display: block;
    word-break: break-word;
}

a.crm-notif-panel__item-text {
    color: var(--w-color-primary, #2563eb);
}

.crm-notif-panel__empty {
    padding: 2rem 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--w-color-text-meta, #6b7280);
}

.crm-notif-panel__footer {
    padding: 0.625rem 1rem;
    border-top: 1px solid var(--w-color-border-furniture, #e5e7eb);
    background: #f9fafb;
    text-align: center;
    position: sticky;
    bottom: 0;
}

/* ── Comment panel ──────────────────────────────────────────────────────────── */

.crm-comment-panel {
    margin-top: 1.5rem;
}

.crm-comment-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.crm-comment-item {
    background: var(--w-color-surface-page, #fff);
    border: 1px solid var(--w-color-border-furniture, #e5e7eb);
    border-radius: 0.375rem;
    padding: 0.75rem 1rem;
}

.crm-comment-item--reply {
    margin-left: 2rem;
    border-left: 3px solid var(--w-color-border-furniture, #e5e7eb);
}

.crm-comment-item__meta {
    font-size: 0.75rem;
    color: var(--w-color-text-meta, #6b7280);
    margin-bottom: 0.375rem;
}

.crm-comment-item__body {
    font-size: 0.875rem;
    color: var(--w-color-text-label, #111827);
    white-space: pre-wrap;
    word-break: break-word;
}

.crm-comment-item__body .crm-mention {
    color: var(--w-color-primary, #2563eb);
    font-weight: 500;
}

.crm-comment-form {
    margin-top: 1rem;
}

.crm-comment-form textarea,
.crm-comment-form__textarea {
    width: 100%;
    min-height: 5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--w-color-border-furniture, #e5e7eb);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
    background: var(--w-color-surface-page, #fff);
}

.crm-comment-form textarea:focus,
.crm-comment-form__textarea:focus {
    outline: none;
    border-color: var(--w-color-primary, #2563eb);
}

/* ── @mention autocomplete dropdown ────────────────────────────────────────── */

.crm-mention-dropdown {
    position: absolute;
    z-index: 1100;
    background: var(--w-color-surface-page, #fff);
    border: 1px solid var(--w-color-border-furniture, #e5e7eb);
    border-radius: 0.375rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 12rem;
    max-height: 14rem;
    overflow-y: auto;
}

.crm-mention-dropdown__item {
    display: flex;
    flex-direction: column;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    font-size: 0.8125rem;
}

.crm-mention-dropdown__item:hover,
.crm-mention-dropdown__item--active {
    background: #f3f4f6;
}

.crm-mention-dropdown__username {
    font-weight: 500;
    color: var(--w-color-text-label, #111827);
}

.crm-mention-dropdown__display {
    font-size: 0.75rem;
    color: var(--w-color-text-meta, #6b7280);
}

/* ── Responsive: notification panel full-width on small screens ─────────── */
@media (max-width: 480px) {
    .crm-notif-panel {
        width: calc(100vw - 2rem);
        right: -0.5rem;
    }
}
