/* ========================================
   Devign Support - Purple Brand Theme
   ======================================== */

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0f0f23;
    --bg-secondary: #141432;
    --bg-card: #1a1a3e;
    --bg-input: #12122a;
    --bg-hover: #1e1e45;
    --accent: #4f46e5;
    --accent-light: #7c3aed;
    --accent-dark: #4338ca;
    --accent-glow: rgba(79, 70, 229, 0.15);
    --gradient: linear-gradient(135deg, #4f46e5, #7c3aed);
    --text-primary: #ffffff;
    --text-secondary: #b0b0c8;
    --text-muted: #6b6b8a;
    --border: #2a2a4a;
    --border-light: #33335a;
    --success: #10b981;
    --success-bg: #0a2e1e;
    --warning: #fbbf24;
    --warning-bg: #2e2a0a;
    --danger: #f87171;
    --danger-bg: #2e0a0a;
    --info: #60a5fa;
    --info-bg: #0a1a2e;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.5);
    --transition: 0.2s ease;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--accent-light);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: #a78bfa;
}

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

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 20px 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand img {
    height: 32px;
    width: auto;
}

.sidebar-brand span {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-top: 6px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.sidebar-nav .nav-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 16px 12px 8px;
    font-weight: 600;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: all var(--transition);
}

.sidebar-nav a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-nav a.active {
    background: var(--accent-glow);
    color: var(--accent-light);
}

.sidebar-nav a .icon {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.sidebar-user .user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user .user-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .user-role {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
}

.page-header {
    padding: 24px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--bg-secondary);
}

.page-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.page-header .subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.page-body {
    padding: 32px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.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: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient);
    opacity: 0.5;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-card .stat-value.gold { color: var(--accent-light); }
.stat-card .stat-value.success { color: var(--success); }
.stat-card .stat-value.warning { color: var(--warning); }
.stat-card .stat-value.danger { color: var(--danger); }

/* Tables */
.table-wrapper {
    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-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    white-space: nowrap;
}

table td {
    padding: 12px 16px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

table tbody tr {
    transition: background var(--transition);
}

table tbody tr:hover {
    background: var(--bg-hover);
}

table tbody tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-open { background: var(--info-bg); color: var(--info); border: 1px solid rgba(96,165,250,0.2); }
.badge-in_progress { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(251,191,36,0.2); }
.badge-waiting { background: rgba(168,85,247,0.1); color: #a855f7; border: 1px solid rgba(168,85,247,0.2); }
.badge-closed { background: rgba(107,114,128,0.1); color: #9ca3af; border: 1px solid rgba(107,114,128,0.2); }

.badge-low { background: rgba(16,185,129,0.1); color: var(--success); border: 1px solid rgba(16,185,129,0.2); }
.badge-medium { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(251,191,36,0.2); }
.badge-urgent { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(248,113,113,0.2); }

.badge-superadmin { background: linear-gradient(135deg, rgba(79,70,229,0.15), rgba(124,58,237,0.15)); color: #a78bfa; border: 1px solid rgba(124,58,237,0.3); }
.badge-admin { background: var(--accent-glow); color: var(--accent-light); border: 1px solid rgba(79,70,229,0.3); }
.badge-client { background: var(--info-bg); color: var(--info); border: 1px solid rgba(96,165,250,0.2); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
}

.btn-primary {
    background: var(--gradient);
    color: #fff;
}

.btn-primary:hover {
    opacity: 0.9;
    color: #fff;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border-light);
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(248,113,113,0.2);
}

.btn-danger:hover {
    background: rgba(248,113,113,0.15);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b6b8a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Password toggle */
.password-wrapper {
    position: relative;
}

.password-wrapper .form-control {
    padding-right: 60px;
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--accent-light);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
}

/* File Upload */
.file-upload {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
}

.file-upload:hover {
    border-color: var(--accent);
    background: rgba(79,70,229,0.03);
}

.file-upload input[type="file"] {
    display: none;
}

.file-upload .upload-text {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.file-upload .upload-text strong {
    color: var(--accent-light);
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(16,185,129,0.2); }
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(248,113,113,0.2); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(251,191,36,0.2); }
.alert-info { background: var(--info-bg); color: var(--info); border: 1px solid rgba(96,165,250,0.2); }

/* Ticket List Items */
.ticket-row td:first-child {
    font-weight: 600;
    color: var(--accent-light);
}

.ticket-title {
    font-weight: 600;
    color: var(--text-primary);
}

.ticket-title:hover {
    color: var(--accent-light);
}

.ticket-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Ticket Detail / Chat */
.ticket-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    margin-bottom: 24px;
}

.ticket-info-item .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.ticket-info-item .value {
    font-size: 0.9rem;
    font-weight: 600;
}

.reply-thread {
    margin-bottom: 24px;
}

.reply-item {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.reply-item:last-child {
    border-bottom: none;
}

.reply-item.admin-reply {
    background: rgba(79,70,229,0.04);
}

.reply-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.reply-avatar.admin {
    background: var(--gradient);
    color: #fff;
}

.reply-avatar.client {
    background: var(--info);
    color: #fff;
}

.reply-content {
    flex: 1;
    min-width: 0;
}

.reply-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.reply-author {
    font-weight: 600;
    font-size: 0.9rem;
}

.reply-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.reply-body {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.7;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Attachments */
.attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.attachment-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition);
}

.attachment-item:hover {
    border-color: var(--accent);
    color: var(--accent-light);
}

.attachment-preview {
    max-width: 200px;
    max-height: 150px;
    border-radius: var(--radius);
    margin-top: 8px;
    border: 1px solid var(--border);
}

/* Filters Bar */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
}

.filters-bar .form-control {
    width: auto;
    min-width: 150px;
}

.search-input {
    position: relative;
}

.search-input input {
    padding-left: 36px;
}

.search-input::before {
    content: "\1F50D";
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
}

/* SLA Indicator */
.sla-timer {
    font-size: 0.8rem;
    font-weight: 600;
}

.sla-timer.ok { color: var(--success); }
.sla-timer.warning { color: var(--warning); }
.sla-timer.critical { color: var(--danger); }

/* Login Page */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(79,70,229,0.12), transparent 70%);
    top: -150px;
    right: -150px;
    pointer-events: none;
}

.login-wrapper::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(124,58,237,0.08), transparent 70%);
    bottom: -100px;
    left: -100px;
    pointer-events: none;
}

.login-box {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    position: relative;
    z-index: 1;
}

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

.login-box .logo img {
    height: 40px;
    width: auto;
    margin-bottom: 8px;
}

.login-box .logo p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 4px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 0.9rem;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 20px;
}

.pagination a,
.pagination span {
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition);
}

.pagination a {
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.pagination a:hover {
    border-color: var(--accent);
    color: var(--accent-light);
}

.pagination .active {
    background: var(--gradient);
    color: #fff;
    font-weight: 700;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.05rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Utilities */
.text-accent { color: var(--accent-light); }
.text-gold { color: var(--accent-light); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.8rem; }
.font-bold { font-weight: 700; }
.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; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.hidden { display: none; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Notifications */
.notif-wrapper {
    position: relative;
}

.notif-bell {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius);
    position: relative;
    transition: all var(--transition);
    display: flex;
    align-items: center;
}

.notif-bell:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}

.notif-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    width: 360px;
    max-height: 480px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    overflow: hidden;
    margin-top: 8px;
}

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

.notif-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9rem;
}

.notif-list {
    max-height: 350px;
    overflow-y: auto;
}

.notif-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.notif-item {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text-secondary);
    transition: background var(--transition);
}

.notif-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.notif-item.unread {
    background: rgba(79, 70, 229, 0.05);
    border-left: 3px solid var(--accent);
}

.notif-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
    background: var(--bg-hover);
}

.notif-icon.ticket { background: var(--accent-glow); }
.notif-icon.reply { background: var(--info-bg); }
.notif-icon.status { background: var(--warning-bg); }

.notif-content {
    flex: 1;
    min-width: 0;
}

.notif-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-msg {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 3px;
}

.notif-footer {
    display: block;
    text-align: center;
    padding: 12px;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--accent-light);
    text-decoration: none;
    font-weight: 600;
}

.notif-footer:hover {
    background: var(--bg-hover);
}

@media (max-width: 480px) {
    .notif-dropdown {
        width: 300px;
        right: -40px;
    }
}

/* WhatsApp Floating Button */
.whatsapp-float {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: #25d366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    z-index: 999;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
}

.whatsapp-float:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
}

.whatsapp-float svg {
    width: 28px;
    height: 28px;
    fill: #fff;
}

/* Mobile Sidebar Toggle */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    line-height: 1;
    z-index: 10;
    position: relative;
    -webkit-tap-highlight-color: rgba(79,70,229,0.2);
    touch-action: manipulation;
    min-width: 44px;
    min-height: 44px;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 199;
}

.sidebar-overlay.show {
    display: block;
}

/* ════════════════════════════════════
   RESPONSIVE - TABLET (768px and below)
   ════════════════════════════════════ */
@media (max-width: 768px) {
    /* Sidebar: off-canvas */
    .sidebar {
        transform: translateX(-100%);
        z-index: 200;
        width: 280px;
        box-shadow: 4px 0 20px rgba(0,0,0,0.5);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar.open + .sidebar-overlay,
    .sidebar-overlay.show {
        display: block;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 8px;
        flex-shrink: 0;
    }

    /* Page header */
    .page-header {
        padding: 14px 16px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .page-header h2 {
        font-size: 1.1rem;
    }

    .page-header > div:first-child {
        display: flex;
        align-items: center;
        min-width: 0;
    }

    .page-actions {
        width: 100%;
        justify-content: flex-end;
    }

    /* Page body */
    .page-body {
        padding: 16px;
    }

    /* Stats */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-card .stat-value {
        font-size: 1.6rem;
    }

    /* Cards */
    .card {
        border-radius: var(--radius);
    }

    .card-header {
        padding: 12px 14px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .card-body {
        padding: 14px;
    }

    /* Tables: horizontal scroll */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -14px;
        padding: 0 14px;
    }

    table th, table td {
        padding: 10px 12px;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    /* Forms */
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .form-control {
        font-size: 16px; /* prevents iOS zoom on focus */
    }

    /* Filters */
    .filters-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .filters-bar .form-control {
        width: 100%;
        min-width: unset;
    }

    .filters-bar form {
        display: flex;
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }

    .filters-bar form .form-control {
        width: 100%;
    }

    .filters-bar form .btn {
        width: 100%;
    }

    /* Ticket info grid */
    .ticket-info {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        padding: 14px;
    }

    /* Replies */
    .reply-item {
        padding: 12px;
        gap: 10px;
    }

    .reply-header {
        flex-wrap: wrap;
        gap: 4px;
    }

    .reply-body {
        font-size: 0.85rem;
    }

    /* Attachments */
    .attachment-preview {
        max-width: 150px;
        max-height: 100px;
    }

    /* Buttons */
    .btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    .flex.gap-1 {
        flex-wrap: wrap;
    }

    /* Status/assign forms on ticket view */
    .flex.gap-1.mb-3 {
        flex-direction: column;
    }

    .flex.gap-1.mb-3 form {
        width: 100%;
    }

    .flex.gap-1.mb-3 form select {
        flex: 1;
    }

    /* Notifications dropdown */
    .notif-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 70vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        margin-top: 0;
    }

    /* Login page */
    .login-box {
        padding: 28px 20px;
        margin: 0 8px;
        border-radius: var(--radius-lg);
    }

    .login-box .logo img {
        height: 32px;
    }

    /* WhatsApp button */
    .whatsapp-float {
        bottom: 16px;
        right: 16px;
        width: 48px;
        height: 48px;
    }

    .whatsapp-float svg {
        width: 24px;
        height: 24px;
    }

    /* Pagination */
    .pagination {
        flex-wrap: wrap;
    }

    .pagination a, .pagination span {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    /* Cards with max-width (forms) */
    .card[style*="max-width"] {
        max-width: 100% !important;
    }

    /* Modal */
    .modal {
        width: 95%;
        max-height: 85vh;
    }
}

/* ════════════════════════════════════
   RESPONSIVE - PHONE (480px and below)
   ════════════════════════════════════ */
@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    .page-header {
        padding: 12px 14px;
    }

    .page-header h2 {
        font-size: 1rem;
    }

    .page-body {
        padding: 12px;
    }

    /* Stats: single column */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .stat-card {
        padding: 12px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .stat-card::before {
        display: none;
    }

    .stat-card .stat-label {
        margin-bottom: 0;
        font-size: 0.75rem;
    }

    .stat-card .stat-value {
        font-size: 1.3rem;
    }

    /* Ticket info: single column */
    .ticket-info {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 12px;
    }

    .ticket-info-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .ticket-info-item .label {
        margin-bottom: 0;
    }

    /* Reply avatars smaller */
    .reply-avatar {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }

    /* Sidebar user */
    .sidebar-user .avatar {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }

    .sidebar-user .user-name {
        font-size: 0.8rem;
    }

    .sidebar-footer .flex.gap-1 {
        flex-direction: column;
    }

    .sidebar-footer .flex.gap-1 > * {
        flex: unset !important;
    }

    /* Login */
    .login-box {
        padding: 24px 16px;
    }

    .login-box .logo img {
        height: 28px;
    }

    /* Tables: card-style on very small screens */
    table th {
        font-size: 0.7rem;
        padding: 8px 10px;
    }

    table td {
        font-size: 0.78rem;
        padding: 8px 10px;
    }

    /* File upload */
    .file-upload {
        padding: 16px;
    }

    .file-upload .upload-text {
        font-size: 0.8rem;
    }

    /* Notification dropdown */
    .notif-dropdown {
        max-height: 80vh;
    }

    .notif-item {
        padding: 10px 12px;
    }

    .notif-icon {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
}

/* ════════════════════════════════════
   RESPONSIVE - SMALL PHONE (360px)
   ════════════════════════════════════ */
@media (max-width: 360px) {
    .page-header h2 {
        font-size: 0.9rem;
    }

    .sidebar {
        width: 260px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .btn-sm {
        padding: 5px 10px;
        font-size: 0.75rem;
    }
}
