:root {
    --bg-color: #0F172A;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --accent: #3B82F6;
    --accent-hover: #2563EB;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

#app {
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
}

.view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

h1 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.marzban-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 12px;
    border-radius: 20px;
}

.indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #64748b;
}

.indicator.online { background: var(--success); box-shadow: 0 0 10px var(--success); }
.indicator.offline { background: var(--danger); box-shadow: 0 0 10px var(--danger); }

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    backdrop-filter: blur(10px);
    transition: transform 0.2s;
}

.stat-card:active {
    transform: scale(0.98);
}

.stat-card.full-width {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: rgba(255,255,255,0.05);
}

.stat-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-main);
}

button {
    border: none;
    outline: none;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
}

.primary-btn {
    width: 100%;
    padding: 16px;
    background: var(--accent);
    color: white;
    border-radius: 12px;
    font-size: 16px;
    transition: background 0.2s;
}

.primary-btn:active {
    background: var(--accent-hover);
}

.back-btn {
    background: rgba(255,255,255,0.1);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-right: 16px;
}

.search-bar {
    margin-bottom: 20px;
}

.search-bar input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    background: var(--card-bg);
    color: white;
    font-size: 15px;
    outline: none;
}

.search-bar input:focus {
    border-color: var(--accent);
}

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

.user-card {
    background: var(--card-bg);
    border: 1px solid rgba(255,255,255,0.05);
    padding: 16px;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-id {
    font-size: 15px;
    font-weight: 600;
}

.user-sub {
    font-size: 13px;
    color: var(--text-muted);
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.active { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.status-badge.none { background: rgba(148, 163, 184, 0.2); color: var(--text-muted); }
.status-badge.expired { background: rgba(239, 68, 68, 0.2); color: var(--danger); }

.grant-btn {
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent);
    font-size: 13px;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.delete-btn {
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    font-size: 13px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    cursor: pointer;
    font-weight: 600;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-color);
    border: 1px solid rgba(255,255,255,0.1);
    width: 100%;
    max-width: 400px;
    border-radius: 24px;
    padding: 24px;
}

.modal-content h3 {
    margin-bottom: 8px;
}

.modal-content p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 20px;
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-muted);
}

.input-group input {
    width: 100%;
    background: var(--card-bg);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    padding: 12px;
    border-radius: 12px;
    font-size: 16px;
    outline: none;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.secondary-btn {
    flex: 1;
    padding: 14px;
    background: rgba(255,255,255,0.1);
    color: white;
    border-radius: 12px;
    font-size: 15px;
}

.modal-actions .primary-btn {
    flex: 1;
}
