body {
    background: #0f1115;
}

/* Online presence dot */
.online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #198754;
    display: inline-block;
}

/* Toast container for online/offline notifications */
#toast-container {
    z-index: 1090;
}

/* Sidebar */
.sidebar .nav-link {
    color: #adb5bd;
    border-radius: .4rem;
    padding: .4rem .7rem;
    font-size: .875rem;
}

.sidebar .nav-link.active,
.sidebar .nav-link:hover {
    color: #fff;
    background: #21252f;
}

/* Admin grouped sidebar */
.sidebar-group-toggle {
    color: inherit;
    text-decoration: none;
    border-radius: .3rem;
}

.sidebar-group-toggle:hover {
    background: #1a1f2b;
    text-decoration: none;
}

.sidebar-group-toggle.collapsed .sidebar-group-label {
    opacity: .7;
}

.sidebar-group-label {
    font-size: .7rem;
    letter-spacing: .04em;
}

.sidebar-group-icon {
    font-size: .85rem;
    width: 1.2rem;
    text-align: center;
}

/* Department drag-and-drop sorting */
.dept-sortable-item {
    cursor: default;
}

.dept-sortable-item[draggable="true"] {
    user-select: none;
}

.dept-sortable-item.dept-dragging {
    opacity: .45;
    outline: 1px dashed #4a5568;
    border-radius: .3rem;
}

.dept-grip {
    font-size: .8rem;
    cursor: grab;
    opacity: .4;
    line-height: 1;
}

.dept-grip:active {
    cursor: grabbing;
}

.dept-sortable-item:hover .dept-grip {
    opacity: .75;
}

/* Cards */
.card {
    border-color: rgba(255, 255, 255, 0.08);
}

.table td,
.table th {
    vertical-align: middle;
}

/* Support portal hero */
.support-hero {
    background: linear-gradient(135deg, #1a1f2b 0%, #141821 100%);
}

/* Tag badges */
.tag-badge {
    font-size: .7rem;
    padding: .2em .5em;
    border-radius: .3rem;
    display: inline-block;
}

/* Due date indicators */
.due-overdue {
    color: #f87171;
    font-weight: 600;
}

.due-warning {
    color: #fb923c;
}

.due-ok {
    color: #4ade80;
}

/* Ticket list quick-filter tabs */
.ticket-tabs .nav-link {
    color: #adb5bd;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: .5rem 1rem;
}

.ticket-tabs .nav-link.active {
    color: #fff;
    border-bottom-color: #0d6efd;
    background: transparent;
}

/* Mass action bar */
.mass-action-bar {
    background: #1a1f2b;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: .4rem;
    padding: .6rem 1rem;
}

/* Spam badge */
.spam-indicator {
    font-size: .65rem;
    vertical-align: middle;
}

/* File attachment button */
.attachment-btn {
    font-size: .8rem;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Department stat cards */
.dept-stat-card:hover {
    border-color: rgba(255, 255, 255, 0.3) !important;
}

/* Trashed row */
tr.trashed-row {
    opacity: 0.55;
}

/* Department sort drag handle */
.dept-drag-handle {
    cursor: grab;
    font-size: 1.1rem;
}

.dept-drag-handle:active {
    cursor: grabbing;
}

/* ============================================================
   TICKET DETAIL VIEW – Tabbed Helpdesk Layout
   ============================================================ */

/* Properties bar (Kayako-style colored band) */
.ticket-props-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    background: linear-gradient(135deg, #1a2035 0%, #141c2e 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: none;
    border-radius: .4rem .4rem 0 0;
    overflow: hidden;
}

.ticket-prop-item {
    padding: .55rem 1.1rem;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    min-width: 110px;
}

.ticket-prop-item:last-child {
    border-right: none;
}

.ticket-prop-label {
    font-size: .65rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: .15rem;
}

.ticket-prop-value {
    font-size: .85rem;
    color: #e2e8f0;
    line-height: 1.3;
}

/* Action toolbar */
.ticket-action-bar {
    background: #161b27;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top: none;
    border-bottom: none;
    padding: .55rem 1rem;
}

/* Detail tabs (connected to props bar + action bar above) */
.ticket-detail-tabs {
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    background: #0f1318;
    padding: 0 .5rem;
}

.ticket-detail-tabs .nav-link {
    color: #8a9bb5;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: .55rem 1rem;
    font-size: .875rem;
    transition: color .15s, border-color .15s;
}

.ticket-detail-tabs .nav-link:hover {
    color: #c8d6e8;
    border-bottom-color: rgba(255, 255, 255, 0.2);
    background: transparent;
}

.ticket-detail-tabs .nav-link.active {
    color: #fff;
    border-bottom-color: #0d6efd;
    background: transparent;
}

/* Tab content panel */
.ticket-tab-content {
    background: #111620;
    border-color: rgba(255, 255, 255, 0.1) !important;
    min-height: 200px;
}

/* Original message card */
.ticket-original-message {
    border-color: rgba(255, 255, 255, 0.12);
}

.ticket-original-message .card-header {
    background: rgba(13, 110, 253, 0.08);
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

/* Reply thread */
.ticket-thread {
    margin-top: .5rem;
}

.ticket-thread-label {
    padding-bottom: .5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    margin-bottom: .75rem !important;
}

.ticket-thread-entry {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: .5rem;
    padding: .9rem 1rem;
    background: #161b27;
}

.ticket-thread-entry.entry-staff {
    border-left: 3px solid #0d6efd;
    background: #161f33;
}

.ticket-thread-entry.entry-user {
    border-left: 3px solid #6c757d;
    background: #14191f;
}

.ticket-thread-entry.entry-internal {
    border-left: 3px solid #ffc107;
    background: #1a1800;
}

/* Avatar circle */
.thread-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .85rem;
    flex-shrink: 0;
    text-transform: uppercase;
}

.thread-avatar.avatar-staff {
    background: rgba(13, 110, 253, 0.25);
    color: #7fb3ff;
}

.thread-avatar.avatar-user {
    background: rgba(108, 117, 125, 0.25);
    color: #adb5bd;
}

.thread-entry-header {
    padding-bottom: .5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.thread-entry-body {
    padding-top: .6rem;
    font-size: .9rem;
    line-height: 1.6;
    word-break: break-word;
}

/* Internal note */
.ticket-internal-note {
    background: rgba(255, 193, 7, 0.06);
    border: 1px solid rgba(255, 193, 7, 0.2);
}

/* History entry */
.ticket-history-entry:last-child {
    border-bottom: none !important;
}

/* Summernote editable area – dark mode content styles
   Injected via summernote's stylesheets option into the editor body */
body {
    background-color: #1a1f2b;
    color: #e2e8f0;
    font-family: Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    padding: 6px 10px;
    margin: 0;
}

a { color: #7fb3ff; }
h1, h2, h3, h4 { color: #e2e8f0; margin-top: .5em; }
blockquote { border-left: 3px solid #4a5568; padding-left: .75em; color: #adb5bd; }
pre, code { background: #0f1318; color: #c6f6d5; border-radius: .25rem; padding: .1em .3em; }
table { border-collapse: collapse; width: 100%; }
td, th { border: 1px solid rgba(255,255,255,.15); padding: .35em .6em; }
th { background: rgba(255,255,255,.07); }
.note-editable {
    color: #fff !important;
}
