/* ============================================================
   TICKET SAAS - Main Stylesheet
   White-label ready with CSS Variables
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font, 'Inter', sans-serif);
    background: #F5F6FA;
    color: #333;
    font-size: 14px;
    line-height: 1.5;
}

/* ---- LAYOUT ---- */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.sidebar {
    width: 240px;
    background: var(--sidebar-bg, #fff);
    border-right: 1px solid #E8E8E8;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
    transition: transform 0.3s;
}

.sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid #E8E8E8;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 64px;
}

.sidebar-header .logo-img {
    max-height: 36px;
    max-width: 160px;
    object-fit: contain;
}

.sidebar-header .logo-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary, #DC3545);
}

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

.sidebar-search-icon {
    position: absolute;
    left: 28px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 13px;
    pointer-events: none;
}

.sidebar-search input {
    width: 100%;
    padding: 8px 12px 8px 32px;
    border: 1px solid #DDD;
    border-radius: var(--radius, 8px);
    font-size: 13px;
    background: #F8F9FA;
}

.sidebar-search input:focus {
    outline: none;
    border-color: var(--primary, #DC3545);
    background: #fff;
}

.sidebar-nav {
    flex: 1;
    padding: 8px 0;
}

.nav-section {
    margin-bottom: 0;
}

/* Top-level nav links (Inicio, Quadros, etc) */
.sidebar-nav > .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--sidebar-text, #333);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-nav > .nav-link:hover {
    background: rgba(0,0,0,0.04);
    color: var(--primary, #DC3545);
}

.sidebar-nav > .nav-link.active {
    background: var(--sidebar-active-bg, #DC3545);
    color: var(--sidebar-active-text, #fff);
    border-left-color: var(--primary, #DC3545);
    font-weight: 500;
    border-radius: 0 var(--radius, 8px) var(--radius, 8px) 0;
    margin-right: 8px;
}

/* Nav icon */
.nav-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

/* Nav toggle (section headers) */
.nav-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--sidebar-text, #333);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.15s;
    border-left: 3px solid transparent;
    width: 100%;
}

.nav-toggle:hover {
    background: rgba(0,0,0,0.04);
    color: var(--primary, #DC3545);
}

/* Arrow icon on toggles */
.nav-arrow {
    margin-left: auto;
    font-size: 10px;
    transition: transform 0.2s;
    color: #AAA;
}

.nav-toggle.open .nav-arrow {
    transform: rotate(180deg);
}

/* Submenu container */
.nav-sub {
    padding: 2px 0 4px 0;
    background: rgba(0,0,0,0.01);
}

/* Submenu links */
.nav-sub-link {
    display: block;
    padding: 7px 20px 7px 48px;
    color: var(--sidebar-text, #555);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.nav-sub-link:hover {
    background: rgba(0,0,0,0.04);
    color: var(--primary, #DC3545);
}

.nav-sub-link.active {
    background: var(--sidebar-active-bg, #DC3545);
    color: var(--sidebar-active-text, #fff);
    border-left-color: var(--primary, #DC3545);
    font-weight: 500;
    border-radius: 0 var(--radius, 8px) var(--radius, 8px) 0;
    margin-right: 8px;
}

/* Divider inside submenus */
.nav-sub-divider {
    height: 1px;
    background: #E8E8E8;
    margin: 6px 20px 6px 48px;
}

/* Badge count */
.badge-count {
    margin-left: auto;
    background: var(--primary, #DC3545);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

/* Remove old styles */
.nav-item { display: block; }
.nav-link .icon { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.nav-toggle::after { display: none; }
.nav-toggle.collapsed::after { display: none; }

.btn-new-ticket {
    display: block;
    margin: 12px 16px;
    padding: 10px 16px;
    background: var(--primary, #DC3545);
    color: #fff;
    border: none;
    border-radius: var(--radius, 8px);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-new-ticket:hover {
    opacity: 0.9;
    color: #fff;
}

/* ---- MAIN CONTENT ---- */
.main-content {
    flex: 1;
    margin-left: 240px;
    display: flex;
    flex-direction: column;
}

/* ---- TOP HEADER ---- */
.top-header {
    background: var(--header-bg, #fff);
    border-bottom: 1px solid #E8E8E8;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-header-left h1 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.top-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-icon {
    position: relative;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
    color: #666;
    font-size: 18px;
}

.header-icon:hover { background: #F0F0F0; }

.header-icon .notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--primary, #DC3545);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}
.user-avatar .avatar-letter {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary, #DC3545);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}
.user-avatar .avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #E8E8E8;
}

/* ---- PAGE CONTENT ---- */
.page-content {
    padding: 24px;
    flex: 1;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #333;
}

/* ---- CARDS ---- */
.card {
    background: #fff;
    border: 1px solid #E8E8E8;
    border-radius: var(--radius, 8px);
    margin-bottom: 20px;
}

.card .table-responsive,
.card > .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Table directly inside card - no extra padding */
.card > table,
.card > .table-responsive > table {
    margin-bottom: 0;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #E8E8E8;
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body { padding: 20px; }

/* ---- STAT CARDS ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border: 1px solid #E8E8E8;
    border-radius: var(--radius, 8px);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: box-shadow 0.2s;
}

.stat-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

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

.stat-icon.red { background: #FEE2E2; color: #DC3545; }
.stat-icon.blue { background: #DBEAFE; color: #3B82F6; }
.stat-icon.green { background: #D1FAE5; color: #10B981; }
.stat-icon.yellow { background: #FEF3C7; color: #F59E0B; }
.stat-icon.purple { background: #EDE9FE; color: #8B5CF6; }

.stat-info .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    line-height: 1;
}

.stat-info .stat-label {
    font-size: 13px;
    color: #888;
    margin-top: 4px;
}

/* ---- TABLE ---- */
.table-container,
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table,
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.data-table th {
    background: #F8F9FA;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: #666;
    letter-spacing: 0.3px;
    border-bottom: 2px solid #E8E8E8;
    white-space: nowrap;
}

.table td,
.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #F0F0F0;
    font-size: 13px;
    vertical-align: middle;
}

.table tr:hover td,
.data-table tr:hover td {
    background: #FAFAFA;
}

.data-table .ticket-subject {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.data-table .ticket-subject a {
    color: #333;
    text-decoration: none;
    font-weight: 500;
}

.data-table .ticket-subject a:hover {
    color: var(--primary, #DC3545);
}

/* ---- BADGES ---- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-priority-low { background: #D1FAE5; color: #065F46; }
.badge-priority-normal { background: #DBEAFE; color: #1E40AF; }
.badge-priority-high { background: #FED7AA; color: #9A3412; }
.badge-priority-urgent { background: #FEE2E2; color: #991B1B; }

.bg-primary { background: var(--primary, #DC3545); color: #fff; }
.bg-success { background: #10B981; color: #fff; }
.bg-warning { background: #F59E0B; color: #fff; }
.bg-danger { background: #EF4444; color: #fff; }
.bg-info { background: #3B82F6; color: #fff; }
.bg-secondary { background: #6B7280; color: #fff; }
.bg-dark { background: #374151; color: #fff; }

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius, 8px);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    line-height: 1.4;
}

.btn-primary { background: var(--btn-bg, #DC3545); color: var(--btn-text, #fff); }
.btn-primary:hover { opacity: 0.9; }
.btn-secondary { background: #6B7280; color: #fff; }
.btn-success { background: #10B981; color: #fff; }
.btn-danger { background: #EF4444; color: #fff; }
.btn-warning { background: #F59E0B; color: #fff; }
.btn-outline { background: transparent; border: 1px solid #DDD; color: #555; }
.btn-outline:hover { border-color: var(--primary, #DC3545); color: var(--primary, #DC3545); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #DDD;
    border-radius: var(--radius, 8px);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    background: #fff;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary, #DC3545);
    box-shadow: 0 0 0 3px rgba(220,53,69,0.1);
}

select.form-control { cursor: pointer; }
textarea.form-control { min-height: 100px; resize: vertical; }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

/* ---- TABS / FILTERS ---- */
.filter-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    border-bottom: 2px solid #E8E8E8;
    padding-bottom: 0;
}

.filter-tab {
    padding: 8px 16px;
    text-decoration: none;
    color: #666;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.filter-tab:hover { color: var(--primary, #DC3545); }

.filter-tab.active {
    color: var(--primary, #DC3545);
    border-bottom-color: var(--primary, #DC3545);
}

.filter-tab .count {
    background: #E8E8E8;
    color: #666;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 10px;
}

.filter-tab.active .count {
    background: var(--primary, #DC3545);
    color: #fff;
}

/* ---- SEARCH BAR ---- */
.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.search-input-wrap {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.search-input-wrap input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid #DDD;
    border-radius: var(--radius, 8px);
    font-size: 14px;
}

.search-input-wrap input:focus {
    outline: none;
    border-color: var(--primary);
}

.search-input-wrap .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

/* ---- CHART ---- */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* ---- TICKET DETAIL ---- */
.ticket-detail-header {
    background: #fff;
    border: 1px solid #E8E8E8;
    border-radius: var(--radius, 8px);
    padding: 20px;
    margin-bottom: 20px;
}

.ticket-detail-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.ticket-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #666;
}

.ticket-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ticket-sidebar {
    background: #fff;
    border: 1px solid #E8E8E8;
    border-radius: var(--radius, 8px);
    padding: 16px;
}

.ticket-sidebar .sidebar-section {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #F0F0F0;
}

.ticket-sidebar .sidebar-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.ticket-sidebar .sidebar-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #999;
    margin-bottom: 4px;
}

.ticket-sidebar .sidebar-value {
    font-size: 14px;
    font-weight: 500;
}

/* ---- REPLY ---- */
.reply-item {
    background: #fff;
    border: 1px solid #E8E8E8;
    border-radius: var(--radius, 8px);
    padding: 16px 20px;
    margin-bottom: 12px;
}

.reply-item.internal {
    background: #FFFBEB;
    border-color: #FDE68A;
}

.reply-item.system {
    background: #F3F4F6;
    border-color: #D1D5DB;
    font-style: italic;
}

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

.reply-author {
    font-weight: 600;
    font-size: 14px;
}

.reply-date {
    font-size: 12px;
    color: #999;
}

.reply-body {
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* ---- ALERTS ---- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius, 8px);
    margin-bottom: 16px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-danger { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.alert-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.alert-info { background: #DBEAFE; color: #1E40AF; border: 1px solid #BFDBFE; }

/* ---- COLOR PICKER ---- */
.color-picker-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-picker-group input[type="color"] {
    width: 40px;
    height: 36px;
    border: 1px solid #DDD;
    border-radius: 6px;
    cursor: pointer;
    padding: 2px;
}

.color-picker-group input[type="text"] {
    width: 100px;
}

/* ---- PAGINATION ---- */
.pagination {
    display: flex;
    gap: 4px;
    list-style: none;
    margin-top: 20px;
    justify-content: center;
}

.page-item .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid #DDD;
    border-radius: 6px;
    text-decoration: none;
    color: #555;
    font-size: 13px;
    transition: all 0.2s;
}

.page-item.active .page-link {
    background: var(--primary, #DC3545);
    color: #fff;
    border-color: var(--primary, #DC3545);
}

.page-item .page-link:hover {
    background: #F0F0F0;
}

/* ---- GRID ---- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-70-30 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }

/* ---- EMPTY STATE ---- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; font-weight: 500; color: #666; }

/* ---- DROPDOWN ---- */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border: 1px solid #E8E8E8;
    border-radius: var(--radius, 8px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 200px;
    z-index: 1000;
    display: none;
    padding: 4px 0;
}

.dropdown-menu.show { display: block; }

.dropdown-item {
    display: block;
    padding: 8px 16px;
    font-size: 13px;
    color: #333;
    text-decoration: none;
    transition: background 0.2s;
}

.dropdown-item:hover { background: #F8F9FA; }
.dropdown-item.active { background: #F0F0F0; font-weight: 500; }
.dropdown-item i { width: 16px; margin-right: 6px; color: #999; }
.dropdown-menu-right { right: 0; left: auto; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .grid-2, .grid-3, .grid-70-30 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---- LOGIN PAGE ---- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.login-card .logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-card .logo img { max-height: 48px; }

.login-card .logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary, #DC3545);
    margin-top: 8px;
}

.login-card h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
    text-align: center;
    color: #333;
}

.login-card .form-control {
    padding: 12px 14px;
    font-size: 15px;
}

.login-card .btn {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    justify-content: center;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: #999;
}

.login-footer a { color: var(--primary, #DC3545); text-decoration: none; }

/* ---- BRANDING PREVIEW ---- */
.branding-preview {
    background: #F8F9FA;
    border: 1px solid #E8E8E8;
    border-radius: var(--radius, 8px);
    padding: 20px;
    margin-top: 16px;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

/* ---- UTILITY ---- */
.text-muted { color: #999; }
.text-primary { color: var(--primary, #DC3545); }
.text-success { color: #10B981; }
.text-danger { color: #EF4444; }
.text-warning { color: #F59E0B; }
.text-sm { font-size: 12px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.fw-600 { font-weight: 600; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.w-100 { width: 100%; }
.hidden { display: none; }

/* ---- NOTIFICATION PANEL ---- */
.notification-panel {
    width: 340px;
    max-height: 480px;
    right: 0;
    left: auto;
    padding: 0;
}
.notification-header {
    padding: 12px 16px;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 1px solid #E8E8E8;
    color: #333;
}
.notification-list {
    max-height: 400px;
    overflow-y: auto;
}
.notification-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid #F0F0F0;
    text-decoration: none;
    color: #333;
    font-size: 13px;
    transition: background 0.15s;
}
.notification-item:hover { background: #F8F9FA; }
.notification-item.unread { background: #FFF8F8; }
.notification-count {
    background: var(--primary, #DC3545);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 24px;
    text-align: center;
    flex-shrink: 0;
    margin-left: 8px;
}
.notification-empty {
    padding: 24px 16px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

/* ---- USER MENU ---- */
.user-menu {
    width: 240px;
    right: 0;
    left: auto;
    padding: 0;
}
.user-menu-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid #E8E8E8;
}
.user-menu-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid #E8E8E8;
}
.user-menu-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.user-menu-avatar .avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary, #DC3545);
    color: #fff;
    font-size: 18px;
    font-weight: 600;
}
.user-menu-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.user-menu-info strong {
    font-size: 14px;
    color: #333;
}
.user-menu-info span {
    font-size: 12px;
    color: #999;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-menu-section {
    border-bottom: 1px solid #F0F0F0;
    padding: 4px 0;
}
.user-menu-section:last-child { border-bottom: none; }
.user-menu .dropdown-item {
    padding: 8px 16px;
    font-size: 13px;
}
body.dark-mode .user-avatar .avatar-img { border-color: #334155; }
body.dark-mode .user-avatar .avatar-letter { background: #3B82F6; }

/* Toggle switch */
.toggle-item {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    cursor: default;
}
.toggle-switch {
    position: relative;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #CCC;
    border-radius: 20px;
    transition: 0.2s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background: #fff;
    border-radius: 50%;
    transition: 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary, #DC3545); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); }

/* ---- DARK MODE (#0F172A / #1E293B) ---- */
body.dark-mode {
    background: #0F172A;
    color: #E2E8F0;
}
body.dark-mode .sidebar {
    background: #1E293B;
    border-right-color: #334155;
}
body.dark-mode .sidebar-header { border-bottom-color: #334155; }
body.dark-mode .sidebar-header .logo-text { color: #F1F5F9; }
body.dark-mode .sidebar-search input { background: #0F172A; border-color: #334155; color: #E2E8F0; }
body.dark-mode .sidebar-search-icon { color: #64748B; }
body.dark-mode .btn-new-ticket { background: var(--primary, #3B82F6); }
body.dark-mode .nav-toggle,
body.dark-mode .sidebar-nav > .nav-link { color: #CBD5E1; }
body.dark-mode .nav-toggle:hover,
body.dark-mode .sidebar-nav > .nav-link:hover { background: rgba(255,255,255,0.06); color: #F1F5F9; }
body.dark-mode .nav-sub { background: rgba(0,0,0,0.2); }
body.dark-mode .nav-sub-link { color: #94A3B8; }
body.dark-mode .nav-sub-link:hover { background: rgba(255,255,255,0.06); color: #F1F5F9; }
body.dark-mode .nav-sub-link.active { background: var(--sidebar-active-bg, #3B82F6); color: #fff; }
body.dark-mode .sidebar-nav > .nav-link.active { background: var(--sidebar-active-bg, #3B82F6); color: #fff; }
body.dark-mode .nav-sub-divider { background: #334155; }
body.dark-mode .nav-arrow { color: #64748B; }
body.dark-mode .top-header { background: #1E293B; border-bottom-color: #334155; }
body.dark-mode .card { background: #1E293B; border-color: #334155; }
body.dark-mode .card-header { background: #0F172A; border-bottom-color: #334155; color: #E2E8F0; }
body.dark-mode .card-body { color: #E2E8F0; }
body.dark-mode .table thead th, body.dark-mode .data-table th { background: #0F172A; color: #94A3B8; border-color: #334155; }
body.dark-mode .table tbody td, body.dark-mode .data-table td { border-color: #334155; color: #E2E8F0; }
body.dark-mode .table tbody tr:hover, body.dark-mode .data-table tr:hover { background: rgba(255,255,255,0.03); }
body.dark-mode .form-control { background: #0F172A; border-color: #334155; color: #E2E8F0; }
body.dark-mode .form-control:focus { border-color: #3B82F6; background: #1E293B; }
body.dark-mode .form-control::placeholder { color: #64748B; }
body.dark-mode .form-label { color: #CBD5E1; }
body.dark-mode select.form-control { background: #0F172A; color: #E2E8F0; }
body.dark-mode .btn-outline { border-color: #334155; color: #CBD5E1; }
body.dark-mode .btn-outline:hover { background: #334155; color: #F1F5F9; }
body.dark-mode .dropdown-menu { background: #1E293B; border-color: #334155; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
body.dark-mode .dropdown-item { color: #CBD5E1; }
body.dark-mode .dropdown-item:hover { background: #0F172A; color: #F1F5F9; }
body.dark-mode .dropdown-item.active { background: #334155; }
body.dark-mode .alert { border-color: #334155; background: #1E293B; color: #E2E8F0; }
body.dark-mode .page-title { color: #F1F5F9; }
body.dark-mode .text-muted { color: #64748B; }
body.dark-mode hr { border-color: #334155; }

/* Dark mode: stat cards */
body.dark-mode .stat-card { background: #1E293B; border-color: #334155; }
body.dark-mode .stat-card .stat-value { color: #F1F5F9; }
body.dark-mode .stat-card .stat-label { color: #94A3B8; }

/* Dark mode: badges */
body.dark-mode .badge { opacity: 0.9; }
body.dark-mode .badge-info { background: #3B82F6; }

/* Dark mode: tabs */
body.dark-mode .tab { color: #64748B; }
body.dark-mode .tab:hover { color: #CBD5E1; }
body.dark-mode .tab.active { color: #3B82F6; border-bottom-color: #3B82F6; }
body.dark-mode .tabs { border-bottom-color: #334155; }

/* Dark mode: notifications */
body.dark-mode .notification-panel { background: #1E293B; }
body.dark-mode .notification-header { border-color: #334155; color: #F1F5F9; }
body.dark-mode .notification-item { border-color: #334155; color: #CBD5E1; }
body.dark-mode .notification-item:hover { background: #0F172A; }
body.dark-mode .notification-item.unread { background: #1a2744; }

/* Dark mode: user menu */
body.dark-mode .user-menu { background: #1E293B; }
body.dark-mode .user-menu-header { border-color: #334155; }
body.dark-mode .user-menu-info strong { color: #F1F5F9; }
body.dark-mode .user-menu-info span { color: #64748B; }
body.dark-mode .user-menu-section { border-color: #334155; }
body.dark-mode .user-menu-avatar { border-color: #334155; }

/* Dark mode: header */
body.dark-mode .header-icon { color: #94A3B8; }
body.dark-mode .header-icon:hover { color: #F1F5F9; }
body.dark-mode .user-avatar { color: #CBD5E1; }

/* Dark mode: rich editor */
body.dark-mode .rich-editor { border-color: #334155; }
body.dark-mode .editor-toolbar { background: #0F172A; border-color: #334155; }
body.dark-mode .editor-toolbar button { color: #94A3B8; }
body.dark-mode .editor-toolbar button:hover { background: #334155; color: #F1F5F9; }
body.dark-mode .editor-content { background: #1E293B; color: #E2E8F0; }

/* Dark mode: password strength */
body.dark-mode .strength-segment { background: #334155; }

/* Dark mode: manager list */
body.dark-mode .manager-list { border-color: #334155; }
body.dark-mode .manager-item { border-color: #334155; color: #CBD5E1; }

/* Dark mode: modules */
body.dark-mode .module-checkbox { color: #CBD5E1; }

/* Dark mode: login */
body.dark-mode .login-page { background: #0F172A; }
body.dark-mode .login-card { background: #1E293B; border-color: #334155; }

/* ---- INLINE FORM LAYOUT ---- */
.form-row-inline{display:flex;align-items:center;margin-bottom:16px}
.form-label-inline{width:180px;text-align:right;padding-right:16px;font-size:14px;color:#555;flex-shrink:0}
.form-field-inline{flex:1;max-width:600px}
.autocomplete-results{max-height:200px;overflow-y:auto;border:1px solid #DDD;border-radius:4px;background:#fff;margin:-12px 0 16px 196px;max-width:600px;z-index:10}
.autocomplete-results .ac-item{padding:8px 12px;cursor:pointer;font-size:13px;border-bottom:1px solid #f0f0f0}
.autocomplete-results .ac-item:hover{background:#F8F9FA}
body.dark-mode .form-label-inline{color:#94A3B8}
body.dark-mode .autocomplete-results{background:#1E293B;border-color:#334155}
body.dark-mode .autocomplete-results .ac-item{border-color:#334155;color:#CBD5E1}
body.dark-mode .autocomplete-results .ac-item:hover{background:#0F172A}

/* ---- RICH EDITOR ---- */
.rich-editor{border:1px solid #DDD;border-radius:var(--radius,8px);overflow:hidden}
.editor-content{padding:12px;font-size:14px;outline:none;min-height:100px}
.editor-content:focus{background:#FEFEFE}
.editor-toolbar{display:flex;align-items:center;gap:2px;padding:8px;border-top:1px solid #E8E8E8;background:#FAFAFA;flex-wrap:wrap}
.editor-toolbar button{width:32px;height:32px;border:none;background:none;cursor:pointer;border-radius:4px;display:inline-flex;align-items:center;justify-content:center;color:#555;font-size:13px}
.editor-toolbar button:hover{background:#E8E8E8}
.toolbar-divider{width:1px;height:20px;background:#DDD;margin:0 4px}

/* ---- TICKET DETAIL ---- */
.ticket-detail-grid{display:grid;grid-template-columns:1fr 340px;gap:24px;align-items:start}
@media(max-width:900px){.ticket-detail-grid{grid-template-columns:1fr}}
.conversation-message{display:flex;gap:12px;padding:16px;border:1px solid #E8E8E8;border-radius:var(--radius,8px);margin-bottom:12px;background:#fff}
.conversation-message.internal{background:#FFFBEB;border-color:#FDE68A}
.msg-avatar{flex-shrink:0}
.msg-avatar img{width:44px;height:44px;border-radius:50%;object-fit:cover}
.msg-avatar-placeholder{width:44px;height:44px;border-radius:50%;background:#E5E7EB;display:flex;align-items:center;justify-content:center;color:#9CA3AF;font-size:18px}
.msg-content{flex:1;min-width:0}
.msg-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px}
.msg-author strong{font-size:14px;color:#333}
.msg-role{font-size:12px;color:#999;margin-left:6px}
.msg-date{font-size:12px;color:#999}
.msg-body{font-size:14px;line-height:1.7;color:#444;word-wrap:break-word}
.msg-body img{max-width:100%;height:auto}
.msg-body table{border-collapse:collapse;margin:8px 0}
.msg-body table td,.msg-body table th{border:1px solid #DDD;padding:4px 8px;font-size:13px}
.info-card{border:1px solid #E8E8E8;border-radius:var(--radius,8px);overflow:hidden;background:#fff}
.info-card-header{padding:12px 16px;font-size:14px;font-weight:600;color:#333;border-bottom:1px solid #E8E8E8;background:#FAFAFA}
.info-card-body{padding:16px}
.info-row{display:flex;margin-bottom:10px;font-size:13px}
.info-label{width:110px;text-align:right;padding-right:12px;color:#777;flex-shrink:0}
.info-value{color:#333;flex:1}
.justify-end{justify-content:flex-end}
.log-old{background:#FEE2E2;color:#991B1B;padding:4px 10px;border-radius:4px;font-size:13px;display:inline-block}
.log-new{background:#DCFCE7;color:#166534;padding:4px 10px;border-radius:4px;font-size:13px;display:inline-block}

/* Ticket tabs */
.ticket-tabs{display:flex;gap:0;border-bottom:2px solid #E8E8E8;overflow-x:auto}
.ticket-tab{padding:10px 16px;font-size:13px;color:#666;text-decoration:none;border-bottom:2px solid transparent;margin-bottom:-2px;white-space:nowrap;transition:all 0.2s}
.ticket-tab:hover{color:#333;border-bottom-color:#CCC}
.ticket-tab.active{color:var(--primary,#3B82F6);border-bottom-color:var(--primary,#3B82F6);font-weight:600}
.tab-count{background:#E8E8E8;color:#555;font-size:11px;padding:1px 6px;border-radius:8px;margin-left:4px}
.ticket-tab.active .tab-count{background:var(--primary,#3B82F6);color:#fff}

/* Dark mode ticket detail */
body.dark-mode .conversation-message{background:#1E293B;border-color:#334155}
body.dark-mode .conversation-message.internal{background:#1a2744;border-color:#334155}
body.dark-mode .msg-author strong{color:#F1F5F9}
body.dark-mode .msg-body{color:#CBD5E1}
body.dark-mode .msg-avatar-placeholder{background:#334155;color:#64748B}
body.dark-mode .info-card{background:#1E293B;border-color:#334155}
body.dark-mode .info-card-header{background:#0F172A;border-color:#334155;color:#F1F5F9}
body.dark-mode .info-label{color:#94A3B8}
body.dark-mode .info-value{color:#E2E8F0}
body.dark-mode .log-old{background:#7F1D1D;color:#FCA5A5}
body.dark-mode .log-new{background:#14532D;color:#86EFAC}
body.dark-mode .ticket-tab{color:#64748B}
body.dark-mode .ticket-tab:hover{color:#CBD5E1;border-bottom-color:#334155}
body.dark-mode .ticket-tab.active{color:#3B82F6;border-bottom-color:#3B82F6}
body.dark-mode .ticket-tabs{border-bottom-color:#334155}
body.dark-mode .tab-count{background:#334155;color:#94A3B8}
body.dark-mode .ticket-tab.active .tab-count{background:#3B82F6;color:#fff}
