/* ===== IT Helpdesk - Design System ===== */
:root {
    /* Soft Indigo Theme */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --primary-bg: #eef2ff;

    --secondary: #64748b;
    --success: #10b981;
    --success-bg: #d1fae5;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --danger: #ef4444;
    --danger-bg: #fee2e2;
    --info: #3b82f6;
    --info-bg: #dbeafe;

    /* Backgrounds */
    --bg: #f8fafc;
    /* Lighter slate for body */
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    /* Light Sidebar */
    --bg-dark: #0f172a;

    /* Text */
    --text: #334155;
    /* Softer dark gray */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;

    --border: #e2e8f0;

    /* Dimensions & Effects */
    --sidebar-width: 280px;
    /* Slightly wider */
    --topbar-height: 70px;
    --radius: 16px;
    /* Softer corners */
    --radius-sm: 8px;

    /* Diffused Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
}

/* ===== Layout & Sidebar ===== */
.app-container {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-header {
    height: var(--topbar-height);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* border-bottom: 1px solid var(--border); */
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.logo i {
    font-size: 1.75rem;
    color: var(--primary);
    filter: drop-shadow(0 4px 6px rgba(99, 102, 241, 0.3));
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    display: none;
    /* Visible only on mobile */
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.sidebar-nav {
    flex: 1;
    padding: 24px 16px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 4px;
    text-decoration: none;
}

.nav-item:hover {
    background: var(--bg);
    color: var(--primary);
    transform: translateX(4px);
}

.nav-item.active {
    background: var(--primary-bg);
    color: var(--primary);
    font-weight: 600;
}

.nav-item i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
    transition: var(--transition);
}

.nav-item.active i {
    transform: scale(1.1);
}

.nav-section {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-light);
    padding: 24px 16px 12px;
    font-weight: 700;
}

.sidebar-footer {
    padding: 24px;
    border-top: 1px solid var(--border);
    background: linear-gradient(to top, rgba(248, 250, 252, 0.5), transparent);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border-radius: var(--radius);
    transition: var(--transition);
}

.user-info:hover {
    background: var(--bg);
}

.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    font-size: 1rem;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Sidebar Backdrop (Mobile) */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 90;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding-bottom: 40px;
    transition: var(--transition);
}

.topbar {
    height: var(--topbar-height);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 40px;
    gap: 20px;
    position: sticky;
    top: 0;
    z-index: 50;
    transition: var(--transition);
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    flex: 1;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.mobile-toggle {
    display: none;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-primary);
    padding: 8px;
    margin-right: 8px;
    border-radius: var(--radius-sm);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Notification Dropdown */
.notification-dropdown {
    position: relative;
}

.notif-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-secondary);
    position: relative;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.notif-btn:hover {
    background: var(--bg);
    color: var(--text);
}

/* Top Search */
.search-form-top {
    display: flex;
    align-items: center;
    background: var(--bg);
    border-radius: 20px;
    padding: 4px 12px;
    margin-right: 12px;
    border: 1px solid transparent;
    transition: var(--transition);
    width: 240px;
}

.search-form-top:focus-within {
    border-color: var(--primary);
    width: 300px;
}

.search-form-top input {
    border: none;
    background: transparent;
    font-size: 0.85rem;
    color: var(--text);
    width: 100%;
    outline: none;
    font-family: var(--font);
}

.search-form-top button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.search-form-top button:hover {
    color: var(--primary);
}

@media (max-width: 768px) {
    .search-form-top {
        display: none;
    }
}

.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notif-panel {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 8px;
    width: 340px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    z-index: 200;
}

.notif-panel.show {
    display: block;
}

.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.notif-header h3 {
    font-size: 0.9rem;
}

.notif-header a {
    font-size: 0.8rem;
}

.notif-list {
    max-height: 300px;
    overflow-y: auto;
}

.notif-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
    color: var(--text);
}

.notif-item:hover {
    background: var(--bg);
}

.notif-item p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.notif-empty {
    padding: 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.user-menu-btn:hover {
    background: var(--bg);
}

.avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #fff;
    font-size: 0.8rem;
}

.user-menu-panel {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 8px;
    width: 220px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    z-index: 200;
    overflow: hidden;
}

.user-menu-panel.show {
    display: block;
}

.user-menu-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.user-menu-header strong {
    display: block;
    font-size: 0.9rem;
}

.user-menu-header small {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text);
    font-size: 0.9rem;
    transition: var(--transition);
}

.user-menu-item:hover {
    background: var(--bg);
}

.content-wrapper {
    padding: 24px;
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 24px;
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
}

.card-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 24px;
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.stat-total .stat-icon {
    background: var(--primary-bg);
    color: var(--primary);
}

.stat-open .stat-icon {
    background: var(--warning-bg);
    color: var(--warning);
}

.stat-progress .stat-icon {
    background: var(--info-bg);
    color: var(--info);
}

.stat-resolved .stat-icon {
    background: var(--success-bg);
    color: var(--success);
}

.stat-sla .stat-icon {
    background: #fce7f3;
    color: #ec4899;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    display: block;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ===== Tables ===== */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    white-space: nowrap;
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    vertical-align: middle;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: var(--bg);
}

.clickable-row {
    cursor: pointer;
}

.text-truncate {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== Badges ===== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-open {
    background: var(--warning-bg);
    color: #92400e;
}

.badge-assigned {
    background: var(--info-bg);
    color: #1e40af;
}

.badge-in_progress {
    background: #e0e7ff;
    color: #3730a3;
}

.badge-pending {
    background: #fef3c7;
    color: #92400e;
}

.badge-resolved {
    background: var(--success-bg);
    color: #065f46;
}

.badge-closed {
    background: #f1f5f9;
    color: #475569;
}

.badge-reopened {
    background: var(--danger-bg);
    color: #991b1b;
}

.badge-internal {
    background: #fce7f3;
    color: #9d174d;
    font-size: 0.65rem;
}

.priority {
    font-size: 0.75rem;
    font-weight: 600;
}

.priority-critical {
    color: var(--danger);
}

.priority-high {
    color: #ea580c;
}

.priority-medium {
    color: var(--warning);
}

.priority-low {
    color: var(--success);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #e2e8f0;
    color: var(--text);
}

.btn-secondary:hover {
    background: #cbd5e1;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
}

.btn-danger-outline:hover {
    background: var(--danger);
    color: #fff;
}

/* ===== Mobile Responsiveness ===== */
@media (max-width: 768px) {

    /* Layout */
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    .sidebar.show {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    /* Topbar */
    .topbar {
        padding: 0 16px;
        justify-content: space-between;
    }

    .page-title {
        font-size: 1.1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-toggle {
        display: block;
    }

    .search-form-top {
        display: none;
    }

    /* Cards & Grids */
    .card-body {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* Tables */
    .table th,
    .table td {
        padding: 10px;
        font-size: 0.8rem;
    }

    .badge {
        font-size: 0.65rem;
        padding: 3px 8px;
    }

    /* Filters */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .filter-bar {
        width: 100%;
        flex-direction: column;
    }

    .filter-bar select,
    .filter-bar .btn {
        width: 100%;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    /* Tickets Index - Floating Action Button style for "Buat Ticket" */
    .page-header .btn-primary {
        width: 100%;
        justify-content: center;
    }
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 6px 14px;
}

.btn-outline:hover {
    background: var(--primary-bg);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.82rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.form-control,
.form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg-card);
    transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-control.readonly {
    background: var(--bg);
    color: var(--text-secondary);
    cursor: not-allowed;
}

textarea.form-control {
    resize: vertical;
}

.form-help {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 4px;
    display: block;
}

.required {
    color: var(--danger);
}

.input-icon {
    position: relative;
}

.input-icon i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.input-icon input {
    padding-left: 40px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.filter-bar {
    display: flex;
    gap: 10px;
}

.filter-bar .form-select {
    width: auto;
    min-width: 150px;
    padding: 8px 12px;
    font-size: 0.85rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 8px 0;
    cursor: pointer;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

/* ===== Alerts ===== */
.alert {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    margin: 12px 24px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.3s ease;
}

.alert-success {
    background: var(--success-bg);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-danger {
    background: var(--danger-bg);
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-info {
    background: var(--info-bg);
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.alert ul {
    margin: 0;
    padding-left: 16px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Auth Pages ===== */
.auth-body {
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font);
}

.auth-container {
    width: 100%;
    max-width: 460px;
    padding: 24px;
}

.auth-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 48px 40px;
    box-shadow: 0 25px 50px -12px rgba(99, 102, 241, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.8);
    transition: transform 0.3s ease;
}

.auth-card:hover {
    transform: translateY(-5px);
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo i {
    font-size: 3rem;
    color: var(--primary);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 6px rgba(99, 102, 241, 0.2));
}

.auth-logo h1 {
    font-size: 1.75rem;
    margin-top: 12px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.auth-logo p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 6px;
}

.auth-form .form-group {
    margin-bottom: 20px;
}

.auth-form label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: block;
}

.auth-form .input-icon input {
    padding: 14px 16px 14px 44px;
    height: auto;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.auth-form .input-icon input:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.auth-form .input-icon i {
    font-size: 1.1rem;
    color: #94a3b8;
    left: 16px;
}

.auth-form .btn-primary {
    padding: 14px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
    border: none;
    letter-spacing: 0.5px;
}

.auth-form .btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* ===== Ticket Detail ===== */
.ticket-detail-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
}

.ticket-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.detail-item label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-item span {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 2px;
}

.detail-description {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.detail-description label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: block;
}

.description-content {
    font-size: 0.9rem;
    line-height: 1.7;
    white-space: pre-wrap;
}

.detail-attachments {
    margin-top: 16px;
}

.detail-attachments label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: block;
}

.attachment-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text);
    margin-right: 8px;
    margin-bottom: 8px;
    transition: var(--transition);
}

.attachment-item:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

/* Comments */
.comment-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.comment-item {
    display: flex;
    gap: 12px;
}

.comment-internal {
    background: #fef3c7;
    padding: 12px;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--warning);
}

.comment-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #fff;
    font-size: 0.8rem;
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.comment-meta strong {
    font-size: 0.85rem;
}

.comment-role {
    font-size: 0.72rem;
    color: var(--text-secondary);
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 10px;
}

.comment-time {
    font-size: 0.75rem;
    color: var(--text-light);
}

.comment-text {
    font-size: 0.9rem;
    line-height: 1.6;
}

.comment-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.9rem;
    resize: vertical;
    transition: var(--transition);
}

.comment-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 20px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    position: absolute;
    left: -20px;
    top: 4px;
    border: 2px solid var(--bg-card);
    z-index: 1;
}

.timeline-content {
    font-size: 0.85rem;
}

.timeline-content small {
    display: block;
    color: var(--text-secondary);
    margin-top: 2px;
}

.timeline-content time {
    font-size: 0.75rem;
    color: var(--text-light);
    display: block;
    margin-top: 4px;
}

.timeline-reason {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
    font-style: italic;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 12px;
    color: var(--text-light);
}

.empty-state h3 {
    margin-bottom: 8px;
    color: var(--text);
}

.empty-state p {
    font-size: 0.9rem;
    margin-bottom: 16px;
}

/* Pagination */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    padding: 16px 0;
}

.pagination-wrapper a,
.pagination-wrapper span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    margin: 0 2px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    border: 1px solid var(--border);
    color: var(--text);
    transition: var(--transition);
}

.pagination-wrapper a:hover {
    background: var(--primary-bg);
    border-color: var(--primary);
    color: var(--primary);
}

.pagination-wrapper .active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Utility */
.mt-2 {
    margin-top: 8px;
}

.text-danger {
    color: var(--danger) !important;
}

.text-muted {
    color: var(--text-secondary);
}

/* ===== Report Charts (Horizontal Bars) ===== */
.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.chart-bars {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.chart-bar-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chart-bar-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.chart-bar-track {
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
}

.chart-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

.chart-bar-open {
    background: var(--warning);
}

.chart-bar-assigned {
    background: var(--info);
}

.chart-bar-in_progress {
    background: var(--primary);
}

.chart-bar-pending {
    background: #f59e0b;
}

.chart-bar-resolved {
    background: var(--success);
}

.chart-bar-closed {
    background: var(--secondary);
}

.chart-bar-reopened {
    background: var(--danger);
}

.chart-bar-category {
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
}

.chart-bar-critical {
    background: var(--danger);
}

.chart-bar-high {
    background: #ea580c;
}

.chart-bar-medium {
    background: var(--warning);
}

.chart-bar-low {
    background: var(--success);
}

.progress-bar-mini {
    width: 80px;
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}

.progress-bar-fill {
    height: 100%;
    background: var(--success);
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* ===== Form Row (2-column) ===== */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.ticket-form {
    max-width: 700px;
}

/* ===== Notification Full List ===== */
.notif-full-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.notif-full-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.notif-full-item:hover {
    background: var(--bg);
}

.notif-full-item.unread {
    background: var(--primary-bg);
    border-left: 3px solid var(--primary);
}

.notif-full-icon i {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.notif-full-content {
    flex: 1;
}

.notif-full-content strong {
    font-size: 0.9rem;
    display: block;
}

.notif-full-content p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.notif-full-content small {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* ===== Button Outline Variants ===== */
.btn-danger-outline {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: 6px 14px;
}

.btn-danger-outline:hover {
    background: var(--danger-bg);
}

.btn-success-outline {
    background: transparent;
    color: var(--success);
    border: 1px solid var(--success);
    padding: 6px 14px;
}

.btn-success-outline:hover {
    background: var(--success-bg);
}

.btn-group-sm {
    display: flex;
    gap: 4px;
}

/* ===== Knowledge Base ===== */
.kb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.kb-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    gap: 16px;
    text-decoration: none;
    color: var(--text);
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.kb-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.kb-icon {
    width: 42px;
    height: 42px;
    background: var(--primary-bg);
    color: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.kb-content h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.kb-excerpt {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
}

.kb-meta {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--text-light);
    flex-wrap: wrap;
}

.kb-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.article-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.article-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
}

.article-meta {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.article-content {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text);
}

.article-content h2 {
    font-size: 1.4rem;
    margin: 24px 0 12px;
    font-weight: 600;
}

.article-content ul,
.article-content ol {
    padding-left: 20px;
    margin-bottom: 16px;
}

.article-content p {
    margin-bottom: 16px;
}

.article-content img {
    max-width: 100%;
    border-radius: var(--radius-sm);
    margin: 16px 0;
}

/* ===== Loading State ===== */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .ticket-detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-toggle {
        display: block;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .filter-bar {
        flex-direction: column;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar {
        padding: 0 16px;
    }

    .content-wrapper {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .auth-card {
        padding: 24px 20px;
    }

    .topbar {
        padding: 0 12px;
    }

    .page-title {
        font-size: 1.1rem;
    }
}

/* ===== Responsive Tables ===== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.table-responsive .table {
    margin-bottom: 0;
    min-width: 600px;
    /* Ensure table doesn't squish */
}

/* ===== Mobile Utils ===== */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
        /* Prevent horizontal scroll */
    }

    .app-container {
        width: 100%;
        overflow-x: hidden;
    }

    .sidebar {
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    }
}

/* ===== Knowledge Base ===== */
.article-detail .article-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.article-meta {
    display: flex;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.article-content {
    font-size: 1rem;
    line-height: 1.8;
    white-space: pre-wrap;
    /* Preserve whitespace and line breaks */
    color: var(--text);
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    font-family: var(--font);
}