:root {
  --bg-main: #06080d;
  --bg-card: rgba(15, 20, 32, 0.85);
  --bg-elevated: #111728;
  --bg-input: rgba(10, 14, 24, 0.95);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow-cyan: rgba(0, 240, 255, 0.35);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --cyan: #00f0ff;
  --cyan-glow: rgba(0, 240, 255, 0.2);
  --purple: #a855f7;
  --emerald: #10b981;
  --amber: #f59e0b;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --font-main: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-main);
  color: var(--text-main);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  position: relative;
  line-height: 1.5;
}

/* Background Ambient */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(120px);
  opacity: 0.3;
  z-index: 0;
}
.glow-cyan {
  top: -80px;
  left: 10%;
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(0, 240, 255, 0.25) 0%, transparent 70%);
}
.glow-purple {
  bottom: 10%;
  right: -60px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.2) 0%, transparent 70%);
}

/* Lock Screen */
.lock-screen {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 13, 0.96);
  backdrop-filter: blur(20px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.lock-screen.active {
  display: flex;
}

.lock-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glow-cyan);
  border-radius: var(--radius-lg);
  padding: 36px 28px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.6);
}

.lock-icon {
  font-size: 2.8rem;
  margin-bottom: 12px;
}

.lock-card h2 {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.lock-card p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

#pinInput {
  width: 100%;
  padding: 14px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 1.6rem;
  text-align: center;
  letter-spacing: 0.4em;
  outline: none;
  margin-bottom: 14px;
  font-family: var(--font-mono);
}
#pinInput:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 16px var(--cyan-glow);
}

.pin-error {
  color: #ef4444;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 12px;
}
.pin-error.hidden { display: none; }

.btn-unlock {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #00f0ff, #0284c7);
  border: none;
  border-radius: var(--radius-md);
  color: #040810;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 240, 255, 0.35);
}

/* App Container */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* Header */
.top-header {
  padding: 12px 16px;
  background: rgba(6, 8, 13, 0.88);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}

.brand-title {
  font-weight: 700;
  font-size: 1.05rem;
}
.brand-title .highlight { color: var(--cyan); }

.icon-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  font-size: 1rem;
}

.selectors-row {
  display: flex;
  gap: 10px;
}

.select-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.select-label {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.custom-select {
  width: 100%;
  padding: 6px 10px;
  background: rgba(17, 23, 40, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  font-family: var(--font-main);
}
.custom-select:focus {
  border-color: var(--cyan);
}

/* Chat Area */
.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  -webkit-overflow-scrolling: touch;
}

.welcome-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  margin: auto 0;
}

.welcome-icon { font-size: 2.2rem; margin-bottom: 8px; }
.welcome-card h3 { font-size: 1.15rem; margin-bottom: 6px; }
.welcome-card p { font-size: 0.85rem; color: var(--text-muted); }

/* Message Bubbles */
.message {
  display: flex;
  flex-direction: column;
  max-width: 90%;
  animation: fadeIn 0.2s ease-out;
}

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

.message.user {
  align-self: flex-end;
}
.message.user .msg-bubble {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.15), rgba(2, 132, 199, 0.25));
  border: 1px solid rgba(0, 240, 255, 0.35);
  color: #fff;
  border-radius: 18px 18px 4px 18px;
}

.message.agent {
  align-self: flex-start;
  max-width: 95%;
}
.message.agent .msg-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 18px 18px 18px 4px;
}

.msg-bubble {
  padding: 12px 16px;
  font-size: 0.92rem;
  word-break: break-word;
}

.msg-bubble pre {
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin: 8px 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.msg-bubble code {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Tool Execution Box */
.tool-box {
  background: rgba(0, 0, 0, 0.4);
  border-left: 3px solid var(--cyan);
  padding: 8px 12px;
  margin: 6px 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.82rem;
  font-family: var(--font-mono);
}
.tool-box.error {
  border-left-color: #ef4444;
}

/* Quick Actions */
.quick-actions-bar {
  padding: 6px 12px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  flex-shrink: 0;
  background: rgba(6, 8, 13, 0.7);
  -webkit-overflow-scrolling: touch;
}
.quick-actions-bar::-webkit-scrollbar { display: none; }

.chip-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 6px 12px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-main);
}
.chip-btn:hover, .chip-btn:active {
  background: rgba(0, 240, 255, 0.15);
  color: var(--cyan);
  border-color: rgba(0, 240, 255, 0.35);
}

/* Bottom Bar */
.bottom-bar {
  padding: 10px 14px 16px;
  background: rgba(6, 8, 13, 0.95);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.input-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 6px 10px 6px 14px;
}
.input-form:focus-within {
  border-color: var(--cyan);
  box-shadow: 0 0 16px var(--cyan-glow);
}

#promptInput {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-family: var(--font-main);
  font-size: 0.95rem;
  resize: none;
  max-height: 120px;
  outline: none;
  padding: 6px 0;
  line-height: 1.4;
}

.send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--cyan);
  border: none;
  color: #040810;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}
.send-btn:hover, .send-btn:active {
  transform: scale(1.06);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.active { display: flex; }

.modal-box {
  background: #0f1420;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 440px;
  width: 100%;
}

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

.close-modal {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
}

.form-group {
  margin-bottom: 14px;
}
.form-group label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-group input {
  width: 100%;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.88rem;
  outline: none;
}
.form-group input:focus { border-color: var(--cyan); }

.btn-save {
  width: 100%;
  padding: 12px;
  background: var(--cyan);
  color: #040810;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
