:root {
  --bg-gradient: linear-gradient(135deg, #09090b 0%, #1e1b4b 100%);
  --glass-bg: rgba(9, 9, 11, 0.4);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
  
  --primary: #8b5cf6;
  --primary-hover: #7c3aed;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Background Animated Orbs */
body::before, body::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  animation: float 12s infinite alternate ease-in-out;
}
body::before {
  width: 600px; height: 600px;
  background: rgba(139, 92, 246, 0.15);
  top: -100px; left: -100px;
}
body::after {
  width: 700px; height: 700px;
  background: rgba(59, 130, 246, 0.1);
  bottom: -150px; right: -100px;
  animation-delay: -6s;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(40px, 60px) scale(1.1); }
}

.app-container {
  display: flex;
  height: 100vh;
  width: 100%;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
}

/* Glassmorphism Utilities */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
}
.glass-inner {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 24px;
}

/* Sidebar */
.sidebar {
  width: 280px;
  height: 100vh;
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  z-index: 10;
  border-radius: 0;
  border-top: none;
  border-bottom: none;
  border-left: none;
  background: rgba(9, 9, 11, 0.6);
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
  padding-left: 12px;
}
.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}
.logo-icon i { color: white; width: 20px; height: 20px; }
.logo h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.nav-divider {
  height: 1px;
  background: var(--glass-border);
  margin: 12px 0;
}

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

.nav-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  text-align: left;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
}

.nav-btn i { width: 18px; height: 18px; opacity: 0.7; transition: all 0.3s ease; }

.nav-btn:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-main);
  transform: translateX(4px);
}
.nav-btn:hover i { opacity: 1; color: var(--primary); }

.nav-btn.active {
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.15), rgba(59, 130, 246, 0.05));
  color: var(--primary);
  border: 1px solid rgba(139, 92, 246, 0.2);
}
.nav-btn.active i { opacity: 1; color: var(--primary); }

/* Main Content Area */
.main-content {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 72px;
  padding: 0 40px;
  border-bottom: 1px solid var(--glass-border);
  z-index: 5;
  background: rgba(9, 9, 11, 0.4);
  backdrop-filter: blur(24px);
  box-sizing: border-box;
  flex-shrink: 0;
  /* Override glass defaults if applied in HTML */
  border-radius: 0 !important; 
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.top-bar-left label {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1;
}

.tab-content {
  position: absolute;
  top: 72px; /* Below top-bar */
  left: 0; right: 0; bottom: 0;
  padding: 40px 60px;
  overflow-y: auto;
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  visibility: hidden;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  box-sizing: border-box;
}
.tab-content.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
  visibility: visible;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* Typography & Layout */
.section-header {
  margin-bottom: 32px;
  max-width: 800px;
}
.section-header h2 { 
  margin: 0 0 12px 0; 
  font-size: 32px; 
  font-weight: 600; 
  letter-spacing: -0.5px; 
  color: #fff;
  line-height: 1.2;
}
.section-header .subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.5;
}

h3 { 
  margin-top: 0; 
  font-size: 16px; 
  color: #e2e8f0; 
  font-weight: 600; 
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}
h3 i { width: 18px; height: 18px; color: var(--primary); }

.card { margin-bottom: 24px; }

.form-group {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
}

.form-row {
  display: flex;
  gap: 24px;
}
.form-row .form-group { flex: 1; }

label {
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.4;
}

/* Inputs */
.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}
.input-with-icon i {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  width: 18px; height: 18px;
  pointer-events: none;
}
.input-with-icon input {
  padding-left: 44px;
  width: 100%;
}

input, textarea, select {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  padding: 14px 16px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  transition: all 0.2s ease;
  line-height: 1.5;
  box-sizing: border-box;
  width: 100%;
}

input::placeholder, textarea::placeholder {
  color: rgba(148, 163, 184, 0.5);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.select-wrapper select {
  appearance: none;
  padding-right: 44px;
  cursor: pointer;
}
.select-wrapper .select-icon {
  position: absolute;
  right: 14px;
  pointer-events: none;
  color: var(--text-muted);
  width: 18px; height: 18px;
}

/* Buttons */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border: none;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 500;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
  filter: brightness(1.1);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 500;
  border-radius: 12px;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-small { padding: 8px 16px; font-size: 13px; border-radius: 8px; }
.btn-icon-only { padding: 12px; }
.btn-icon-only i { width: 18px; height: 18px; }

/* Lists & Items */
.list-container {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kw-item {
  background: rgba(255, 255, 255, 0.03);
  padding: 24px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  transition: all 0.2s;
  line-height: 1.6;
}
.kw-item:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.btn-delete {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 500;
  margin-left: 16px;
  font-size: 14px;
}
.btn-delete:hover {
  background: var(--danger);
  color: white;
}

/* File Upload */
.file-upload-wrapper {
  position: relative;
  width: 100%;
  height: 52px;
}
.file-upload-wrapper input[type="file"] {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}
.file-upload-display {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.3);
  border: 1px dashed rgba(255,255,255,0.2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  transition: all 0.2s;
  z-index: 1;
}
.file-upload-wrapper:hover .file-upload-display {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(139, 92, 246, 0.1);
}

/* Toggle Switch */
.toggle-group {
  display: flex;
  align-items: center;
  gap: 12px;
}
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255,255,255,0.1);
  transition: .3s;
  border-radius: 26px;
  border: 1px solid rgba(255,255,255,0.1);
}
.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 2px;
  background-color: var(--text-muted);
  transition: .3s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--primary);
  border-color: var(--primary);
}
input:checked + .slider:before {
  transform: translateX(22px);
  background-color: white;
}
.toggle-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-main);
}

/* Sandbox Chat */
.chat-container {
  height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px;
  margin-bottom: 24px;
}
.chat-message {
  display: flex;
  gap: 16px;
  max-width: 75%;
}
.ai-message { align-self: flex-start; }
.user-message { align-self: flex-end; flex-direction: row-reverse; }

.chat-message .avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ai-message .avatar {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}
.user-message .avatar {
  background: rgba(255,255,255,0.1);
}
.chat-message .avatar i { width: 18px; height: 18px; color: white; }

.chat-message .bubble {
  padding: 14px 20px;
  border-radius: 20px;
  font-size: 15px;
  line-height: 1.6;
}
.ai-message .bubble {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.05);
  border-top-left-radius: 6px;
}
.user-message .bubble {
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-top-right-radius: 6px;
}

.chat-input-wrapper {
  display: flex;
  gap: 16px;
}
.chat-input-wrapper input { flex: 1; border-radius: 16px; }
.chat-input-wrapper .btn-primary { border-radius: 16px; padding: 0 24px; }

/* Product UI refresh — 2026 */
:root {
  --bg-gradient: radial-gradient(circle at 72% -10%, #183964 0%, transparent 32%), linear-gradient(145deg, #07101e 0%, #0b1220 55%, #0b1324 100%);
  --glass-bg: rgba(11, 20, 36, .76);
  --glass-border: rgba(148, 163, 184, .14);
  --primary: #8173f4;
  --primary-hover: #7161ea;
  --accent: #2ec5ce;
  --text-main: #f5f7fb;
  --text-muted: #93a3b8;
  --surface: rgba(15, 26, 45, .78);
}

* { box-sizing: border-box; }
body, button, input, textarea, select, h1, h2, h3, h4, p, span, label, small, strong {
  font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
}
body::before, body::after { opacity: .55; }
.glass { box-shadow: none; }
.sidebar { width: 264px; padding: 26px 18px 20px; background: rgba(6, 14, 27, .92); }
.logo { margin-bottom: 28px; }
.logo-icon { width: 40px; height: 40px; border-radius: 13px; background: linear-gradient(145deg, #8d7ff8, #31c5cd); }
.logo h2 { font-size: 20px; font-weight: 700; }
nav { flex: 1; overflow-y: auto; gap: 6px; }
.nav-label { padding: 0 14px 7px; color: #607089; font-size: 10px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; }
.nav-divider { margin: 9px 8px; }
.nav-btn { padding: 11px 14px; font-size: 13px; font-weight: 600; }
.nav-btn:hover { transform: none; background: rgba(255,255,255,.055); }
.nav-btn.active { color: #d1cdff; background: linear-gradient(90deg, rgba(129,115,244,.2), rgba(46,197,206,.06)); border-color: rgba(139,128,250,.22); box-shadow: inset 3px 0 #8a7cf8; }
.sidebar-footer { padding-top: 14px; border-top: 1px solid var(--glass-border); }
.system-status { display:flex; align-items:center; gap:10px; padding:10px 12px; color:#cbd5e1; }
.system-status > span { width:8px; height:8px; border-radius:50%; background:#35d39a; box-shadow:0 0 0 5px rgba(53,211,154,.1); }
.system-status div { display:flex; flex-direction:column; gap:2px; }
.system-status strong { font-size:11px; }.system-status small { font-size:9px; color:#6f8198; }
.top-bar { height:76px; padding:0 32px; background:rgba(7,16,30,.7); }
.top-bar-left { min-width:0; }.top-bar-left > svg { flex:0 0 auto; }
.top-bar-left > label { white-space:nowrap; flex:0 0 auto; text-transform:none; letter-spacing:0; }
.top-bar-left .select-wrapper { min-width:220px; }
.top-actions { display:flex; align-items:center; gap:12px; }
.user-menu { display:flex; align-items:center; gap:10px; padding-left:12px; border-left:1px solid var(--glass-border); }
.user-avatar { width:34px; height:34px; display:grid; place-items:center; border-radius:11px; color:white; font-size:13px; font-weight:800; background:linear-gradient(145deg,#7667e9,#27aeb8); }
.user-meta { display:flex; flex-direction:column; line-height:1.2; }.user-meta strong{font-size:12px}.user-meta small{font-size:10px;color:var(--text-muted);margin-top:3px}
.logout-btn,.mobile-menu-btn { width:36px;height:36px;border:1px solid var(--glass-border);border-radius:10px;background:rgba(255,255,255,.04);color:var(--text-muted);padding:0; }
.logout-btn:hover,.mobile-menu-btn:hover { color:white;background:rgba(255,255,255,.09); }.logout-btn svg,.mobile-menu-btn svg{width:17px}
.mobile-menu-btn { display:none; }
.tab-content { top:76px; padding:42px clamp(28px,4vw,64px) 64px; }
.section-header { margin-bottom:28px; }.section-header h2{font-family:'Segoe UI',Arial,Helvetica,sans-serif;font-size:clamp(26px,3vw,34px);font-weight:700;letter-spacing:-.65px}.section-header .subtitle{font-size:14px;max-width:700px}
.glass-inner,.kw-item { background:linear-gradient(145deg,rgba(21,34,55,.78),rgba(13,24,42,.72)); border-color:rgba(148,163,184,.13); box-shadow:0 16px 40px rgba(0,0,0,.12); }
.glass-inner { border-radius:18px; padding:26px; }
.card { max-width:1100px; }
label { color:#9aabc0; font-size:11px; font-weight:700; letter-spacing:.65px; }
input,textarea,select { background:rgba(5,12,23,.55); border-color:rgba(148,163,184,.17); border-radius:11px; font-size:14px; }
input:hover,textarea:hover,select:hover { border-color:rgba(148,163,184,.3); }
input:focus,textarea:focus,select:focus { border-color:#8072f3; box-shadow:0 0 0 3px rgba(129,115,244,.14); }
textarea { resize:vertical; min-height:96px; }
.btn-primary { background:linear-gradient(135deg,#8173f4,#4b8eea); border-radius:10px; box-shadow:0 8px 22px rgba(74,76,220,.22); font-weight:700; }
.btn-primary:hover { transform:translateY(-1px); box-shadow:0 12px 28px rgba(74,76,220,.3); }
.btn-secondary { border-radius:10px; background:rgba(255,255,255,.055); font-weight:650; }
.kw-item { padding:18px 20px; border-radius:14px; align-items:center; }
.kw-item:hover { transform:translateY(-1px); background:rgba(27,41,63,.92); }
.kw-item img { box-shadow:0 8px 22px rgba(0,0,0,.25); }
.btn-delete { border-radius:9px; font-weight:700; }
.chat-container { height:min(520px,55vh); border-radius:20px; }
.chat-input-wrapper { max-width:1100px; position:sticky; bottom:0; padding:12px; border-radius:16px; background:rgba(7,16,30,.82); backdrop-filter:blur(15px); }
.sidebar-backdrop { display:none; }
.toast-region { position:fixed;right:24px;bottom:24px;z-index:10000; }

@media (max-width: 1180px) {
  .top-bar-left > label { display:none; }
  .top-bar { padding:0 22px; }
  .top-bar-left .select-wrapper { min-width:190px; }
  .user-meta { display:none; }
}

@media (max-width: 1020px) {
  .icon-refresh span { display:none; }
  .icon-refresh { width:36px;padding:0; }
  .user-menu { padding-left:0;border-left:0; }
}

@media (max-width: 900px) {
  .sidebar { position:fixed;left:-280px;top:0;transition:left .25s ease;box-shadow:30px 0 70px rgba(0,0,0,.45); }
  body.sidebar-open .sidebar { left:0; }
  .sidebar-backdrop { display:block;position:fixed;inset:0;background:rgba(2,8,18,.7);backdrop-filter:blur(3px);z-index:9;opacity:0;pointer-events:none;transition:opacity .25s; }
  body.sidebar-open .sidebar-backdrop { opacity:1;pointer-events:auto; }
  .mobile-menu-btn { display:inline-flex;flex:0 0 auto; }
  .top-bar { padding:0 16px;height:68px; }.tab-content{top:68px;padding:28px 18px 48px}
  .top-bar-left > label,.user-meta,.icon-refresh span { display:none; }
  .top-bar-left .select-wrapper { min-width:0;width:min(42vw,200px); }
  .user-menu { padding-left:0;border:0; }.top-actions{gap:7px}.top-bar-left{gap:8px}
  .form-row { flex-direction:column;gap:0; }.glass-inner{padding:20px}.section-header{margin-bottom:22px}
  .kw-item { flex-wrap:wrap;gap:14px; }.chat-message{max-width:92%}
}

@media (max-width: 520px) {
  .user-menu { display:none; }.top-bar-left .select-wrapper{width:44vw}.top-bar{gap:8px}
  .section-header h2{font-size:25px}.section-header .subtitle{font-size:13px}.glass-inner{padding:17px}
  .btn-primary,.btn-secondary{padding:11px 16px}.kw-item{padding:15px}.chat-container{height:58vh}
}

@media (prefers-reduced-motion: reduce) { *,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important} }
