:root {
    --sidebar-width: 235px;
    --sidebar-bg: #1e293b;
    --sidebar-text: #94a3b8;
    --topbar-h: 60px;
    --main-bg: #f1f5f9;
}

* { box-sizing: border-box; }

body {
    background: var(--main-bg);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    margin: 0;
}

/* ===================== SIDEBAR ===================== */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: sticky;
    top: 0;
    overflow-y: auto;
    flex-shrink: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-mobile {
    background: var(--sidebar-bg) !important;
    width: 250px !important;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    letter-spacing: 0.02em;
}

.sidebar-nav { margin: 0; padding: 10px 10px; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: background 0.15s, color 0.15s;
    margin-bottom: 2px;
}
.sidebar-link:hover { background: rgba(255,255,255,0.07); color: #fff; }
.sidebar-link.active { background: #3b82f6; color: #fff; }
.sidebar-link i { font-size: 1rem; width: 20px; text-align: center; }

.sidebar-user {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin-top: auto;
}

.user-avatar {
    width: 34px; height: 34px;
    background: #3b82f6;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.75rem; color: #fff;
    flex-shrink: 0;
}

.user-avatar-sm {
    width: 32px; height: 32px;
    background: #64748b;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.7rem; color: #fff;
    flex-shrink: 0;
}

/* ===================== TOPBAR ===================== */
.topbar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Auto-refresh controls */
.auto-refresh-controls {
    margin-left: auto;
    margin-right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

/* ===================== MAIN ===================== */
.main-area {
    min-height: 100vh;
    overflow-x: hidden;
    transition: margin-left 0.2s ease;
}

/* Sidebar collapsed */
#app-wrapper.sidebar-collapsed .sidebar {
    width: 0 !important;
    min-width: 0 !important;
    flex: 0 0 0 !important;
    padding: 0 !important;
    overflow: hidden;
}

#app-wrapper.sidebar-collapsed .main-area {
    margin-left: 0;
}

/* ===================== STAT CARDS ===================== */
.stat-card {
    border-radius: 12px;
    padding: 20px 16px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.07);
    border: 1px solid #f0f0f0;
}
.stat-icon {
    width: 46px; height: 46px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
}
.stat-number {
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.1;
    margin: 6px 0 2px;
}
.stat-label { font-size: 0.78rem; color: #64748b; }

/* ===================== TICKET TABLE ===================== */
.ticket-table th {
    font-size: 0.73rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0 !important;
    white-space: nowrap;
    padding-top: 12px;
    padding-bottom: 12px;
}
.ticket-table td { vertical-align: middle; font-size: 0.875rem; }
.ticket-row { cursor: pointer; }
.ticket-row:hover td { background: #f8fafc; }

/* ===================== FILTER BAR ===================== */
.filter-bar {
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
}

/* ===================== COMMENT BOX ===================== */
.comment-box {
    background: #f8fafc;
    border-radius: 10px;
    padding: 14px 16px;
    border: 1px solid #e2e8f0;
}
.comment-box.internal {
    background: #fffbeb;
    border-color: #fde68a;
    border-left: 3px solid #f59e0b;
}
.comment-avatar {
    width: 30px; height: 30px;
    background: #3b82f6;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: 700; color: #fff;
    flex-shrink: 0;
}
.comment-time { font-size: 0.75rem; color: #9ca3af; }

/* ===================== LOGIN PAGE ===================== */
.login-page { background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%); }

.login-card {
    width: 400px;
    max-width: 95vw;
    border-radius: 16px !important;
    overflow: hidden;
}

.login-card .card-header {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-radius: 0 !important;
}

.login-icon {
    width: 60px; height: 60px;
    background: rgba(255,255,255,0.15);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto;
}

/* ===================== CARDS ===================== */
.card { border-radius: 12px !important; border: 1px solid #e2e8f0 !important; }
.card-header { border-radius: 12px 12px 0 0 !important; }

/* ===================== TICKET CARD MOBILE ===================== */
.ticket-card-mobile { transition: background 0.15s; }
.ticket-card-mobile:hover { background: #f8fafc; }

/* ===================== RESPONSIVE ===================== */
#app-wrapper { min-height: 100vh; }

@media (max-width: 767.98px) {
    .main-area { min-height: 100vh; }
    .stat-card { padding: 14px 10px; }
    .stat-number { font-size: 1.5rem; }
    .topbar { padding-left: 1rem !important; padding-right: 1rem !important; }
}
