* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --dark-bg: #1e293b;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 0 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
}

.pin-login-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #ffffff;
    height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.pin-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
    max-width: 450px;
    width: 100%;
    text-align: center;
}

.pin-header {
    margin-bottom: 30px;
}

.pin-header h1 {
    font-size: 28px;
    color: #2d3748;
    margin-bottom: 10px;
}

.pin-header p {
    color: #718096;
    font-size: 0.95rem;
}

.pin-outer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 20px;
}

.pin-inputs {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 30px 0;
}

.pin-input {
    width: 55px;
    height: 65px;
    text-align: center;
    font-size: 28px;
    font-weight: 600;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #f7fafc;
    color: #2d3748;
    transition: all 0.3s ease;
    outline: none;
}

.pin-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: scale(1.05);
    background: white;
}

.pin-input:disabled {
    background: #f1f5f9;
    cursor: not-allowed;
    opacity: 0.5;
}

.pin-input::placeholder {
    color: transparent;
}

.pin-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 480px) {
    .pin-login-body {
        padding: 15px;
    }
    
    .pin-outer-container {
        padding: 0;
    }
    
    .pin-inputs {
        gap: 8px;
    }
    
    .pin-input {
        width: 45px;
        height: 55px;
        font-size: 24px;
    }
    
    .pin-container {
        padding: 25px 20px;
    }
    
    .pin-header {
        margin-bottom: 20px;
    }
    
    .pin-header h1 {
        font-size: 24px;
    }
    
    .pin-header p {
        font-size: 0.85rem;
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.header {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-lg);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn {
    padding: 13px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #5b21b6 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #cbd5e1;
}

.btn:disabled,
.btn[disabled] {
    cursor: not-allowed;
    opacity: 0.8;
    box-shadow: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.stats-section {
    margin-bottom: 24px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
}

.stat-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
}

.stat-icon.blue {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-icon.green {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.stat-icon.orange {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.stat-icon.purple {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.stat-content h3 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-content p {
    font-size: 14px;
    color: var(--text-secondary);
}

.main-content {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.sidebar {
    width: 250px;
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 20px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    padding: 14px 16px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-item:hover {
    background: #f1f5f9;
    color: var(--primary-color);
}

.nav-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.nav-item i {
    font-size: 18px;
    width: 20px;
}

.sidebar-stats {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-secondary);
}

.sidebar-stat-label {
    font-weight: 500;
}

.sidebar-stat-value {
    font-weight: 700;
    color: var(--primary-color);
}

.content-area {
    flex: 1;
    background: var(--card-bg);
    border-radius: 16px;
    padding: 32px;
    box-shadow: var(--shadow-lg);
    box-sizing: border-box;
    max-width: 100%;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.content-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.content-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.search-input {
    padding: 10px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-input {
    min-width: 250px;
}

.table-container {
    overflow-x: auto;
    padding: 10px 0;
    border-radius: 12px;
    border: none;
    max-width: 100%;
    box-sizing: border-box;
}

.data-table {
    padding-top: 15px;
    border-collapse: collapse;
    background: white;
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
}

.data-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.data-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

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

.loading {
    text-align: center;
    padding: 40px !important;
    color: var(--text-secondary);
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e5e7eb;
    transition: 0.2s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: 0.2s;
}

.switch input:checked + .slider {
    background: linear-gradient(135deg, #34d399 0%, #059669 100%);
}

.switch input:checked + .slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 999px;
}

.slider.round:before {
    border-radius: 999px;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
}

#pageInfo {
    font-weight: 600;
    color: var(--text-secondary);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: rgba(255, 255, 255, 0.92);
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    left: 0;
    background: rgba(255, 255, 255, 0.96);
    z-index: 5;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s ease;
}

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

.modal-body {
    padding: 24px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.modal-detail-row {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.modal-detail-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.modal-detail-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.modal-detail-value {
    font-size: 14px;
    color: var(--text-primary);
    word-break: break-word;
}

.stats-detail-card {
    background: #f8fafc;
    border-radius: 12px;
    padding: 24px;
}

.stats-detail-card h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.top-apps-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.top-app-item {
    background: white;
    padding: 16px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

.top-app-info {
    flex: 1;
}

.top-app-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.top-app-package {
    font-size: 12px;
    color: var(--text-secondary);
}

.top-app-count {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
}

@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        position: static;
    }
    
    .nav-menu {
        flex-direction: row;
        overflow-x: auto;
    }
    
    .nav-item {
        white-space: nowrap;
    }
}

@media (max-width: 768px) {
    body {
        padding: 12px;
    }
    
    .header h1 {
        font-size: 22px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .content-area {
        padding: 20px;
    }
    
    .data-table {
        font-size: 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 12px 8px;
    }
    
    .content-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .search-input {
        min-width: 100%;
    }
}

@media (max-width: 480px) {
    .header-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .header h1 {
        text-align: center;
        width: 100%;
        justify-content: center;
    }
    
    .header-actions {
        width: 100%;
        justify-content: center;
        gap: 12px;
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
    }
    
    .table-container {
        font-size: 11px;
    }
}

::-webkit-scrollbar {
    width: 8px;
    height: 3px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}