* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.login-box h1 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 24px;
    text-align: center;
}

.login-box h2 {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 18px;
    font-weight: 500;
    text-align: center;
}

/* Dashboard */
.header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 24px;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.username {
    color: var(--text-secondary);
    font-weight: 500;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px;
}

/* Filters */
.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 20px;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Stats */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary-color);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 10px;
    font-weight: 500;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
}

/* Requests List */
.requests-list {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.request-item {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    display: grid;
    grid-template-columns: 1fr 150px 150px 120px 120px;
    gap: 20px;
    align-items: center;
    transition: background 0.2s;
    cursor: pointer;
}

.request-item:hover {
    background: var(--bg-color);
}

.request-item:last-child {
    border-bottom: none;
}

.request-info h3 {
    font-size: 16px;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.request-info p {
    font-size: 14px;
    color: var(--text-secondary);
}

.request-meta {
    font-size: 13px;
    color: var(--text-secondary);
}

.request-type {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.request-type.add {
    background: #dbeafe;
    color: #1e40af;
}

.request-type.delete {
    background: #fee2e2;
    color: #991b1b;
}

.request-type.change {
    background: #fef3c7;
    color: #92400e;
}

.vm-info {
    font-size: 13px;
}

.vm-name {
    font-weight: 600;
    color: var(--text-primary);
}

.vm-type {
    color: var(--text-secondary);
}

.status-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.status-badge.pending {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.awaiting_info {
    background: #dbeafe;
    color: #1e40af;
}

.status-badge.completed {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.spam {
    background: #fee2e2;
    color: #991b1b;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-block {
    width: 100%;
    display: block;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 25px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 20px;
}

.close-modal {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
}

.close-modal:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
}

.detail-section {
    margin-bottom: 30px;
}

.detail-section h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.detail-row {
    display: grid;
    grid-template-columns: 150px 1fr;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.detail-value {
    color: var(--text-primary);
}

.email-body {
    background: var(--bg-color);
    padding: 15px;
    border-radius: 8px;
    white-space: pre-wrap;
    font-size: 14px;
    line-height: 1.6;
}

.thread-item {
    padding: 15px;
    border-left: 3px solid var(--border-color);
    margin-bottom: 15px;
    background: var(--bg-color);
    border-radius: 8px;
}

.thread-item.outbound {
    border-left-color: var(--primary-color);
    background: #eff6ff;
}

.thread-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 13px;
}

.thread-direction {
    font-weight: 600;
    color: var(--primary-color);
}

.thread-date {
    color: var(--text-secondary);
}

.thread-body {
    font-size: 14px;
    white-space: pre-wrap;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state h3 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 768px) {
    .request-item {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .header-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .stats {
        grid-template-columns: 1fr 1fr;
    }

    .detail-row {
        grid-template-columns: 1fr;
        gap: 5px;
    }
}