* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-main: #f8f9fa;
    --bg-deep: #f0f2f5;
    --bg-card: #ffffff;
    --text-bright: #0a0e27;
    --text-normal: #1c1e26;
    --text-muted: #626666;
    --brand: #5865f2;
    --danger: #f04747;
    --success: #43b581;
    --warning: #faa61a;
    --border-color: #dcddde;
}

body {
    background-color: var(--bg-main);
    color: var(--text-normal);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
    line-height: 1.4;
}

.topbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 18px;
    color: var(--text-bright);
}

.topbar-brand svg {
    width: 32px;
    height: 32px;
    fill: var(--brand);
}

.loading-text {
    color: var(--brand);
    font-size: 13px;
    font-weight: 600;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.container {
    max-width: 1200px;
    margin: 24px auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-bright);
}

.stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.stat-badge {
    background: var(--bg-deep);
    padding: 10px 16px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
}

.stat-badge:hover {
    background: var(--bg-card);
    border-color: var(--brand);
}

.stat-badge.stat-active {
    color: var(--success);
}

.stat-badge.stat-warning {
    color: var(--warning);
}

.stat-badge.stat-danger {
    color: var(--danger);
}

.stat-label {
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-weight: 700;
    font-size: 16px;
}

.card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border-color);
}

.card h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-bright);
    margin-bottom: 16px;
}

textarea {
    width: 100%;
    height: 120px;
    background: var(--bg-deep);
    border: 1px solid var(--border-color);
    padding: 14px;
    border-radius: 6px;
    color: var(--text-bright);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    resize: vertical;
    outline: none;
    font-size: 13px;
    transition: border-color 0.2s;
}

textarea:focus {
    border-color: var(--brand);
}

textarea::placeholder {
    color: var(--text-muted);
}

.controls {
    margin-top: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.btn {
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    color: white;
    transition: all 0.2s;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.btn-icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.btn-primary {
    background: var(--brand);
}

.btn-primary:hover:not(:disabled) {
    background: #4752c4;
    box-shadow: 0 4px 12px rgba(88, 101, 242, 0.3);
}

.btn-secondary {
    background: #72767d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #5c5f66;
}

.btn-danger {
    background: var(--danger);
}

.btn-danger:hover:not(:disabled) {
    background: #d84040;
    box-shadow: 0 4px 12px rgba(240, 71, 71, 0.3);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.table-container {
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--bg-deep);
}

th {
    text-align: left;
    padding: 14px 12px;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
}

td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

tbody tr:hover {
    background: var(--bg-deep);
}

tbody tr.dead-row {
    opacity: 0.6;
}

.user-box {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--border-color);
    flex-shrink: 0;
    object-fit: cover;
}

.token-code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    background: var(--bg-deep);
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-normal);
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
    border: 1px solid var(--border-color);
}

.token-code:hover {
    background: var(--brand);
    color: white;
    border-color: var(--brand);
}

.status-label {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    display: inline-block;
}

.status-active {
    color: #2faa4c;
    background: rgba(35, 165, 89, 0.1);
}

.status-phone {
    color: #daa520;
    background: rgba(240, 178, 50, 0.1);
}

.status-dead {
    color: #cd5c5c;
    background: rgba(240, 71, 71, 0.1);
}

#toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--success);
    color: white;
    padding: 14px 32px;
    border-radius: 6px;
    display: none;
    z-index: 10000;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    font-weight: 600;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: var(--brand);
}

@media (max-width: 768px) {
    .container {
        margin: 16px auto;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
    }

    .stats {
        width: 100%;
    }

    .controls {
        flex-direction: column;
        width: 100%;
    }

    .controls > div,
    .controls button {
        width: 100%;
    }

    .btn {
        justify-content: center;
    }

    table {
        font-size: 12px;
    }

    td, th {
        padding: 10px 8px;
    }

    .user-box {
        flex-direction: column;
        align-items: flex-start;
    }
}