/* ═══════════════════════════════════════════════════════════════
   PulseDesk Theme — PulseLLC Brand
   ═══════════════════════════════════════════════════════════════ */

:root {
    --pulse-primary: #2E86DE;
    --pulse-primary-dark: #2472C8;
    --pulse-primary-light: #54A0FF;
    --pulse-navy: #1B2A4A;
    --pulse-navy-light: #243656;
    --pulse-accent: #6C5CE7;
    --pulse-success: #00B894;
    --pulse-success-dark: #00A381;
    --pulse-warning: #FDCB6E;
    --pulse-warning-dark: #E5B85C;
    --pulse-danger: #E17055;
    --pulse-danger-dark: #C9634B;
    --pulse-info: #54A0FF;
    --pulse-bg: #F5F7FA;
    --pulse-card: #FFFFFF;
    --pulse-text: #2D3436;
    --pulse-muted: #556064;
    --pulse-border: #E1E8ED;
    --pulse-light: #F0F3F6;
    --pulse-shadow-sm: 0 1px 3px rgba(27,42,74,0.08);
    --pulse-shadow: 0 2px 8px rgba(27,42,74,0.10);
    --pulse-shadow-lg: 0 4px 16px rgba(27,42,74,0.12);
    --pulse-radius: 0.625rem;
    --pulse-radius-sm: 0.375rem;
    --pulse-radius-lg: 0.875rem;
}

/* ── Base ─────────────────────────────────────────────── */
html { font-size: 14px; min-height: 100%; }
@media (min-width: 768px) { html { font-size: 16px; } }

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--pulse-bg);
    color: var(--pulse-text);
}
body > .container { flex: 1 0 auto; }

a { color: var(--pulse-primary); }
a:hover { color: var(--pulse-primary-dark); }

/* ── Navbar ───────────────────────────────────────────── */
.pulse-navbar {
    background: linear-gradient(135deg, var(--pulse-navy) 0%, var(--pulse-navy-light) 100%) !important;
    border-bottom: none !important;
    box-shadow: var(--pulse-shadow);
}
.pulse-navbar .navbar-brand { display: flex; align-items: center; padding: 0; }
.pulse-navbar-logo { height: 32px; width: auto; object-fit: contain; }
@media (min-width: 768px) { .pulse-navbar-logo { height: 36px; } }
.text-pulse-brand { color: var(--pulse-primary-light) !important; }
.pulse-navbar .nav-link { color: rgba(255,255,255,0.8) !important; font-weight: 500; transition: color 0.2s; }
.pulse-navbar .nav-link:hover, .pulse-navbar .nav-link:focus { color: #fff !important; }
.pulse-navbar .dropdown-menu { border: 1px solid var(--pulse-border); box-shadow: var(--pulse-shadow-lg); border-radius: var(--pulse-radius); }

/* ── Admin Mega Menu ─────────────────────────────────── */
.pulse-mega-menu { width: 480px; border: 1px solid var(--pulse-border); border-radius: var(--pulse-radius-lg) !important;
    box-shadow: 0 8px 32px rgba(27,42,74,0.16); overflow: hidden; }

.pm-header { display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 1rem;
    background: linear-gradient(135deg, var(--pulse-navy) 0%, var(--pulse-navy-light) 100%); color: #fff; }
.pm-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--pulse-primary);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.8rem; color: #fff; flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.3); }
.pm-user-name { font-weight: 600; font-size: 0.82rem; line-height: 1.2; }
.pm-user-role { font-size: 0.7rem; opacity: 0.7; }

.pm-columns { display: grid; grid-template-columns: 1fr 1fr; }
.pm-col { min-width: 0; }
.pm-col:first-child { border-right: 1px solid var(--pulse-border); }

.pm-section { padding: 0.35rem 0; border-bottom: 1px solid var(--pulse-border); }
.pm-section:last-child { border-bottom: none; }
.pm-label { font-size: 0.58rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
    color: var(--pulse-muted); padding: 0.2rem 0.75rem 0.25rem; }

.pm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 0.25rem 0.5rem; }
.pm-grid-item { display: flex; flex-direction: column; align-items: center; gap: 0.2rem;
    padding: 0.4rem 0.2rem; border-radius: var(--pulse-radius-sm);
    text-decoration: none !important; color: var(--pulse-text); font-size: 0.7rem; font-weight: 500;
    transition: background 0.15s; }
.pm-grid-item:hover { background: var(--pulse-light); color: var(--pulse-text); }
.pm-icon { width: 28px; height: 28px; border-radius: 7px; display: flex; align-items: center;
    justify-content: center; flex-shrink: 0; transition: transform 0.15s; }
.pm-grid-item:hover .pm-icon { transform: scale(1.1); }

.pm-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.28rem 0.75rem;
    text-decoration: none !important; color: var(--pulse-text); font-size: 0.78rem; font-weight: 500;
    transition: all 0.15s; white-space: nowrap; }
.pm-item:hover { background: var(--pulse-light); color: var(--pulse-primary); }
.pm-item:hover svg { fill: var(--pulse-primary); }

.pm-footer { display: flex; justify-content: space-between; padding: 0.45rem 0.75rem;
    background: var(--pulse-light); border-top: 1px solid var(--pulse-border); }
.pm-footer-link { display: inline-flex; align-items: center; gap: 0.35rem;
    font-size: 0.72rem; font-weight: 500; text-decoration: none !important;
    color: var(--pulse-muted); transition: color 0.15s; }
.pm-footer-link:hover { color: var(--pulse-primary); }
.pm-footer-link.text-danger { color: var(--pulse-danger) !important; }
.pm-footer-link.text-danger:hover { color: var(--pulse-danger-dark) !important; }

@media (max-width: 575.98px) {
    .pulse-mega-menu { width: 280px; }
    .pm-columns { grid-template-columns: 1fr; }
    .pm-col:first-child { border-right: none; border-bottom: 1px solid var(--pulse-border); }
}

/* ── Cards ────────────────────────────────────────────── */
.card {
    border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius);
    box-shadow: var(--pulse-shadow-sm);
    background: var(--pulse-card);
}
.card-header { border-radius: var(--pulse-radius) var(--pulse-radius) 0 0 !important; }

/* ── Buttons ──────────────────────────────────────────── */
.btn { border-radius: var(--pulse-radius-sm); font-weight: 500; transition: all 0.2s ease; }
.btn-primary { background-color: var(--pulse-primary); border-color: var(--pulse-primary); color: #fff; }
.btn-primary:hover, .btn-primary:active { background-color: var(--pulse-primary-dark); border-color: var(--pulse-primary-dark); color: #fff; }
.btn-primary:focus-visible { box-shadow: 0 0 0 0.25rem rgba(46,134,222,0.35); }
.btn-outline-primary { color: var(--pulse-primary); border-color: var(--pulse-primary); }
.btn-outline-primary:hover { background-color: var(--pulse-primary); border-color: var(--pulse-primary); color: #fff; }

/* Map btn-warning to primary blue so all existing orange buttons become blue */
.btn-warning { color: #fff; background-color: var(--pulse-primary); border-color: var(--pulse-primary); }
.btn-warning:hover { color: #fff; background-color: var(--pulse-primary-dark); border-color: var(--pulse-primary-dark); }

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem rgba(46,134,222,0.35);
}
.form-control:focus, .form-select:focus { border-color: var(--pulse-primary-light); }

/* ── Tables ───────────────────────────────────────────── */
.table-dark { background-color: var(--pulse-navy) !important; color: #fff; }
.table th { font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.table-hover > tbody > tr:hover { background-color: rgba(46,134,222,0.04); }

/* ── Badges ───────────────────────────────────────────── */
.badge { font-weight: 500; font-size: 0.75rem; padding: 0.35em 0.7em; border-radius: 50rem; letter-spacing: 0.02em; }

/* ── Modals ───────────────────────────────────────────── */
.modal-header.bg-dark {
    background: linear-gradient(135deg, var(--pulse-navy) 0%, var(--pulse-navy-light) 100%) !important;
    color: #fff !important;
    border-bottom: none;
}
.modal-content { border: none; border-radius: var(--pulse-radius-lg); box-shadow: var(--pulse-shadow-lg); overflow: hidden; }

/* ── Stat Cards (Dashboard) ──────────────────────────── */
.stat-card-total { background: linear-gradient(135deg, var(--pulse-navy) 0%, var(--pulse-navy-light) 100%); color: #fff; }
.stat-card-open { background: linear-gradient(135deg, var(--pulse-primary) 0%, var(--pulse-primary-light) 100%); color: #fff; }
.stat-card-progress { background: linear-gradient(135deg, var(--pulse-info) 0%, #74B9FF 100%); color: #fff; }
.stat-card-resolved { background: linear-gradient(135deg, var(--pulse-success) 0%, #55EFC4 100%); color: #fff; }
.stat-card-closed { background: linear-gradient(135deg, var(--pulse-muted) 0%, #95A5A6 100%); color: #fff; }

/* ── Footer ───────────────────────────────────────────── */
.footer { flex-shrink: 0; width: 100%; white-space: nowrap; line-height: 60px; }
.footer-accent { height: 3px; background: linear-gradient(90deg, var(--pulse-primary), var(--pulse-accent), var(--pulse-primary-light)); }
.pulse-footer-link { color: var(--pulse-primary); font-weight: 600; text-decoration: none; }
.pulse-footer-link:hover { color: var(--pulse-primary-dark); text-decoration: underline; }

/* ── Alerts ───────────────────────────────────────────── */
.alert { border-radius: var(--pulse-radius-sm); }

/* ── Breadcrumbs ──────────────────────────────────────── */
.breadcrumb-item a { color: var(--pulse-primary); }
.breadcrumb-item.active { color: var(--pulse-muted); }

/* ── Code ─────────────────────────────────────────────── */
code { font-size: 0.85rem; color: var(--pulse-navy); background-color: var(--pulse-light); padding: 0.15em 0.4em; border-radius: var(--pulse-radius-sm); }

/* ── Toasts ───────────────────────────────────────────── */
.toast { border-radius: var(--pulse-radius); box-shadow: var(--pulse-shadow-lg); }

/* ── Hero (Index) ─────────────────────────────────────── */
.pulse-hero {
    background: linear-gradient(135deg, var(--pulse-navy) 0%, var(--pulse-primary) 60%, var(--pulse-primary-light) 100%);
    color: #fff;
    border-radius: var(--pulse-radius-lg);
    padding: 3.5rem 2rem;
    margin-bottom: 2rem;
}
.pulse-hero h1 { font-weight: 700; letter-spacing: -0.02em; }
.pulse-hero .lead { color: rgba(255,255,255,0.85); }

/* ── Login Card ──────────────────────────────────────── */
.login-card { border: none; box-shadow: var(--pulse-shadow-lg); }
.login-logo {
    height: 48px; width: auto; object-fit: contain;
    background: linear-gradient(135deg, var(--pulse-navy) 0%, var(--pulse-navy-light) 100%);
    padding: 0.6rem 1.5rem; border-radius: var(--pulse-radius);
}

/* ── Scrollbar ───────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--pulse-bg); }
::-webkit-scrollbar-thumb { background: var(--pulse-border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--pulse-muted); }

/* ── Notification Bell ──────────────────────────────── */
.notification-bell { position: relative; cursor: pointer; min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; background: none; border: none; }
.notification-bell .bell-icon { width: 22px; height: 22px; fill: rgba(255,255,255,0.8); transition: fill 0.2s; }
.notification-bell:hover .bell-icon { fill: #fff; }
.notification-badge {
    position: absolute; top: -4px; right: -6px; min-width: 18px; height: 18px;
    background: var(--pulse-danger); color: #fff; font-size: 0.65rem; font-weight: 700;
    border-radius: 50rem; display: flex; align-items: center; justify-content: center;
    padding: 0 4px; line-height: 1; border: 2px solid var(--pulse-navy);
}
.notification-badge:empty, .notification-badge[data-count="0"] { display: none; }

/* ── Notification Panel ─────────────────────────────── */
.notification-panel {
    position: absolute; top: 100%; right: 0; width: 360px; max-height: 480px;
    background: var(--pulse-card); border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius); box-shadow: var(--pulse-shadow-lg);
    z-index: 1050; display: none; overflow: hidden;
}
.notification-panel.show { display: flex; flex-direction: column; }
.notification-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.75rem 1rem; border-bottom: 1px solid var(--pulse-border);
    background: var(--pulse-light);
}
.notification-panel-header h6 { margin: 0; font-weight: 600; font-size: 0.85rem; color: var(--pulse-text); }
.notification-panel-header .mark-all-read {
    font-size: 0.75rem; color: var(--pulse-primary); cursor: pointer; border: none; background: none;
    font-weight: 500; padding: 0;
}
.notification-panel-header .mark-all-read:hover { text-decoration: underline; }
.notification-panel-actions { display: flex; gap: 0.75rem; align-items: center; }
.notification-panel-header .clear-read-btn {
    font-size: 0.75rem; color: var(--pulse-danger, #e74c3c); cursor: pointer; border: none; background: none;
    font-weight: 500; padding: 0;
}
.notification-panel-header .clear-read-btn:hover { text-decoration: underline; }
.notification-item-delete {
    flex-shrink: 0; border: none; background: none; cursor: pointer; padding: 2px 4px;
    color: var(--pulse-muted); font-size: 0.85rem; line-height: 1; opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}
.notification-item:hover .notification-item-delete { opacity: 1; }
.notification-item-delete:hover { color: var(--pulse-danger, #e74c3c); }
.notification-panel-body { overflow-y: auto; flex: 1; max-height: 400px; }
.notification-panel-empty {
    padding: 2rem 1rem; text-align: center; color: var(--pulse-muted); font-size: 0.85rem;
}

/* ── Notification Item ──────────────────────────────── */
.notification-item {
    display: flex; gap: 0.75rem; padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--pulse-border); cursor: pointer;
    transition: background-color 0.15s;
}
.notification-item:last-child { border-bottom: none; }
.notification-item:hover { background-color: var(--pulse-light); }
.notification-item.unread { background-color: rgba(46,134,222,0.05); }
.notification-item.unread::before {
    content: ''; flex-shrink: 0; width: 8px; height: 8px;
    background: var(--pulse-primary); border-radius: 50%; margin-top: 6px;
}
.notification-item.read::before {
    content: ''; flex-shrink: 0; width: 8px; height: 8px;
    background: transparent; border-radius: 50%; margin-top: 6px;
}
.notification-item-content { flex: 1; min-width: 0; }
.notification-item-title {
    font-size: 0.8rem; font-weight: 600; color: var(--pulse-text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notification-item-message {
    font-size: 0.75rem; color: var(--pulse-muted); margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notification-item-time {
    font-size: 0.75rem; color: var(--pulse-muted); margin-top: 3px; white-space: nowrap;
}

/* ── Modal Header (pulse) ───────────────────────────── */
.pulse-modal-header {
    background: linear-gradient(135deg, var(--pulse-navy) 0%, var(--pulse-navy-light) 100%) !important;
    color: #fff !important; border-bottom: none;
}
.pulse-modal-header .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

/* ── Chat Bell (Navbar Icon) ─────────────────────────── */
.chat-bell { position: relative; cursor: pointer; min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; background: none; border: none; }
.chat-bell .chat-icon { width: 22px; height: 22px; fill: rgba(255,255,255,0.8); transition: fill 0.2s; }
.chat-bell:hover .chat-icon { fill: #fff; }
.chat-badge {
    position: absolute; top: -4px; right: -6px; min-width: 18px; height: 18px;
    background: var(--pulse-success); color: #fff; font-size: 0.65rem; font-weight: 700;
    border-radius: 50rem; display: flex; align-items: center; justify-content: center;
    padding: 0 4px; line-height: 1; border: 2px solid var(--pulse-navy);
}
.chat-badge:empty, .chat-badge[data-count="0"] { display: none; }

/* ── Floating Chat Widget ────────────────────────────── */
.chat-widget {
    position: fixed; bottom: 1rem; right: 1rem; width: 420px; height: 560px;
    background: var(--pulse-card); border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius-lg); box-shadow: 0 8px 32px rgba(27,42,74,0.18);
    z-index: 1060; display: none; flex-direction: column; overflow: hidden;
    animation: chatWidgetIn 0.25s ease;
}
.chat-widget[style*="display: flex"], .chat-widget.show { display: flex !important; }
@keyframes chatWidgetIn { from { opacity: 0; transform: translateY(20px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }

.chat-widget-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.6rem 0.75rem;
    background: linear-gradient(135deg, var(--pulse-navy) 0%, var(--pulse-navy-light) 100%);
    color: #fff; flex-shrink: 0;
}
.chat-widget-header-left { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 0.9rem; }
.chat-widget-header-right { display: flex; align-items: center; gap: 0.25rem; }
.chat-widget-back, .chat-widget-close, .chat-widget-expand {
    background: none; border: none; cursor: pointer; padding: 4px; border-radius: 4px;
    display: flex; align-items: center; justify-content: center; opacity: 0.8; transition: opacity 0.2s;
    min-width: 44px; min-height: 44px;
}
.chat-widget-back:hover, .chat-widget-close:hover, .chat-widget-expand:hover { opacity: 1; background: rgba(255,255,255,0.15); }

.chat-widget-body { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
#chatWidgetConvoView { flex: 1; flex-direction: column; min-height: 0; overflow: hidden; }

.chat-widget-search { padding: 0.5rem; border-bottom: 1px solid var(--pulse-border); }
.chat-widget-search input { font-size: 0.8rem; }

.chat-widget-groups { flex: 1; overflow-y: auto; }
.chat-widget-group-item {
    display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--pulse-border); cursor: pointer; transition: background 0.15s;
}
.chat-widget-group-item:hover { background: var(--pulse-light); }
.chat-widget-group-item-avatar {
    width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, var(--pulse-primary) 0%, var(--pulse-accent) 100%);
    display: flex; align-items: center; justify-content: center; color: #fff;
    font-weight: 700; font-size: 0.8rem;
}
.chat-widget-group-item-info { flex: 1; min-width: 0; }
.chat-widget-group-item-name { font-weight: 600; font-size: 0.8rem; color: var(--pulse-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-widget-group-item-preview { font-size: 0.7rem; color: var(--pulse-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-widget-group-item-meta { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; gap: 2px; }
.chat-widget-group-item-time { font-size: 0.6rem; color: var(--pulse-muted); white-space: nowrap; }
.chat-widget-unread-badge {
    min-width: 18px; height: 18px; background: var(--pulse-success); color: #fff;
    font-size: 0.6rem; font-weight: 700; border-radius: 50rem;
    display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

/* Widget conversation view */
.chat-widget-messages {
    flex: 1; overflow-y: auto; padding: 0.5rem 0.75rem;
    display: flex; flex-direction: column; gap: 0.35rem;
    min-height: 0;
}
.chat-widget-messages::-webkit-scrollbar { width: 6px; }
.chat-widget-messages::-webkit-scrollbar-track { background: transparent; }
.chat-widget-messages::-webkit-scrollbar-thumb { background: var(--pulse-border); border-radius: 3px; }
.chat-widget-messages::-webkit-scrollbar-thumb:hover { background: var(--pulse-muted); }
.chat-widget-typing { font-size: 0.7rem; color: var(--pulse-muted); padding: 0 0.75rem 0.25rem; min-height: 1em; font-style: italic; }
.chat-widget-input {
    padding: 0.5rem 0.75rem; border-top: 1px solid var(--pulse-border);
    display: flex; gap: 0.35rem; align-items: flex-end;
}
.chat-widget-input textarea { flex: 1; resize: none; max-height: 60px; font-size: 0.8rem; }
.chat-widget-input button { height: 44px; width: 44px; padding: 0; display: flex; align-items: center; justify-content: center; }

/* Widget message bubbles */
.cw-msg { max-width: 80%; }
.cw-msg.mine { align-self: flex-end; }
.cw-msg.theirs { align-self: flex-start; }
.cw-bubble { padding: 0.35rem 0.6rem; border-radius: var(--pulse-radius-sm); font-size: 0.8rem; word-break: break-word; position: relative; }
.cw-msg.mine .cw-bubble { background: var(--pulse-primary); color: #fff; }
.cw-msg.theirs .cw-bubble { background: var(--pulse-light); color: var(--pulse-text); }
.cw-sender { font-size: 0.65rem; font-weight: 600; color: var(--pulse-primary); margin-bottom: 1px; }
.cw-meta { font-size: 0.6rem; color: var(--pulse-muted); margin-top: 1px; }
.cw-msg.mine .cw-meta { text-align: right; }

/* ── Message Reactions ───────────────────────────────── */
.reaction-bar { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 2px; }
.reaction-chip {
    display: inline-flex; align-items: center; gap: 2px;
    background: var(--pulse-light); border: 1px solid var(--pulse-border);
    border-radius: 50rem; padding: 1px 6px; font-size: 0.7rem; cursor: pointer;
    transition: all 0.15s; line-height: 1.3;
}
.reaction-chip:hover { background: rgba(46,134,222,0.1); border-color: var(--pulse-primary-light); }
.reaction-chip.mine { background: rgba(46,134,222,0.12); border-color: var(--pulse-primary); }
.reaction-chip .reaction-count { font-weight: 600; font-size: 0.6rem; color: var(--pulse-text); }

.reaction-picker-trigger {
    opacity: 0; display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 0.65rem; transition: opacity 0.15s;
    background: rgba(0,0,0,0.08); border: none;
    border-radius: 50%; width: 44px; height: 44px; min-width: 44px;
    margin-left: 4px; vertical-align: middle; line-height: 1;
    color: inherit;
}
.cw-msg.mine .reaction-picker-trigger, .chat-message.mine .reaction-picker-trigger {
    background: rgba(255,255,255,0.2);
}
.cw-msg:hover .reaction-picker-trigger, .chat-message:hover .reaction-picker-trigger { opacity: 1; }

.reaction-picker {
    position: absolute; bottom: 100%; right: 0;
    background: var(--pulse-card); border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius); box-shadow: var(--pulse-shadow-lg);
    padding: 4px 6px; display: flex; gap: 2px; z-index: 10;
    animation: reactionPickerIn 0.15s ease; white-space: nowrap;
}
.cw-msg.theirs .reaction-picker, .chat-message.theirs .reaction-picker { right: auto; left: 0; }
.cw-msg.mine .reaction-picker, .chat-message.mine .reaction-picker { right: 0; left: auto; }
@keyframes reactionPickerIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.reaction-picker span {
    cursor: pointer; font-size: 1rem; padding: 2px 4px; border-radius: 4px; transition: background 0.15s;
}
.reaction-picker span:hover { background: var(--pulse-light); }

@media (max-width: 480px) {
    .chat-widget { width: calc(100vw - 1rem); right: 0.5rem; bottom: 0.5rem; height: 70vh; }
}

/* ── Rich Text Description (rendered from Quill HTML) ─────── */
.ticket-description p { margin-bottom: 0.5rem; }
.ticket-description ul, .ticket-description ol { margin-bottom: 0.5rem; padding-left: 1.5rem; }
.ticket-description blockquote { border-left: 3px solid var(--pulse-border); padding-left: 0.75rem; color: var(--pulse-muted); margin: 0.5rem 0; }
.ticket-description pre { background: var(--pulse-navy); color: #e4e4e4; padding: 0.75rem; border-radius: var(--pulse-radius-sm); overflow-x: auto; }
.ticket-description code { background: rgba(27,42,74,0.08); padding: 0.1rem 0.3rem; border-radius: 3px; font-size: 0.88em; }
.ticket-description pre code { background: none; padding: 0; }
.ticket-description img { max-width: 100%; height: auto; border-radius: var(--pulse-radius-sm); }

/* ── @Mention Styles ─────────────────────────────────────── */
.mention-dropdown {
    position: fixed; z-index: 1100;
    background: var(--pulse-card); border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius-sm); box-shadow: var(--pulse-shadow-lg);
    max-height: 200px; overflow-y: auto; min-width: 180px;
}
.mention-dropdown-item {
    padding: 0.4rem 0.75rem; cursor: pointer; font-size: 0.82rem;
    color: var(--pulse-text); transition: background 0.1s;
}
.mention-dropdown-item:hover, .mention-dropdown-item.active {
    background: var(--pulse-light);
}
.mention-dropdown-item.active {
    background: rgba(46,134,222,0.10); font-weight: 600;
}
.chat-mention {
    background: rgba(46,134,222,0.15); color: var(--pulse-primary);
    font-weight: 600; border-radius: 3px; padding: 0 2px;
}
.chat-mention-me {
    background: rgba(253,203,110,0.35); color: #8B6914;
}
.chat-message.mine .chat-mention {
    background: rgba(255,255,255,0.25); color: #fff;
}
.chat-message.mine .chat-mention-me {
    background: rgba(253,203,110,0.45); color: #fff;
}
.cw-msg.mine .chat-mention {
    background: rgba(255,255,255,0.25); color: #fff;
}
.cw-msg.mine .chat-mention-me {
    background: rgba(253,203,110,0.45); color: #fff;
}

/* ── Mention Indicator (sidebar) ─────────────────────────── */
.mention-indicator {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--pulse-warning); color: var(--pulse-navy);
    font-weight: 700; font-size: 0.65rem; margin-left: 4px;
}

/* ═══════════════════════════════════════════════════════════════
   Dark Theme
   ═══════════════════════════════════════════════════════════════ */
[data-theme="dark"] {
    --pulse-bg: #0F1623;
    --pulse-card: #1A2233;
    --pulse-text: #E2E8F0;
    --pulse-muted: #8896A8;
    --pulse-border: #2A3548;
    --pulse-light: #1E2A3D;
    --pulse-primary: #4A9EE8;
    --pulse-primary-dark: #3A8AD4;
    --pulse-primary-light: #6BB3F0;
    --pulse-navy: #0D1929;
    --pulse-navy-light: #152238;
    --pulse-accent: #8B7CF0;
    --pulse-success: #2ED8A3;
    --pulse-success-dark: #25B98C;
    --pulse-warning: #F0C75E;
    --pulse-warning-dark: #D4B04F;
    --pulse-danger: #E8705A;
    --pulse-danger-dark: #D0604C;
    --pulse-info: #6BB3F0;
    --pulse-shadow-sm: 0 1px 3px rgba(0,0,0,0.35);
    --pulse-shadow: 0 2px 8px rgba(0,0,0,0.40);
    --pulse-shadow-lg: 0 4px 16px rgba(0,0,0,0.45);
}

/* ── Dark Theme Bootstrap Overrides ───────────────────────────── */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: var(--pulse-light);
    border-color: var(--pulse-border);
    color: var(--pulse-text);
}
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: var(--pulse-light);
    border-color: var(--pulse-primary);
    color: var(--pulse-text);
}
[data-theme="dark"] .form-control::placeholder {
    color: var(--pulse-muted);
}

[data-theme="dark"] .modal-content {
    background-color: var(--pulse-card);
    color: var(--pulse-text);
}

[data-theme="dark"] .dropdown-menu {
    background-color: var(--pulse-card);
    border-color: var(--pulse-border);
}
[data-theme="dark"] .dropdown-item {
    color: var(--pulse-text);
}
[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
    background-color: var(--pulse-light);
    color: var(--pulse-text);
}

[data-theme="dark"] .accordion-button,
[data-theme="dark"] .accordion-item {
    background-color: var(--pulse-card);
    color: var(--pulse-text);
    border-color: var(--pulse-border);
}
[data-theme="dark"] .accordion-button:not(.collapsed) {
    background-color: var(--pulse-light);
    color: var(--pulse-text);
}
[data-theme="dark"] .accordion-button::after {
    filter: invert(0.8);
}

[data-theme="dark"] .table {
    color: var(--pulse-text);
    --bs-table-bg: var(--pulse-card);
    --bs-table-hover-bg: var(--pulse-light);
    border-color: var(--pulse-border);
}

[data-theme="dark"] .bg-light {
    background-color: var(--pulse-light) !important;
}

[data-theme="dark"] .text-muted {
    color: var(--pulse-muted) !important;
}

[data-theme="dark"] .border {
    border-color: var(--pulse-border) !important;
}

[data-theme="dark"] .alert {
    border-color: var(--pulse-border);
}

[data-theme="dark"] code {
    background-color: var(--pulse-light);
    color: var(--pulse-primary-light);
}

/* Quill editor overrides */
[data-theme="dark"] .ql-toolbar {
    background-color: var(--pulse-light);
    border-color: var(--pulse-border) !important;
}
[data-theme="dark"] .ql-container {
    border-color: var(--pulse-border) !important;
}
[data-theme="dark"] .ql-editor {
    background-color: var(--pulse-light);
    color: var(--pulse-text);
}
[data-theme="dark"] .ql-toolbar .ql-stroke {
    stroke: var(--pulse-muted);
}
[data-theme="dark"] .ql-toolbar .ql-fill {
    fill: var(--pulse-muted);
}
[data-theme="dark"] .ql-toolbar .ql-picker-label {
    color: var(--pulse-muted);
}

/* Help page overrides */
[data-theme="dark"] .help-accordion .accordion-button:not(.collapsed) {
    background: var(--pulse-light);
    color: var(--pulse-text);
}
[data-theme="dark"] .help-accordion .accordion-body {
    color: var(--pulse-text);
}
[data-theme="dark"] .help-accordion .accordion-body h6 {
    color: var(--pulse-primary-light);
}
[data-theme="dark"] .help-tip {
    background: var(--pulse-light);
    border-left-color: var(--pulse-warning);
    color: var(--pulse-text);
}
[data-theme="dark"] .help-note {
    background: var(--pulse-light);
    border-left-color: var(--pulse-primary);
    color: var(--pulse-text);
}

/* ── Theme Selector ──────────────────────────────────────────── */
.pm-theme-selector {
    display: flex; align-items: center; gap: 0.35rem; margin-left: auto;
}
.pm-theme-btn {
    width: 44px; height: 44px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.25);
    background: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
    padding: 0; transition: all 0.2s; opacity: 0.6;
}
.pm-theme-btn:hover { opacity: 1; border-color: rgba(255,255,255,0.6); }
.pm-theme-btn.active { opacity: 1; border-color: #fff; background: rgba(255,255,255,0.15); }
.pm-theme-btn svg { width: 14px; height: 14px; fill: #fff; }

/* ── Skip Link (A11Y-10) ──────────────────────────────────── */
.skip-link {
    position: absolute; top: -100%; left: 50%; transform: translateX(-50%);
    background: var(--pulse-navy); color: #fff; padding: 0.5rem 1.25rem;
    border-radius: 0 0 var(--pulse-radius) var(--pulse-radius);
    font-weight: 600; font-size: 0.9rem; z-index: 9999;
    transition: top 0.2s ease;
    text-decoration: none;
}
.skip-link:focus {
    top: 0; outline: 3px solid var(--pulse-primary); outline-offset: 2px;
    color: #fff; text-decoration: none;
}

/* ── Firefox Scrollbar Compat (COMPAT-05) ──────────────────── */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--pulse-border) transparent;
}

/* ── Safe-Area Insets for Notched Devices (MOB-03) ─────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .chat-widget {
        bottom: calc(1rem + env(safe-area-inset-bottom));
        right: calc(1rem + env(safe-area-inset-right));
    }
    .chat-widget-input {
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
    }
    .pulse-sidebar {
        padding-bottom: env(safe-area-inset-bottom);
    }
    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* ── Responsive / Mobile Tweaks ────────────────────────────── */
@media (max-width: 768px) {
    .chat-widget {
        width: calc(100vw - 1rem); right: 0.5rem; bottom: 0.5rem;
        height: calc(100vh - 5rem); max-height: 560px;
    }
    .pm-theme-btn { width: 36px; height: 36px; }
    .notification-panel { width: calc(100vw - 2rem); right: 1rem; }
}
