Spaces:
Paused

dushyantsingh0 commited on
Commit
d37c163
·
1 Parent(s): 8798ebe

backend stabilization

Browse files
api/v1/dashboard.py CHANGED
@@ -73,17 +73,24 @@ async def get_dashboard_hydration(
73
  async with async_session_factory() as e_db:
74
  try:
75
  from api.v1.escalations import list_escalation_rules, list_active_breaches, view_escalation_audit
 
76
  from uuid import UUID
77
  ws_id = UUID(workspace_id) if workspace_id and workspace_id != "all" else None
78
 
79
  rules = await list_escalation_rules(ws_id, current_user, e_db)
80
  breaches = await list_active_breaches(current_user, e_db)
81
  audit = await view_escalation_audit(0, 100, current_user, e_db)
82
- return {"rules": rules, "breaches": breaches, "audit": audit}
 
 
 
 
 
83
  except Exception as e:
84
  logger.error(f"Hydration Escalations Error: {e}")
85
  return {"rules": [], "breaches": [], "audit": []}
86
 
 
87
  # return_exceptions=False (default) is fine here because we catch them inside the helpers
88
  stats, reports, queue, escalations = await asyncio.gather(
89
  run_stats(),
 
73
  async with async_session_factory() as e_db:
74
  try:
75
  from api.v1.escalations import list_escalation_rules, list_active_breaches, view_escalation_audit
76
+ from schemas.escalation import EscalationRuleResponse, AuditLogResponse
77
  from uuid import UUID
78
  ws_id = UUID(workspace_id) if workspace_id and workspace_id != "all" else None
79
 
80
  rules = await list_escalation_rules(ws_id, current_user, e_db)
81
  breaches = await list_active_breaches(current_user, e_db)
82
  audit = await view_escalation_audit(0, 100, current_user, e_db)
83
+
84
+ return {
85
+ "rules": [EscalationRuleResponse.model_validate(r).model_dump() for r in rules],
86
+ "breaches": breaches,
87
+ "audit": [AuditLogResponse.model_validate(a).model_dump() for a in audit]
88
+ }
89
  except Exception as e:
90
  logger.error(f"Hydration Escalations Error: {e}")
91
  return {"rules": [], "breaches": [], "audit": []}
92
 
93
+
94
  # return_exceptions=False (default) is fine here because we catch them inside the helpers
95
  stats, reports, queue, escalations = await asyncio.gather(
96
  run_stats(),
frontend/apps/internal/src/components/UserSettingsModal.tsx CHANGED
@@ -1,8 +1,11 @@
1
  import React, { useState } from 'react';
2
  import { api } from '@nexus/shared';
 
 
3
 
4
  const COLORS = {
5
  brand: "#7C3AED",
 
6
  bg: "#0A0C10",
7
  card: "#161B22",
8
  border: "rgba(255,255,255,0.08)",
@@ -43,9 +46,9 @@ export const UserSettingsModal: React.FC<UserSettingsModalProps> = ({ user, onCl
43
  try {
44
  const resp = await api.patch('users/me/', profileForm);
45
  onUpdate(resp.data);
46
- setMessage({ type: 'success', text: 'Profile updated successfully!' });
47
  } catch (err) {
48
- setMessage({ type: 'error', text: 'Failed to update profile.' });
49
  } finally {
50
  setLoading(false);
51
  }
@@ -54,7 +57,7 @@ export const UserSettingsModal: React.FC<UserSettingsModalProps> = ({ user, onCl
54
  const handlePasswordUpdate = async (e: React.FormEvent) => {
55
  e.preventDefault();
56
  if (securityForm.new_password !== securityForm.confirm_password) {
57
- setMessage({ type: 'error', text: 'Passwords do not match.' });
58
  return;
59
  }
60
  setLoading(true);
@@ -64,10 +67,10 @@ export const UserSettingsModal: React.FC<UserSettingsModalProps> = ({ user, onCl
64
  old_password: securityForm.old_password,
65
  new_password: securityForm.new_password
66
  });
67
- setMessage({ type: 'success', text: 'Password changed successfully!' });
68
  setSecurityForm({ old_password: '', new_password: '', confirm_password: '' });
69
  } catch (err) {
70
- setMessage({ type: 'error', text: 'Incorrect current password or update failed.' });
71
  } finally {
72
  setLoading(false);
73
  }
@@ -76,185 +79,269 @@ export const UserSettingsModal: React.FC<UserSettingsModalProps> = ({ user, onCl
76
  return (
77
  <div style={{
78
  position: 'fixed',
79
- top: 0,
80
- left: 0,
81
- right: 0,
82
- bottom: 0,
83
- background: 'rgba(0,0,0,0.7)',
84
- backdropFilter: 'blur(8px)',
85
  display: 'flex',
86
  alignItems: 'center',
87
  justifyContent: 'center',
88
- zIndex: 3000,
89
- animation: 'nexus-fade-in 0.2s ease-out'
90
  }}>
91
- <style>
92
- {` @keyframes nexus-fade-in { from { opacity: 0; } to { opacity: 1; } }
93
- @keyframes nexus-pop-in { from { transform: scale(0.98) translateY(10px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
94
- `}
95
- </style>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
 
97
- <div style={{
98
- width: 480,
99
- background: COLORS.card,
100
- borderRadius: 16,
101
- border: `1px solid ${COLORS.border}`,
102
- boxShadow: '0 24px 48px rgba(0,0,0,0.5)',
103
- overflow: 'hidden',
104
- animation: 'nexus-pop-in 0.3s cubic-bezier(0.16, 1, 0.3, 1)'
105
- }}>
106
- <div style={{ padding: '24px', borderBottom: `1px solid ${COLORS.border}`, display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
107
- <div>
108
- <h2 style={{ fontSize: 18, fontWeight: 700, color: COLORS.text, margin: 0 }}>Command Settings</h2>
109
- <p style={{ fontSize: 12, color: COLORS.subtext, margin: '4px 0 0 0' }}>Manage your operational identity and security.</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  </div>
111
- <button
112
- onClick={onClose}
113
- style={{
114
- background: 'rgba(255,255,255,0.05)',
115
- border: 'none',
116
- width: 32,
117
- height: 32,
118
- borderRadius: 8,
119
- display: 'flex',
120
- alignItems: 'center',
121
- justifyContent: 'center',
122
- cursor: 'pointer',
123
- color: COLORS.subtext
124
- }}
125
- >
126
- ×
127
- </button>
128
  </div>
129
 
130
- <div style={{ display: 'flex', background: 'rgba(0,0,0,0.2)', padding: '4px' }}>
131
- <button
132
- onClick={() => { setTab('profile'); setMessage(null); }}
133
- style={{
134
- flex: 1, padding: '10px', border: 'none', background: tab === 'profile' ? 'rgba(255,255,255,0.05)' : 'none',
135
- cursor: 'pointer', borderRadius: 8, transition: '0.2s',
136
- fontSize: 13, fontWeight: 600, color: tab === 'profile' ? COLORS.text : COLORS.subtext,
137
- }}
138
- >
139
- Operational Profile
140
- </button>
141
- <button
142
- onClick={() => { setTab('security'); setMessage(null); }}
143
- style={{
144
- flex: 1, padding: '10px', border: 'none', background: tab === 'security' ? 'rgba(255,255,255,0.05)' : 'none',
145
- cursor: 'pointer', borderRadius: 8, transition: '0.2s',
146
- fontSize: 13, fontWeight: 600, color: tab === 'security' ? COLORS.text : COLORS.subtext,
147
- }}
148
- >
149
- Access Security
150
- </button>
 
 
 
 
 
 
 
 
 
 
 
 
151
  </div>
152
 
153
- <div style={{ padding: '32px' }}>
154
- {message && (
155
- <div style={{
156
- padding: '12px 16px', borderRadius: 8, marginBottom: 20, fontSize: 13, fontWeight: 500,
157
- background: message.type === 'success' ? 'rgba(63, 185, 80, 0.1)' : 'rgba(248, 81, 73, 0.1)',
158
- color: message.type === 'success' ? COLORS.success : COLORS.error,
159
- border: `1px solid ${message.type === 'success' ? 'rgba(63, 185, 80, 0.2)' : 'rgba(248, 81, 73, 0.2)'}`
160
- }}>
161
- {message.text}
162
- </div>
163
- )}
 
 
 
 
 
 
 
 
 
164
 
165
  {tab === 'profile' ? (
166
- <form onSubmit={handleProfileUpdate}>
167
- <div style={{ marginBottom: 20 }}>
168
- <label style={{ display: 'block', fontSize: 11, fontWeight: 600, color: COLORS.subtext, marginBottom: 8, textTransform: 'uppercase', letterSpacing: '0.05em' }}>Full Operational Name</label>
 
 
 
 
 
 
 
 
169
  <input
170
  value={profileForm.full_name}
171
  onChange={e => setProfileForm({...profileForm, full_name: e.target.value})}
 
172
  style={{
173
- width: '100%', padding: '12px', borderRadius: 8,
174
- background: '#0D1117', border: `1px solid ${COLORS.border}`,
175
- color: COLORS.text, fontSize: 14, outline: 'none'
 
176
  }}
 
 
177
  />
178
  </div>
179
- <div style={{ marginBottom: 32 }}>
180
- <label style={{ display: 'block', fontSize: 11, fontWeight: 600, color: COLORS.subtext, marginBottom: 8, textTransform: 'uppercase', letterSpacing: '0.05em' }}>Avatar Manifest URL</label>
 
 
181
  <input
182
  value={profileForm.avatar_url}
183
  onChange={e => setProfileForm({...profileForm, avatar_url: e.target.value})}
184
  placeholder="https://nexus.ai/assets/avatar.png"
185
  style={{
186
- width: '100%', padding: '12px', borderRadius: 8,
187
- background: '#0D1117', border: `1px solid ${COLORS.border}`,
188
- color: COLORS.text, fontSize: 14, outline: 'none'
 
189
  }}
 
 
190
  />
191
  </div>
192
- <button
 
 
193
  disabled={loading}
194
  style={{
195
- width: '100%', padding: '14px', background: COLORS.brand, color: '#fff',
196
- border: 'none', borderRadius: 8, fontWeight: 600, cursor: 'pointer',
197
- opacity: loading ? 0.7 : 1, transition: '0.2s', boxShadow: '0 4px 12px rgba(124, 58, 237, 0.3)'
 
 
198
  }}
199
  >
200
- {loading ? 'Processing Sync...' : 'Commit Profile Changes'}
201
- </button>
202
- </form>
 
203
  ) : (
204
- <form onSubmit={handlePasswordUpdate}>
205
- <div style={{ marginBottom: 16 }}>
206
- <label style={{ display: 'block', fontSize: 11, fontWeight: 600, color: COLORS.subtext, marginBottom: 8, textTransform: 'uppercase', letterSpacing: '0.05em' }}>Current Credentials</label>
 
 
 
 
 
 
 
 
207
  <input
208
  type="password"
209
  value={securityForm.old_password}
210
  onChange={e => setSecurityForm({...securityForm, old_password: e.target.value})}
211
  style={{
212
- width: '100%', padding: '12px', borderRadius: 8,
213
- background: '#0D1117', border: `1px solid ${COLORS.border}`,
214
- color: COLORS.text, fontSize: 14, outline: 'none'
215
  }}
 
 
216
  />
217
  </div>
218
- <div style={{ marginBottom: 16 }}>
219
- <label style={{ display: 'block', fontSize: 11, fontWeight: 600, color: COLORS.subtext, marginBottom: 8, textTransform: 'uppercase', letterSpacing: '0.05em' }}>New Access Key</label>
 
 
220
  <input
221
  type="password"
222
  value={securityForm.new_password}
223
  onChange={e => setSecurityForm({...securityForm, new_password: e.target.value})}
224
  style={{
225
- width: '100%', padding: '12px', borderRadius: 8,
226
- background: '#0D1117', border: `1px solid ${COLORS.border}`,
227
- color: COLORS.text, fontSize: 14, outline: 'none'
228
  }}
 
 
229
  />
230
  </div>
231
- <div style={{ marginBottom: 32 }}>
232
- <label style={{ display: 'block', fontSize: 11, fontWeight: 600, color: COLORS.subtext, marginBottom: 8, textTransform: 'uppercase', letterSpacing: '0.05em' }}>Re-verify Access Key</label>
 
 
233
  <input
234
  type="password"
235
  value={securityForm.confirm_password}
236
  onChange={e => setSecurityForm({...securityForm, confirm_password: e.target.value})}
237
  style={{
238
- width: '100%', padding: '12px', borderRadius: 8,
239
- background: '#0D1117', border: `1px solid ${COLORS.border}`,
240
- color: COLORS.text, fontSize: 14, outline: 'none'
241
  }}
 
 
242
  />
243
  </div>
244
- <button
 
 
245
  disabled={loading}
246
  style={{
247
- width: '100%', padding: '14px', background: COLORS.brand, color: '#fff',
248
- border: 'none', borderRadius: 8, fontWeight: 600, cursor: 'pointer',
249
- opacity: loading ? 0.7 : 1, transition: '0.2s', boxShadow: '0 4px 12px rgba(124, 58, 237, 0.3)'
 
 
250
  }}
251
  >
252
- {loading ? 'Encrypting Access...' : 'Rotate Credentials'}
253
- </button>
254
- </form>
 
255
  )}
256
  </div>
257
- </div>
 
 
 
 
258
  </div>
259
  );
260
  };
 
1
  import React, { useState } from 'react';
2
  import { api } from '@nexus/shared';
3
+ import { X, User, Shield, Key, Camera, Check, AlertCircle, Loader2 } from 'lucide-react';
4
+ import { motion, AnimatePresence } from 'framer-motion';
5
 
6
  const COLORS = {
7
  brand: "#7C3AED",
8
+ brandLight: "#A78BFA",
9
  bg: "#0A0C10",
10
  card: "#161B22",
11
  border: "rgba(255,255,255,0.08)",
 
46
  try {
47
  const resp = await api.patch('users/me/', profileForm);
48
  onUpdate(resp.data);
49
+ setMessage({ type: 'success', text: 'Operational identity synchronized.' });
50
  } catch (err) {
51
+ setMessage({ type: 'error', text: 'Failed to synchronize identity. Check network.' });
52
  } finally {
53
  setLoading(false);
54
  }
 
57
  const handlePasswordUpdate = async (e: React.FormEvent) => {
58
  e.preventDefault();
59
  if (securityForm.new_password !== securityForm.confirm_password) {
60
+ setMessage({ type: 'error', text: 'Credential verification mismatch.' });
61
  return;
62
  }
63
  setLoading(true);
 
67
  old_password: securityForm.old_password,
68
  new_password: securityForm.new_password
69
  });
70
+ setMessage({ type: 'success', text: 'Access keys rotated successfully.' });
71
  setSecurityForm({ old_password: '', new_password: '', confirm_password: '' });
72
  } catch (err) {
73
+ setMessage({ type: 'error', text: 'Invalid current credentials or rotation failure.' });
74
  } finally {
75
  setLoading(false);
76
  }
 
79
  return (
80
  <div style={{
81
  position: 'fixed',
82
+ top: 0, left: 0, right: 0, bottom: 0,
83
+ background: 'rgba(5, 5, 5, 0.6)',
84
+ backdropFilter: 'blur(20px) saturate(180%)',
 
 
 
85
  display: 'flex',
86
  alignItems: 'center',
87
  justifyContent: 'center',
88
+ zIndex: 4000,
 
89
  }}>
90
+ <motion.div
91
+ initial={{ opacity: 0, scale: 0.95, y: 20 }}
92
+ animate={{ opacity: 1, scale: 1, y: 0 }}
93
+ exit={{ opacity: 0, scale: 0.95, y: 20 }}
94
+ transition={{ type: 'spring', damping: 30, stiffness: 300 }}
95
+ style={{
96
+ width: 520,
97
+ background: 'rgba(22, 27, 34, 0.95)',
98
+ borderRadius: 32,
99
+ border: `1px solid ${COLORS.border}`,
100
+ boxShadow: '0 40px 100px rgba(0,0,0,0.6), inset 0 0 0 1px rgba(255,255,255,0.05)',
101
+ overflow: 'hidden',
102
+ display: 'flex',
103
+ flexDirection: 'column',
104
+ position: 'relative'
105
+ }}
106
+ >
107
+ {/* Glow Effect */}
108
+ <div style={{
109
+ position: 'absolute',
110
+ top: -100,
111
+ right: -100,
112
+ width: 250,
113
+ height: 250,
114
+ background: 'radial-gradient(circle, rgba(124, 58, 237, 0.15) 0%, transparent 70%)',
115
+ pointerEvents: 'none'
116
+ }} />
117
 
118
+ {/* Header */}
119
+ <div style={{ padding: '40px 40px 24px', position: 'relative' }}>
120
+ <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start' }}>
121
+ <div>
122
+ <div style={{
123
+ fontSize: 10, fontWeight: 950, color: COLORS.brandLight,
124
+ letterSpacing: '0.2em', marginBottom: 12, display: 'flex', alignItems: 'center', gap: 8
125
+ }}>
126
+ <Shield size={12} /> IDENTITY CONFIGURATION
127
+ </div>
128
+ <h2 style={{ fontSize: 28, fontWeight: 900, color: COLORS.text, margin: 0, letterSpacing: '-0.02em' }}>Command Settings</h2>
129
+ <p style={{ fontSize: 14, color: COLORS.subtext, margin: '8px 0 0 0', fontWeight: 500 }}>Manage your operational profile and security protocols.</p>
130
+ </div>
131
+ <button
132
+ onClick={onClose}
133
+ style={{
134
+ background: 'rgba(255,255,255,0.05)', border: 'none',
135
+ width: 36, height: 36, borderRadius: 12, display: 'flex',
136
+ alignItems: 'center', justifyContent: 'center', cursor: 'pointer',
137
+ color: COLORS.subtext, transition: '0.2s'
138
+ }}
139
+ onMouseEnter={(e) => (e.currentTarget.style.background = 'rgba(255,255,255,0.1)')}
140
+ onMouseLeave={(e) => (e.currentTarget.style.background = 'rgba(255,255,255,0.05)')}
141
+ >
142
+ <X size={20} />
143
+ </button>
144
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
  </div>
146
 
147
+ {/* Tabs */}
148
+ <div style={{ padding: '0 40px', marginBottom: 32 }}>
149
+ <div style={{
150
+ display: 'flex', background: 'rgba(0,0,0,0.2)', padding: '6px',
151
+ borderRadius: 16, border: `1px solid ${COLORS.border}`
152
+ }}>
153
+ <button
154
+ onClick={() => { setTab('profile'); setMessage(null); }}
155
+ style={{
156
+ flex: 1, padding: '12px', border: 'none',
157
+ background: tab === 'profile' ? 'rgba(255,255,255,0.08)' : 'transparent',
158
+ cursor: 'pointer', borderRadius: 12, transition: '0.3s cubic-bezier(0.16, 1, 0.3, 1)',
159
+ fontSize: 13, fontWeight: 700, color: tab === 'profile' ? COLORS.text : COLORS.subtext,
160
+ display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 10,
161
+ boxShadow: tab === 'profile' ? '0 4px 12px rgba(0,0,0,0.2)' : 'none'
162
+ }}
163
+ >
164
+ <User size={14} /> Operational Profile
165
+ </button>
166
+ <button
167
+ onClick={() => { setTab('security'); setMessage(null); }}
168
+ style={{
169
+ flex: 1, padding: '12px', border: 'none',
170
+ background: tab === 'security' ? 'rgba(255,255,255,0.08)' : 'transparent',
171
+ cursor: 'pointer', borderRadius: 12, transition: '0.3s cubic-bezier(0.16, 1, 0.3, 1)',
172
+ fontSize: 13, fontWeight: 700, color: tab === 'security' ? COLORS.text : COLORS.subtext,
173
+ display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 10,
174
+ boxShadow: tab === 'security' ? '0 4px 12px rgba(0,0,0,0.2)' : 'none'
175
+ }}
176
+ >
177
+ <Key size={14} /> Access Security
178
+ </button>
179
+ </div>
180
  </div>
181
 
182
+ <div style={{ padding: '0 40px 48px' }}>
183
+ <AnimatePresence mode="wait">
184
+ {message && (
185
+ <motion.div
186
+ initial={{ opacity: 0, height: 0, marginBottom: 0 }}
187
+ animate={{ opacity: 1, height: 'auto', marginBottom: 24 }}
188
+ exit={{ opacity: 0, height: 0, marginBottom: 0 }}
189
+ style={{
190
+ padding: '14px 18px', borderRadius: 16, fontSize: 13, fontWeight: 600,
191
+ background: message.type === 'success' ? 'rgba(63, 185, 80, 0.08)' : 'rgba(248, 81, 73, 0.08)',
192
+ color: message.type === 'success' ? COLORS.success : COLORS.error,
193
+ border: `1px solid ${message.type === 'success' ? 'rgba(63, 185, 80, 0.2)' : 'rgba(248, 81, 73, 0.2)'}`,
194
+ display: 'flex', alignItems: 'center', gap: 10
195
+ }}
196
+ >
197
+ {message.type === 'success' ? <Check size={16} /> : <AlertCircle size={16} />}
198
+ {message.text}
199
+ </motion.div>
200
+ )}
201
+ </AnimatePresence>
202
 
203
  {tab === 'profile' ? (
204
+ <motion.form
205
+ key="profile"
206
+ initial={{ opacity: 0, x: -10 }}
207
+ animate={{ opacity: 1, x: 0 }}
208
+ exit={{ opacity: 0, x: 10 }}
209
+ onSubmit={handleProfileUpdate}
210
+ >
211
+ <div style={{ marginBottom: 24 }}>
212
+ <label style={{ display: 'flex', alignItems: 'center', gap: 8, fontSize: 11, fontWeight: 800, color: COLORS.subtext, marginBottom: 12, textTransform: 'uppercase', letterSpacing: '0.1em' }}>
213
+ <User size={12} /> Full Operational Name
214
+ </label>
215
  <input
216
  value={profileForm.full_name}
217
  onChange={e => setProfileForm({...profileForm, full_name: e.target.value})}
218
+ placeholder="e.g. Lead Agent Smith"
219
  style={{
220
+ width: '100%', padding: '16px 20px', borderRadius: 16,
221
+ background: 'rgba(13, 17, 23, 0.6)', border: `1px solid ${COLORS.border}`,
222
+ color: COLORS.text, fontSize: 15, outline: 'none', transition: '0.2s',
223
+ fontWeight: 600
224
  }}
225
+ onFocus={(e) => (e.target.style.borderColor = COLORS.brand)}
226
+ onBlur={(e) => (e.target.style.borderColor = COLORS.border)}
227
  />
228
  </div>
229
+ <div style={{ marginBottom: 40 }}>
230
+ <label style={{ display: 'flex', alignItems: 'center', gap: 8, fontSize: 11, fontWeight: 800, color: COLORS.subtext, marginBottom: 12, textTransform: 'uppercase', letterSpacing: '0.1em' }}>
231
+ <Camera size={12} /> Avatar Manifest URL
232
+ </label>
233
  <input
234
  value={profileForm.avatar_url}
235
  onChange={e => setProfileForm({...profileForm, avatar_url: e.target.value})}
236
  placeholder="https://nexus.ai/assets/avatar.png"
237
  style={{
238
+ width: '100%', padding: '16px 20px', borderRadius: 16,
239
+ background: 'rgba(13, 17, 23, 0.6)', border: `1px solid ${COLORS.border}`,
240
+ color: COLORS.text, fontSize: 15, outline: 'none', transition: '0.2s',
241
+ fontWeight: 500, fontFamily: 'var(--font-mono, monospace)'
242
  }}
243
+ onFocus={(e) => (e.target.style.borderColor = COLORS.brand)}
244
+ onBlur={(e) => (e.target.style.borderColor = COLORS.border)}
245
  />
246
  </div>
247
+ <motion.button
248
+ whileHover={{ scale: 1.01, translateY: -2 }}
249
+ whileTap={{ scale: 0.99 }}
250
  disabled={loading}
251
  style={{
252
+ width: '100%', padding: '18px', background: COLORS.brand, color: '#fff',
253
+ border: 'none', borderRadius: 18, fontWeight: 800, cursor: 'pointer',
254
+ opacity: loading ? 0.7 : 1, transition: '0.3s cubic-bezier(0.16, 1, 0.3, 1)',
255
+ boxShadow: `0 20px 40px ${COLORS.brand}40`,
256
+ fontSize: 15, display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 10
257
  }}
258
  >
259
+ {loading ? <Loader2 size={18} className="nexus-spin" /> : <Check size={18} />}
260
+ {loading ? 'Synchronizing Intelligence...' : 'Commit Operational Changes'}
261
+ </motion.button>
262
+ </motion.form>
263
  ) : (
264
+ <motion.form
265
+ key="security"
266
+ initial={{ opacity: 0, x: -10 }}
267
+ animate={{ opacity: 1, x: 0 }}
268
+ exit={{ opacity: 0, x: 10 }}
269
+ onSubmit={handlePasswordUpdate}
270
+ >
271
+ <div style={{ marginBottom: 20 }}>
272
+ <label style={{ display: 'flex', alignItems: 'center', gap: 8, fontSize: 11, fontWeight: 800, color: COLORS.subtext, marginBottom: 12, textTransform: 'uppercase', letterSpacing: '0.1em' }}>
273
+ <Key size={12} /> Current Access Credentials
274
+ </label>
275
  <input
276
  type="password"
277
  value={securityForm.old_password}
278
  onChange={e => setSecurityForm({...securityForm, old_password: e.target.value})}
279
  style={{
280
+ width: '100%', padding: '16px 20px', borderRadius: 16,
281
+ background: 'rgba(13, 17, 23, 0.6)', border: `1px solid ${COLORS.border}`,
282
+ color: COLORS.text, fontSize: 15, outline: 'none', fontWeight: 600
283
  }}
284
+ onFocus={(e) => (e.target.style.borderColor = COLORS.brand)}
285
+ onBlur={(e) => (e.target.style.borderColor = COLORS.border)}
286
  />
287
  </div>
288
+ <div style={{ marginBottom: 20 }}>
289
+ <label style={{ display: 'flex', alignItems: 'center', gap: 8, fontSize: 11, fontWeight: 800, color: COLORS.subtext, marginBottom: 12, textTransform: 'uppercase', letterSpacing: '0.1em' }}>
290
+ <Shield size={12} /> New Primary Key
291
+ </label>
292
  <input
293
  type="password"
294
  value={securityForm.new_password}
295
  onChange={e => setSecurityForm({...securityForm, new_password: e.target.value})}
296
  style={{
297
+ width: '100%', padding: '16px 20px', borderRadius: 16,
298
+ background: 'rgba(13, 17, 23, 0.6)', border: `1px solid ${COLORS.border}`,
299
+ color: COLORS.text, fontSize: 15, outline: 'none', fontWeight: 600
300
  }}
301
+ onFocus={(e) => (e.target.style.borderColor = COLORS.brand)}
302
+ onBlur={(e) => (e.target.style.borderColor = COLORS.border)}
303
  />
304
  </div>
305
+ <div style={{ marginBottom: 40 }}>
306
+ <label style={{ display: 'flex', alignItems: 'center', gap: 8, fontSize: 11, fontWeight: 800, color: COLORS.subtext, marginBottom: 12, textTransform: 'uppercase', letterSpacing: '0.1em' }}>
307
+ Re-verify Access Key
308
+ </label>
309
  <input
310
  type="password"
311
  value={securityForm.confirm_password}
312
  onChange={e => setSecurityForm({...securityForm, confirm_password: e.target.value})}
313
  style={{
314
+ width: '100%', padding: '16px 20px', borderRadius: 16,
315
+ background: 'rgba(13, 17, 23, 0.6)', border: `1px solid ${COLORS.border}`,
316
+ color: COLORS.text, fontSize: 15, outline: 'none', fontWeight: 600
317
  }}
318
+ onFocus={(e) => (e.target.style.borderColor = COLORS.brand)}
319
+ onBlur={(e) => (e.target.style.borderColor = COLORS.border)}
320
  />
321
  </div>
322
+ <motion.button
323
+ whileHover={{ scale: 1.01, translateY: -2 }}
324
+ whileTap={{ scale: 0.99 }}
325
  disabled={loading}
326
  style={{
327
+ width: '100%', padding: '18px', background: COLORS.brand, color: '#fff',
328
+ border: 'none', borderRadius: 18, fontWeight: 800, cursor: 'pointer',
329
+ opacity: loading ? 0.7 : 1, transition: '0.3s cubic-bezier(0.16, 1, 0.3, 1)',
330
+ boxShadow: `0 20px 40px ${COLORS.brand}40`,
331
+ fontSize: 15, display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 10
332
  }}
333
  >
334
+ {loading ? <Loader2 size={18} className="nexus-spin" /> : <Shield size={18} />}
335
+ {loading ? 'Encrypting Protocol...' : 'Rotate Credentials'}
336
+ </motion.button>
337
+ </motion.form>
338
  )}
339
  </div>
340
+ </motion.div>
341
+ <style>{`
342
+ .nexus-spin { animation: nexus-spin-anim 1s linear infinite; }
343
+ @keyframes nexus-spin-anim { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
344
+ `}</style>
345
  </div>
346
  );
347
  };