/* ================================
   Global
   ================================ */
@import url('vendor-fonts/fonts.css');

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

:root {
    --sidebar-w: 220px;
    --header-h: 56px;
    --brand-green: #97c12f;
    --brand-green-hover: #82a828;
    --brand-red: #C42217;
    --panel-dark: #1a2538;
    --bg: #f1f5f9;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    margin: 0;
    padding: 0;
    color: #1f2937;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.hidden { display: none !important; }

/* Pets overrides */
body.helpdesk-pets {
    --brand-green: #0f172a;
    --brand-green-hover: #1e293b;
    --panel-dark: #0c0f14;
}

/* ================================
   1. Login
   ================================ */
#login-container {
    display: flex; align-items: center; justify-content: center;
    height: 100vh; background: var(--panel-dark);
}
.login-box {
    background: #fff; padding: 3rem; border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
    width: 100%; max-width: 400px; text-align: center;
}
.login-logo { width: 80px; height: 80px; margin-bottom: 1rem; object-fit: contain; }
.font-heading {
    font-family: 'Poppins', sans-serif; text-transform: uppercase;
    letter-spacing: 0.05em; margin: 0 0 0.25rem 0;
    color: #0f172a; font-size: 1.5rem;
}
.login-box p { color: #64748b; font-size: 0.95rem; margin: 0 0 2rem 0; }
.login-box input {
    width: 100%; padding: 14px; margin-bottom: 1rem;
    border: 1px solid #e5e7eb; border-radius: 8px; font-size: 1rem;
}
.login-box input:focus { outline: 2px solid var(--brand-green); border-color: transparent; }
.remember-me-wrapper {
    display: flex; align-items: center; margin-bottom: 1.5rem;
    font-size: 0.9rem; color: #475569;
}
.remember-me-wrapper input { width: auto !important; margin: 0 0.5rem 0 0; cursor: pointer; }
.remember-me-wrapper label { cursor: pointer; }
.login-localhost-hint {
    font-size: 0.8rem; color: #475569; background: #f1f5f9; padding: 0.75rem;
    border-radius: 8px; margin-bottom: 1rem; text-align: left; line-height: 1.4;
}
.login-localhost-hint code { background: #e2e8f0; padding: 0.1em 0.3em; border-radius: 4px; font-size: 0.85em; }
#login-button {
    width: 100%; padding: 14px; border: none; border-radius: 8px;
    background: var(--brand-green); color: white; font-weight: 600;
    font-size: 1rem; cursor: pointer; transition: all 0.2s;
}
#login-button:hover { background: var(--brand-green-hover); transform: translateY(-1px); }
#login-button.helpdesk-pets-btn { background: #0f172a; color: white; }
#login-button.helpdesk-pets-btn:hover { background: #1e293b; }
#login-error { color: var(--brand-red); font-size: 0.85rem; margin-bottom: 0.5rem; min-height: 1.2em; }
.copyright { margin-top: 2rem; font-size: 0.75rem; color: #94a3b8; }

/* ================================
   2. App Layout — sidebar + content
   ================================ */
#app-container {
    display: flex; flex-direction: column;
    height: 100vh; height: 100dvh;
    overflow: hidden;
}

#mobile-header {
    display: none;
    align-items: center; gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #fff; border-bottom: 1px solid #e5e7eb;
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
}
#mobile-header h1 { margin: 0; font-size: 1rem; font-weight: 700; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.hamburger-button, .header-back-button {
    background: transparent; border: none; font-size: 1.25rem; cursor: pointer;
    padding: 0.5rem; min-width: 44px; min-height: 44px;
    display: flex; align-items: center; justify-content: center; color: #0f172a;
}
.header-back-button { display: none; }

.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    height: 100vh; height: 100dvh;
    overflow: hidden;
}

.overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 140; display: none;
}

/* ================================
   3. Sidebar
   ================================ */
#sidebar {
    background: var(--panel-dark); color: #e2e8f0;
    display: flex; flex-direction: column;
    height: 100%; overflow: hidden;
}

.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand img { width: 32px; height: 32px; border-radius: 8px; object-fit: contain; }
.sidebar-brand-text {
    font-family: 'Poppins', sans-serif; font-size: 0.85rem;
    font-weight: 700; letter-spacing: 0.08em; color: #fff;
}

.sidebar-nav {
    flex: 1; overflow-y: auto; padding: 0.75rem 0;
}

.nav-item {
    width: 100%; display: flex; align-items: center; gap: 10px;
    padding: 0.6rem 1rem; margin: 0;
    background: transparent; border: none; color: #94a3b8;
    font-size: 0.875rem; font-weight: 500; cursor: pointer;
    transition: all 0.15s; text-align: left;
    border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #e2e8f0; }
.nav-item.active {
    color: #fff; background: rgba(255,255,255,0.08);
    border-left-color: var(--brand-green); font-weight: 600;
}
.nav-item i { width: 20px; text-align: center; font-size: 0.9rem; flex-shrink: 0; }

body.helpdesk-pets .sidebar-brand img { background: rgba(255,255,255,0.15); border-radius: 6px; padding: 2px; }
body.helpdesk-pets .nav-item.active { border-left-color: #018496; }

.nav-badge {
    margin-left: auto; background: var(--brand-green); color: var(--panel-dark);
    font-size: 0.7rem; font-weight: 800; padding: 2px 7px; border-radius: 99px;
    min-width: 20px; text-align: center;
}
body.helpdesk-pets .nav-badge { background: #018496; color: #fff; }

/* ================================
   3b. Sidebar Footer
   ================================ */
.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 0.75rem;
    display: flex; flex-direction: column; gap: 0.6rem;
    flex-shrink: 0;
}

.sidebar-live-stats {
    display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px; padding: 0.5rem 0.65rem;
    font-size: 0.75rem; color: #94a3b8;
}
.live-stats-row {
    display: flex; justify-content: space-between; align-items: center;
}
.live-stats-online-row {
    grid-column: 1 / -1;
    cursor: pointer;
    user-select: none;
}
.live-stats-online-row:hover { opacity: 0.9; }
.online-toggle-icon {
    font-size: 0.6rem; color: #94a3b8; margin-left: 4px;
    transition: transform 0.2s;
}
#online-row.expanded .online-toggle-icon { transform: rotate(180deg); }
.online-users-details { grid-column: 1 / -1; }
.online-users-list { max-height: 200px; overflow-y: auto; }
.live-stats-row span:first-child {
    font-weight: 700; color: var(--brand-green); font-variant-numeric: tabular-nums;
}
body.helpdesk-pets .live-stats-row span:first-child { color: #e2e8f0; }

.maintenance-toggle {
    width: 100%; display: flex; align-items: center; gap: 8px;
    padding: 0.55rem 0.65rem; border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(239,68,68,0.12); color: #fecaca;
    font-size: 0.8rem; font-weight: 700; cursor: pointer;
    transition: all 0.2s;
}
.maintenance-toggle:hover { background: rgba(239,68,68,0.2); }
.maintenance-toggle.is-on { background: rgba(34,197,94,0.14); color: #dcfce7; border-color: rgba(34,197,94,0.3); }
.maintenance-toggle.is-on:hover { background: rgba(34,197,94,0.22); }
.maintenance-label { flex: 1; text-align: left; text-transform: uppercase; letter-spacing: 0.02em; }
.maintenance-status {
    font-size: 0.7rem; font-weight: 800; padding: 2px 8px;
    border-radius: 99px; background: rgba(255,255,255,0.1); color: #e2e8f0;
}
.maintenance-toggle.is-on .maintenance-status { color: #dcfce7; }

.sidebar-profile {
    display: flex; align-items: center; gap: 8px;
    padding: 0.5rem 0.25rem 0 0.25rem;
}
#admin-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    border: 2px solid var(--brand-green); object-fit: cover; flex-shrink: 0;
}
body.helpdesk-pets #admin-avatar { border-color: #018496; }
.sidebar-profile-info {
    display: flex; flex-direction: column; min-width: 0; flex: 1;
}
#admin-display-name { font-weight: 600; font-size: 0.8rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-profile-email { font-size: 0.7rem; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-logout {
    background: transparent; border: none; color: #64748b; font-size: 1rem;
    cursor: pointer; padding: 4px; transition: color 0.2s; flex-shrink: 0;
}
.sidebar-logout:hover { color: #ef4444; }

/* ================================
   4. Content Area
   ================================ */
.content-area {
    display: flex; flex-direction: column;
    height: 100%; overflow: hidden; background: var(--bg);
    position: relative;
}

.view-panel {
    display: flex; flex-direction: column;
    height: 100%; overflow: hidden;
}
.view-panel.hidden { display: none !important; }

.content-header {
    padding: 1rem 1.5rem;
    background: #fff; border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}
.content-header h2 {
    margin: 0 0 0.5rem 0; font-size: 1.1rem; font-weight: 800;
    color: #0f172a; display: flex; align-items: center; gap: 0.5rem;
}

.content-scroll {
    flex: 1; overflow-y: auto; overflow-x: hidden;
    padding: 1.25rem 1.5rem 2rem 1.5rem;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}

/* ================================
   4b. Ticket Toolbar (filters + search)
   ================================ */
.ticket-toolbar { display: flex; flex-direction: column; gap: 0.5rem; }

.filter-pills {
    display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.pill-btn {
    padding: 5px 12px; border-radius: 99px;
    border: 1px solid #d1d5db; background: #fff; color: #475569;
    font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: all 0.15s;
    white-space: nowrap;
}
.pill-btn:hover { border-color: #94a3b8; background: #f8fafc; }
.pill-btn.active {
    background: var(--brand-green); color: #fff; border-color: var(--brand-green);
}
body.helpdesk-pets .pill-btn.active { background: #018496; border-color: #018496; }

.pill-divider {
    width: 1px; height: 20px; background: #d1d5db; margin: 0 4px;
}

.ticket-search-row {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.search-input {
    flex: 1; min-width: 180px; padding: 8px 12px;
    border: 1px solid #d1d5db; border-radius: 8px; font-size: 0.875rem;
    background: #fff; color: #1f2937;
}
.search-input:focus { outline: 2px solid var(--brand-green); border-color: transparent; }
.search-input::placeholder { color: #94a3b8; }

.search-select {
    padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 8px;
    background: #fff; font-size: 0.875rem; font-weight: 600; cursor: pointer;
}
.search-select:focus { outline: 2px solid var(--brand-green); border-color: transparent; }

.archived-toggle {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.85rem; color: #475569; cursor: pointer; white-space: nowrap;
}
.archived-toggle input { accent-color: var(--brand-green); }

.sort-control { margin-left: auto; }

/* ================================
   5. Ticket List
   ================================ */
.ticket-item {
    background: #fff; padding: 1.25rem; margin-bottom: 0.75rem;
    border-radius: 12px; border: 1px solid #e5e7eb;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05); cursor: pointer; transition: all 0.2s;
    position: relative;
}
.ticket-item:hover { transform: translateY(-2px); box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); }
.ticket-item.active { border-color: var(--brand-green); box-shadow: 0 0 0 2px var(--brand-green); }
.ticket-item.priority { border-color: rgba(196,34,23,0.55); }

body.helpdesk-pets .ticket-item.active { border-color: #018496; box-shadow: 0 0 0 2px #018496; }

.ticket-flag { position: absolute; top: 1rem; right: 1rem; color: var(--brand-red); font-size: 1.2rem; }
.ticket-header { display: flex; justify-content: space-between; margin-bottom: 0.5rem; }
.ticket-category {
    font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
    padding: 2px 8px; border-radius: 99px; background: #f3f4f6; color: #4b5563;
}
.ticket-date { font-size: 0.75rem; color: #9ca3af; }
.ticket-email { font-size: 0.875rem; font-weight: 600; color: #1f2937; margin-bottom: 0.25rem; }
.ticket-snippet {
    font-size: 0.875rem; color: #6b7280;
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
.ticket-archived {
    display: inline-block; margin-top: 6px; padding: 4px 8px;
    border-radius: 999px; font-size: 0.75rem; font-weight: 700;
    background: #fef3c7; color: #92400e; border: 1px solid #fcd34d;
}

/* ================================
   6. Ticket Detail
   ================================ */
#ticket-detail-container {
    background: #fff; overflow: hidden;
}

.detail-content-wrapper {
    padding: 2rem; overflow-y: auto; height: 100%; min-height: 0;
}

.detail-back-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: none; border: none; color: #64748b; font-size: 0.85rem;
    font-weight: 600; cursor: pointer; padding: 0; margin-bottom: 1rem;
    transition: color 0.15s;
}
.detail-back-btn:hover { color: #0f172a; }
.detail-back-btn i { font-size: 0.8rem; }

.compact-header { margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid #e5e7eb; }
.compact-title {
    font-size: 1.25rem; font-weight: 700; color: #111827;
    margin: 0 0 0.5rem 0; display: flex; align-items: center; gap: 8px;
}
.pill {
    display: inline-block; padding: 4px 8px; border-radius: 999px;
    font-size: 0.75rem; font-weight: 700; border: 1px solid #e5e7eb;
}
.pill-archived { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.compact-meta { font-size: 0.875rem; color: #6b7280; line-height: 1.5; }
.compact-meta strong { color: #374151; font-weight: 600; }

.ticket-message-body {
    font-size: 1rem; line-height: 1.6; color: #1f2937;
    margin-bottom: 2rem; white-space: pre-wrap;
}

.admin-section {
    background: #f9fafb; padding: 1.5rem; border-radius: 12px; border: 1px solid #e5e7eb;
}
.detail-group { margin-bottom: 1rem; }
.detail-group label {
    display: block; font-size: 0.75rem; font-weight: 700;
    color: #6b7280; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.25rem;
}

textarea, select {
    width: 100%; padding: 10px; border: 1px solid #d1d5db;
    border-radius: 8px; font-family: inherit; font-size: 0.95rem; background: #fff;
}
textarea:focus, select:focus { outline: 2px solid var(--brand-green); border-color: transparent; }

.verification-actions { display: flex; gap: 10px; margin-top: 1rem; flex-wrap: wrap; }
.approve-btn {
    flex: 1; min-width: 140px; padding: 10px 16px;
    background: var(--brand-green); color: white; border: none; border-radius: 8px;
    font-weight: 600; cursor: pointer; display: flex; align-items: center;
    justify-content: center; gap: 6px; transition: all 0.2s;
}
.approve-btn:hover { background: var(--brand-green-hover); transform: translateY(-1px); }
.approve-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }
.decline-btn-outline {
    flex: 1; min-width: 140px; padding: 10px 16px;
    background: #fff; color: var(--brand-red); border: 1px solid var(--brand-red);
    border-radius: 8px; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 6px; transition: all 0.2s;
}
.decline-btn-outline:hover { background: #fef2f2; transform: translateY(-1px); }
.decline-btn-outline:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

.action-row { display: flex; gap: 10px; margin-top: 1.5rem; }
#save-ticket-button {
    flex: 2; padding: 12px; background: var(--brand-green); color: white;
    border: none; border-radius: 8px; font-weight: 600; cursor: pointer;
}
#save-ticket-button:hover { background: var(--brand-green-hover); transform: translateY(-1px); }
#toggle-priority-button {
    flex: 1; padding: 12px; background: #fff; color: var(--brand-red);
    border: 1px solid var(--brand-red); border-radius: 8px; font-weight: 600; cursor: pointer;
}
#toggle-priority-button.is-flagged { background: var(--brand-red); color: white; }

.delete-btn {
    background: #ef4444; color: white; border: none; padding: 10px 16px;
    border-radius: 8px; font-weight: 600; cursor: pointer; transition: all 0.2s;
    display: flex; align-items: center; gap: 6px;
}
.delete-btn:hover { background: #dc2626; transform: translateY(-1px); }
.delete-btn:disabled { background: #9ca3af; cursor: not-allowed; transform: none; }

/* Reply section in ticket detail */
.reply-section { margin-top: 2rem; padding-top: 2rem; border-top: 2px dashed #e5e7eb; }
.reply-header {
    display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
    color: #0f172a; font-weight: 700; font-size: 0.9rem; text-transform: uppercase;
}
#reply-message {
    width: 100%; padding: 12px; border: 1px solid #cbd5e1; border-radius: 8px;
    min-height: 80px; margin-bottom: 10px; font-family: inherit;
}
#send-reply-btn {
    width: 100%; padding: 12px; background: var(--brand-green); color: white;
    font-weight: 600; border: none; border-radius: 8px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
#send-reply-btn:hover { background: var(--brand-green-hover); }

/* ================================
   7. Stats & Reports (shared)
   ================================ */
.loading-stats { padding: 1.25rem; color: #475569; font-weight: 700; }
.error-message {
    padding: 1rem 1.25rem; background: #fef2f2; border: 1px solid #fecaca;
    color: #991b1b; border-radius: 10px; font-weight: 700;
}

.stats-section { max-width: 1100px; margin: 0 auto 1.25rem auto; }
.stats-section h3 { margin: 0 0 0.75rem 0; font-size: 1.05rem; font-weight: 900; color: #0f172a; }
.stats-section h4 { margin: 1.25rem 0 0.75rem 0; font-size: 0.95rem; font-weight: 900; color: #0f172a; }

.stats-grid {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px;
}

.stat-card {
    background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
    padding: 0.9rem 1rem; box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.stat-card.highlight {
    border-color: rgba(151,193,47,0.55);
    box-shadow: 0 0 0 2px rgba(151,193,47,0.18);
}
.stat-label {
    font-size: 0.75rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.05em; color: #64748b; margin-bottom: 0.35rem;
}
.stat-value { font-size: 1.35rem; font-weight: 900; color: #0f172a; line-height: 1.1; margin-bottom: 0.2rem; }
.stat-period { font-size: 0.8rem; font-weight: 700; color: #94a3b8; }

.stats-details {
    background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
    padding: 0.9rem 1rem; color: #334155;
}

.service-breakdown {
    display: flex; flex-direction: column; gap: 8px;
    background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 0.75rem 1rem;
}
.service-item {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 0.35rem 0; border-bottom: 1px dashed #e5e7eb; font-weight: 700; color: #0f172a;
}
.service-item:last-child { border-bottom: none; }
.service-name { color: #334155; text-transform: capitalize; }
.service-cost { font-variant-numeric: tabular-nums; }

.logs-table { overflow-x: auto; }
.logs-table table { min-width: 680px; }

/* Influencer tabs */
.influencer-tabs { display: flex; gap: 8px; border-bottom: 2px solid #e5e7eb; margin-bottom: 20px; flex-wrap: wrap; }
.influencer-tab-btn {
    padding: 12px 20px; background: transparent; border: none;
    border-bottom: 3px solid transparent; color: #64748b;
    font-weight: 700; font-size: 0.9rem; cursor: pointer; transition: all 0.2s;
    display: flex; align-items: center; gap: 8px;
}
.influencer-tab-btn:hover { color: #0f172a; background: #f8fafc; }
.influencer-tab-btn.active { color: #0f172a; border-bottom-color: var(--brand-green); font-weight: 900; }
body.helpdesk-pets .influencer-tab-btn.active { border-bottom-color: #018496; }

/* Close button (kept for JS-rendered headers) */
.close-btn {
    background: transparent; border: none; color: #6b7280; cursor: pointer;
    padding: 0.5rem; border-radius: 6px; transition: all 0.2s;
    display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
}
.close-btn:hover { background: #e5e7eb; color: #111827; }

/* Usage stats header (kept for inline-rendered headers) */
.usage-stats-header {
    padding: 1.25rem 1.5rem; border-bottom: 1px solid #e5e7eb;
    background: #fff; display: flex; align-items: center;
    justify-content: space-between; gap: 12px;
}
.usage-stats-header h2 {
    margin: 0; font-size: 1.1rem; font-weight: 800; color: #0f172a;
    display: flex; align-items: center; gap: 0.5rem;
}

/* Admin tool button (used by JS-rendered content) */
.admin-tool-btn-compact {
    padding: 0.6rem; border-radius: 6px;
    border: 1px solid #d1d5db; background: #fff; color: #475569;
    font-size: 0.85rem; cursor: pointer; transition: all 0.2s;
    display: inline-flex; align-items: center; gap: 0.5rem;
}
.admin-tool-btn-compact:hover { background: #f8fafc; border-color: #94a3b8; }

/* Online users details */
.online-users-details {
    margin-top: 0.6rem; max-height: 220px; overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.1); border-radius: 8px;
    background: rgba(255,255,255,0.04);
}
.online-users-empty { padding: 0.6rem 0.7rem; color: #94a3b8; font-size: 0.75rem; font-weight: 700; }
.online-user-row { padding: 0.6rem 0.7rem; border-bottom: 1px solid rgba(255,255,255,0.08); }
.online-user-row:last-child { border-bottom: none; }
.online-user-primary { color: #f8fafc; font-size: 0.78rem; font-weight: 800; }
.online-user-meta { margin-top: 0.2rem; color: #cbd5e1; font-size: 0.72rem; line-height: 1.35; }

/* Online Users Table */
.online-tbl-hd {
    padding: 10px 14px; text-align: left; font-size: 0.75rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em; color: #64748b; white-space: nowrap;
}
.online-tbl-cell { padding: 10px 14px; color: #334155; white-space: nowrap; border-bottom: 1px solid #f1f5f9; }
.online-tbl tbody tr:hover { background: #f0fdf4 !important; }
.online-tbl-badge {
    display: inline-block; padding: 2px 8px; border-radius: 99px;
    font-size: 0.7rem; font-weight: 700; text-transform: capitalize;
}
.badge-active { background: #dcfce7; color: #166534; }
.badge-trial { background: #fef9c3; color: #854d0e; }
.badge-free { background: #e0f2fe; color: #0369a1; }
.badge-inactive { background: #f1f5f9; color: #64748b; }

/* Ticket counts (rendered by JS into sidebar footer area or inline) */
.ticket-counts-summary { margin-bottom: 0.75rem; }
.ticket-counts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 10px; }
.ticket-count-line {
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
    color: #e2e8f0; font-size: 0.74rem; font-weight: 700;
}
.ticket-count-line .count-value { color: var(--brand-green); font-weight: 900; font-variant-numeric: tabular-nums; }
body.helpdesk-pets .ticket-count-line .count-value { color: #e2e8f0 !important; }
.ticket-counts-divider { margin: 0.45rem 0; border-top: 1px solid rgba(255,255,255,0.1); }
.ticket-counts-empty { color: #94a3b8; font-size: 0.75rem; font-weight: 700; }

/* ================================
   8. Mobile Responsive
   ================================ */
@media (max-width: 980px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    #mobile-header { display: flex; }
    .header-back-button { display: none; }

    .app-layout {
        display: flex; flex-direction: column;
        margin-top: var(--header-h);
        height: calc(100vh - var(--header-h));
        height: calc(100dvh - var(--header-h));
    }

    #sidebar {
        position: fixed; top: 0; left: 0; height: 100%;
        width: 280px; z-index: 150;
        transform: translateX(-100%); transition: transform 0.3s ease;
    }
    #sidebar.is-open { transform: translateX(0); }
    .overlay { z-index: 140; }
    .overlay.hidden { display: none; }

    .content-area { flex: 1; overflow: hidden; }

    .content-header { padding: 0.75rem 1rem; }
    .content-scroll { padding: 1rem; }

    .filter-pills { gap: 4px; }
    .pill-btn { font-size: 0.75rem; padding: 4px 10px; }
    .pill-divider { display: none; }

    .ticket-search-row { flex-direction: column; gap: 6px; }
    .search-input { min-width: unset; width: 100%; }
    .sort-control { margin-left: 0; width: 100%; }
    .sort-control .search-select { width: 100%; }

    .ticket-item { padding: 1rem; margin-bottom: 0.5rem; }

    /* Ticket detail full-screen on mobile */
    #ticket-detail-container:not(.hidden) {
        position: fixed; top: var(--header-h); left: 0; width: 100%;
        height: calc(100vh - var(--header-h)); z-index: 30;
    }

    /* View panels full-screen */
    .view-panel:not(.hidden) { height: 100%; }

    /* Show back button when in detail/sub-view */
    #app-container.show-detail .hamburger-button { display: none; }
    #app-container.show-detail .header-back-button { display: flex; }
    #app-container.show-stats .hamburger-button { display: none; }
    #app-container.show-stats .header-back-button { display: flex; }
}

@media (max-width: 480px) {
    .filter-pills { gap: 3px; }
    .pill-btn { font-size: 0.7rem; padding: 3px 8px; }
}
