/* ==========================================
   SupportDesk - Complete Stylesheet
   ========================================== */

:root {
    /* Dark theme (default) */
    --bg-primary:   #0d0d1f;
    --bg-secondary: #13132b;
    --bg-card:      #191934;
    --bg-input:     #1f1f44;
    --bg-hover:     #242452;
    --border:       #2e2e60;
    --text-primary:   #eeeef5;
    --text-secondary: #9090bb;
    --text-muted:     #5e5e90;
    --accent:       #00d4aa;
    --accent-hover: #00f0c2;
    --accent-dim:   rgba(0, 212, 170, 0.14);
    --red:    #ff4466;
    --orange: #ff8c42;
    --yellow: #ffc444;
    --green:  #00d4aa;
    --blue:   #4d94ff;
    --purple: #9b72ff;
    --radius:    12px;
    --radius-sm:  8px;
    --shadow:     0 4px 20px rgba(0,0,0,0.4);
    --shadow-lg:  0 8px 40px rgba(0,0,0,0.5);
    --font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* ==========================================
   Navbar
   ========================================== */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    height: 62px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 12px rgba(0,0,0,0.25);
}

.nav-brand a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.3px;
}

.logo-icon {
    color: var(--accent);
    font-size: 20px;
}

.nav-links {
    display: flex;
    gap: 2px;
}

.nav-link {
    padding: 7px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    transition: all 0.18s;
}

.nav-link:hover  { color: var(--text-primary); background: var(--bg-hover); }
.nav-link.active {
    color: var(--accent);
    background: var(--accent-dim);
    font-weight: 600;
}

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

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-dim);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.user-name {
    font-weight: 500;
    font-size: 14px;
}

.user-role-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--accent-dim);
    color: var(--accent);
}

.role-admin { background: rgba(136, 102, 255, 0.15); color: var(--purple); }
.role-agent { background: rgba(68, 136, 255, 0.15); color: var(--blue); }

/* ==========================================
   Main Content
   ========================================== */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

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

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.back-link {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ==========================================
   Cards
   ========================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,0.02);
}

.card-header h3 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.card-body {
    padding: 22px;
}

/* ==========================================
   Stats Grid
   ========================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stats-small { grid-template-columns: repeat(3, 1fr); }

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    display: flex;
    align-items: center;
    gap: 18px;
    transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

/* Colored left accent bar per card */
.stat-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    border-radius: 3px 0 0 3px;
}
.stat-card:nth-child(1)::before { background: var(--blue); }
.stat-card:nth-child(2)::before { background: var(--orange); }
.stat-card:nth-child(3)::before { background: var(--yellow); }
.stat-card:nth-child(4)::before { background: var(--green); }
.stat-card:nth-child(5)::before { background: var(--purple); }

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.stat-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    flex-shrink: 0;
}

.stat-blue   { background: rgba(77,148,255,0.14);  color: var(--blue); }
.stat-orange { background: rgba(255,140,66,0.14);  color: var(--orange); }
.stat-yellow { background: rgba(255,196,68,0.14);  color: var(--yellow); }
.stat-green  { background: rgba(0,212,170,0.14);   color: var(--green); }
.stat-purple { background: rgba(155,114,255,0.14); color: var(--purple); }

/* Make inline SVGs inside stat icons scale correctly */
.stat-icon svg { width: 26px; height: 26px; display: block; }

.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }

/* ==========================================
   Dashboard Grid
   ========================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

/* Priority Bars */
.priority-bars { display: flex; flex-direction: column; gap: 14px; }
.priority-row { display: flex; align-items: center; gap: 12px; }
.priority-label { width: 70px; font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.priority-bar-track { flex: 1; height: 10px; background: var(--bg-input); border-radius: 5px; overflow: hidden; }
.priority-bar-fill { height: 100%; border-radius: 5px; transition: width 0.6s ease; min-width: 4px; }
.priority-count { width: 30px; text-align: right; font-weight: 600; font-size: 14px; font-family: var(--mono); }

/* Category List */
.category-list { display: flex; flex-direction: column; gap: 10px; }
.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
}
.category-name { font-size: 14px; font-weight: 500; }
.category-badge {
    background: var(--accent-dim);
    color: var(--accent);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    font-family: var(--mono);
}

/* ==========================================
   Tables
   ========================================== */
.table-responsive { overflow-x: auto; }

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

.table thead th {
    text-align: left;
    padding: 12px 14px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.table tbody td {
    padding: 14px;
    border-bottom: 1px solid rgba(42, 42, 90, 0.5);
    font-size: 14px;
}

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

.clickable-row { cursor: pointer; transition: background 0.15s; }
.clickable-row:hover { background: var(--bg-hover); }

.ticket-code {
    font-family: var(--mono);
    font-size: 12px;
    background: var(--accent-dim);
    color: var(--accent);
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.ticket-subject {
    font-weight: 500;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==========================================
   Status & Priority Badges
   ========================================== */
.status-badge, .priority-badge, .category-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.status-open { background: rgba(68,136,255,0.15); color: var(--blue); }
.status-in_progress { background: rgba(255,187,51,0.15); color: var(--yellow); }
.status-waiting { background: rgba(255,136,68,0.15); color: var(--orange); }
.status-resolved { background: rgba(0,212,170,0.15); color: var(--green); }
.status-closed { background: rgba(104,104,160,0.15); color: var(--text-muted); }

.priority-critical { background: rgba(255,68,102,0.15); color: var(--red); }
.priority-high { background: rgba(255,136,68,0.15); color: var(--orange); }
.priority-medium { background: rgba(255,187,51,0.15); color: var(--yellow); }
.priority-low { background: rgba(0,212,170,0.15); color: var(--green); }

.category-tag { background: var(--bg-input); color: var(--text-secondary); font-weight: 500; text-transform: none; }

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

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-group textarea { resize: vertical; min-height: 100px; }

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

.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.form-inline-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 120px auto;
    gap: 16px;
    align-items: end;
}

.select-sm {
    padding: 6px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
}

/* ==========================================
   Buttons
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #07211c;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(0,212,170,0.3);
}
.btn-primary:hover {
    background: var(--accent-hover);
    color: #07211c;
    transform: translateY(-1px);
    box-shadow: 0 4px 18px rgba(0,212,170,0.4);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-hover); }

.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-full { width: 100%; }

/* ==========================================
   Alerts
   ========================================== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success { background: rgba(0,212,170,0.1); border: 1px solid rgba(0,212,170,0.3); color: var(--green); }
.alert-error { background: rgba(255,68,102,0.1); border: 1px solid rgba(255,68,102,0.3); color: var(--red); }
.alert-info { background: rgba(68,136,255,0.1); border: 1px solid rgba(68,136,255,0.3); color: var(--blue); }

/* ==========================================
   Auth Page
   ========================================== */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(ellipse at 50% 0%, #161635 0%, var(--bg-primary) 70%);
}

.auth-container { width: 100%; max-width: 420px; padding: 20px; }

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px;
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-header .logo { font-size: 24px; margin-bottom: 8px; }
.auth-subtitle { color: var(--text-muted); font-size: 14px; }

.auth-switch {
    text-align: center;
    margin-top: 18px;
    font-size: 14px;
    color: var(--text-muted);
}

.guest-option { margin-top: 24px; }

.divider {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 16px;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ==========================================
   Ticket View Layout
   ========================================== */
.ticket-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 20px;
    align-items: start;
}

.ticket-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}

/* Response Cards */
.response-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    overflow: hidden;
}

.response-card.original { border-left: 3px solid var(--accent); }
.response-card.internal-note { border-left: 3px solid var(--yellow); background: rgba(255,187,51,0.04); }

.response-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}

.response-author {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-input);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.avatar-agent { background: var(--accent-dim); color: var(--accent); }

.response-time { color: var(--text-muted); font-size: 12px; margin-left: 4px; }

.response-body {
    padding: 16px 20px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
}

.agent-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--accent-dim);
    color: var(--accent);
    font-weight: 700;
    text-transform: uppercase;
}

.internal-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255,187,51,0.15);
    color: var(--yellow);
    font-weight: 700;
    text-transform: uppercase;
}

/* System Messages */
.system-response { background: transparent; border-color: transparent; }
.system-message {
    padding: 12px 20px;
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.system-icon { font-size: 16px; }

/* Sidebar */
.sidebar-details { display: flex; flex-direction: column; gap: 14px; }
.detail-row { display: flex; justify-content: space-between; font-size: 14px; }
.detail-label { color: var(--text-muted); font-weight: 500; }

.sidebar-form .form-group { margin-bottom: 10px; }
.sidebar-form label { font-size: 12px; }

/* Timeline */
.timeline { position: relative; padding-left: 20px; }
.timeline::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    margin-bottom: 18px;
}

.timeline-dot {
    position: absolute;
    left: -17px;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-card);
}

.timeline-content { display: flex; flex-direction: column; gap: 3px; }
.timeline-time { font-size: 12px; color: var(--text-muted); }
.timeline-user { font-size: 12px; color: var(--text-muted); }

/* Reply Card */
.reply-card { border: 1px dashed var(--border); }

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

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

/* ==========================================
   Pagination
   ========================================== */
.pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    padding-top: 20px;
}

.page-link {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-input);
}

.page-link.active {
    background: var(--accent);
    color: #0a0a1a;
}

/* ==========================================
   Filter Bar
   ========================================== */
.filter-card { padding: 16px 20px; margin-bottom: 20px; }
.filter-form {
    display: flex;
    gap: 12px;
    align-items: end;
}

.filter-form .form-group { margin-bottom: 0; flex: 1; }
.filter-form .btn { height: 40px; }

/* ==========================================
   Utility
   ========================================== */
.text-muted { color: var(--text-muted); }

/* ==========================================
   Attachments
   ========================================== */
.file-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 24px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: var(--bg-input);
    user-select: none;
}
.file-upload-area:hover,
.file-upload-area.drag-over {
    border-color: var(--accent);
    background: var(--accent-dim);
}
.file-upload-area input[type="file"] { display: none; }
.file-upload-icon { font-size: 28px; margin-bottom: 6px; }
.file-upload-text { font-size: 14px; color: var(--text-secondary); font-weight: 500; }
.file-upload-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.file-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.file-preview-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    font-size: 12px;
    color: var(--text-secondary);
}
.file-preview-size { color: var(--text-muted); }

.file-remove-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    padding: 0 0 0 4px;
    margin-left: auto;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}
.file-remove-btn:hover { color: var(--red); }

/* Make label inside upload area fill the whole area so the click target is correct */
.file-upload-area label {
    display: block;
    cursor: pointer;
    padding: 24px 20px;
    text-align: center;
}
.file-upload-area { padding: 0; }

.attachments-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 20px 14px;
    border-top: 1px solid var(--border);
    background: var(--bg-input);
}
.attachments-label {
    width: 100%;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.attachment-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 5px 12px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: border-color 0.2s, color 0.2s;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.attachment-item:hover { border-color: var(--accent); color: var(--accent); }
.attachment-item-icon { flex-shrink: 0; }
.attachment-img-thumb {
    display: block;
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: opacity 0.2s;
}
.attachment-img-thumb:hover { opacity: 0.85; }
.attachment-img-wrap {
    display: inline-block;
    text-decoration: none;
}

/* ==========================================
   Theme Toggle — Pill / Slider (button-based, no checkbox)
   The thumb & track change via [data-theme="light"] on <html>
   ========================================== */
.theme-switch {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    border-radius: 20px;
    transition: background 0.15s;
}
.theme-switch:hover { background: var(--bg-hover); }

.switch-track {
    display: inline-block;  /* REQUIRED: span is inline by default, width/height ignored otherwise */
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    transition: background 0.3s, border-color 0.3s;
    pointer-events: none;   /* button handles click */
    vertical-align: middle;
}

.switch-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: var(--text-muted);
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,0.35);
    transition: transform 0.25s ease, background 0.25s;
    pointer-events: none;
}

/* Light mode — CSS reads data-theme on <html> directly, no JS class needed */
[data-theme="light"] .switch-track {
    background: var(--accent-dim);
    border-color: var(--accent);
}
[data-theme="light"] .switch-thumb {
    transform: translateX(20px);
    background: var(--accent);
}

.switch-icon {
    font-size: 14px;
    line-height: 1;
    user-select: none;
}

/* Nav avatar button (profile link) */
.nav-avatar-btn {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    border-radius: 50%;
    transition: box-shadow 0.2s;
}
.nav-avatar-btn:hover .user-avatar,
.nav-avatar-btn.active .user-avatar {
    box-shadow: 0 0 0 2px var(--accent);
}

/* ==========================================
   Light Theme Variables
   ========================================== */
[data-theme="light"] {
    --bg-primary:    #f2f4f9;
    --bg-secondary:  #ffffff;
    --bg-card:       #ffffff;
    --bg-input:      #f6f8fd;
    --bg-hover:      #ebeef8;
    --border:        #d0d7ec;
    --text-primary:  #141625;
    --text-secondary:#424a6a;
    --text-muted:    #7080a8;
    --accent:        #008f6f;
    --accent-hover:  #00a880;
    --accent-dim:    rgba(0, 143, 111, 0.10);
    --shadow:        0 2px 12px rgba(0,0,0,0.07);
    --shadow-lg:     0 6px 28px rgba(0,0,0,0.10);
    --red:    #e03250;
    --orange: #d96c28;
    --yellow: #c98a00;
    --green:  #008f6f;
    --blue:   #2b72e8;
    --purple: #6b44dc;
}

[data-theme="light"] body {
    background: var(--bg-primary);
}

[data-theme="light"] .auth-page {
    background: linear-gradient(135deg, #eef1fa 0%, #f8f9fd 100%);
}

[data-theme="light"] .navbar {
    box-shadow: 0 1px 0 var(--border), 0 2px 8px rgba(0,0,0,0.05);
}

[data-theme="light"] .card-header {
    background: rgba(0,0,0,0.01);
}

/* Light mode button primary keeps dark text readable on teal */
[data-theme="light"] .btn-primary { color: #ffffff; box-shadow: 0 2px 10px rgba(0,143,111,0.25); }
[data-theme="light"] .btn-primary:hover { color: #ffffff; }

/* Fix select option colors in light mode */
[data-theme="light"] .form-group select option { background: #ffffff; color: #141625; }

/* Fix table row borders */
[data-theme="light"] .table tbody td { border-bottom: 1px solid var(--border); }

[data-theme="light"] .timeline::before { background: var(--border); }

/* Status badges look better in light mode */
[data-theme="light"] .status-open      { background: rgba(43,114,232,0.1); color: var(--blue); }
[data-theme="light"] .status-in_progress { background: rgba(201,138,0,0.1); color: var(--yellow); }
[data-theme="light"] .status-resolved  { background: rgba(0,143,111,0.1);  color: var(--green); }
[data-theme="light"] .status-closed    { background: rgba(112,128,168,0.1); color: var(--text-muted); }
[data-theme="light"] .priority-critical { background: rgba(224,50,80,0.1);  color: var(--red); }
[data-theme="light"] .priority-high    { background: rgba(217,108,40,0.1);  color: var(--orange); }
[data-theme="light"] .priority-medium  { background: rgba(201,138,0,0.1);   color: var(--yellow); }
[data-theme="light"] .priority-low     { background: rgba(0,143,111,0.1);   color: var(--green); }

/* Stat card accent bars visible in light mode */
[data-theme="light"] .stat-blue   { background: rgba(43,114,232,0.08);  }
[data-theme="light"] .stat-orange { background: rgba(217,108,40,0.08);  }
[data-theme="light"] .stat-yellow { background: rgba(201,138,0,0.08);   }
[data-theme="light"] .stat-green  { background: rgba(0,143,111,0.08);   }
[data-theme="light"] .stat-purple { background: rgba(107,68,220,0.08);  }

/* ==========================================
   Professional UI Polish
   ========================================== */

/* Elevated cards */
.card {
    box-shadow: var(--shadow);
}
.stat-card {
    box-shadow: var(--shadow);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.22);
}

/* Better navbar */
.navbar {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 1px 0 var(--border);
}

/* Nav links pill style */
.nav-link {
    border-radius: 8px;
}
.nav-link.active {
    background: var(--accent-dim);
    color: var(--accent);
    font-weight: 600;
}

/* Better buttons */
.btn-primary {
    box-shadow: 0 2px 8px rgba(0, 212, 170, 0.25);
}
.btn-primary:hover {
    box-shadow: 0 4px 16px rgba(0, 212, 170, 0.35);
    transform: translateY(-1px);
}
.btn-outline:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Better form inputs */
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    box-shadow: 0 0 0 3px var(--accent-dim), 0 1px 4px rgba(0,0,0,0.1);
}

/* Auth card polish */
.auth-card {
    box-shadow: 0 8px 48px rgba(0,0,0,0.28);
}

/* Closure note card highlight */
.response-card.closure-note {
    border-left: 3px solid var(--green);
}

/* Better table row hover */
.clickable-row:hover {
    background: var(--bg-hover);
    transform: none;
}

/* Badge refinements */
.status-badge, .priority-badge {
    font-size: 11px;
    letter-spacing: 0.4px;
    font-weight: 700;
}

/* ==========================================
   Responsive — Mobile First
   ========================================== */
@media (max-width: 768px) {
    /* Navbar collapses gracefully */
    .navbar {
        flex-wrap: wrap;
        height: auto;
        padding: 10px 16px;
        gap: 8px;
    }
    .nav-brand { order: 1; }
    .nav-user  { order: 2; margin-left: auto; }
    .nav-links {
        order: 3;
        width: 100%;
        overflow-x: auto;
        padding-bottom: 2px;
        gap: 2px;
        /* Hide scrollbar but keep scrollable */
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
    .nav-links::-webkit-scrollbar { display: none; }
    .nav-link { padding: 7px 12px; font-size: 13px; white-space: nowrap; }

    /* Content spacing */
    .main-content { padding: 14px 12px; }
    .page-header  { flex-direction: column; align-items: flex-start; gap: 10px; }
    .page-header h1 { font-size: 22px; }

    /* Stats: 2 columns on mobile */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stats-small { grid-template-columns: 1fr 1fr; }
    .stat-card { padding: 14px; gap: 10px; }
    .stat-value { font-size: 22px; }
    .stat-icon { width: 40px; height: 40px; font-size: 22px; }

    /* Dashboard / layout grids */
    .dashboard-grid  { grid-template-columns: 1fr; }
    .ticket-layout   { grid-template-columns: 1fr; }
    .form-row        { grid-template-columns: 1fr; }
    .form-inline-grid{ grid-template-columns: 1fr; }
    .filter-form     { flex-direction: column; }
    .filter-form .form-group { flex: none; }

    /* Sidebar goes below main content on mobile */
    .ticket-sidebar { order: -1; }

    /* Auth card full width */
    .auth-container { padding: 12px; }
    .auth-card      { padding: 24px 20px; }

    /* Table: hide less important columns */
    .table thead th:nth-child(4),
    .table tbody td:nth-child(4) { display: none; }

    /* Hide user name text in nav on mobile, show only avatar */
    .user-name, .user-role-badge { display: none; }

    /* Card padding reduction */
    .card-body { padding: 14px; }
    .card-header { padding: 12px 14px; }
}

@media (max-width: 480px) {
    /* Single column stats on very small screens */
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .ticket-code { font-size: 10px; }
    .btn { padding: 9px 14px; font-size: 13px; }
    .btn-sm { padding: 5px 10px; font-size: 11px; }
}
