:root {
  --bg-app: #0f1013;
  --bg-sidebar: #15171c;
  --bg-card: #1b1d23;
  --bg-input: #1a1c22;
  --border-color: #272a33;
  --border-active: #3b82f6;
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent-blue: #3b82f6;
  --accent-hover: #2563eb;
  --badge-fast: #10b981;
  --badge-pro: #8b5cf6;
  --badge-thinking: #f59e0b;
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
}

.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* ==========================================
   SIDEBAR
   ========================================== */
.sidebar {
  width: 280px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 18px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.logo-icon {
  width: 22px;
  height: 22px;
  color: var(--accent-blue);
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.icon-btn:hover {
  background-color: var(--bg-card);
  color: var(--text-primary);
}

.sidebar-section {
  flex: 1;
  overflow-y: auto;
  padding: 16px 10px;
}

.sidebar-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0 10px 10px;
}

.clients-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.client-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s;
}

.client-item:hover {
  background-color: var(--bg-card);
  color: var(--text-primary);
}

.client-item.active {
  background-color: #232732;
  color: #ffffff;
  font-weight: 600;
  border-left: 3px solid var(--accent-blue);
}

.client-icon {
  width: 16px;
  height: 16px;
  color: var(--accent-blue);
  opacity: 0.85;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot.success { background-color: var(--badge-fast); }
.dot.warning { background-color: var(--badge-thinking); }

.sidebar-btn {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.sidebar-btn:hover {
  background-color: var(--bg-card);
  color: var(--text-primary);
  border-color: #3b4252;
}

/* ==========================================
   MAIN CONTENT
   ========================================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  background-color: var(--bg-app);
}

.top-nav {
  height: 60px;
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: rgba(21, 23, 28, 0.7);
  backdrop-filter: blur(8px);
}

.active-client-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.active-client-info h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.domain-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1e222b;
  border: 1px solid var(--border-color);
  color: #93c5fd;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-family: 'JetBrains Mono', monospace;
  transition: all 0.15s;
}

.domain-badge:hover {
  border-color: var(--accent-blue);
  color: #bfdbfe;
}

.stack-badge {
  background: #252833;
  color: #cbd5e1;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
}

.action-btn.primary {
  background-color: var(--accent-blue);
  color: white;
}

.action-btn.primary:hover {
  background-color: var(--accent-hover);
}

.action-btn.secondary {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.action-btn.secondary:hover {
  background-color: #272b35;
}

/* ==========================================
   CHAT CANVAS
   ========================================== */
.chat-canvas {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.messages-container {
  width: 100%;
  max-width: 820px;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.message {
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: fadeIn 0.2s ease-in;
}

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

.message-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.message.user .message-header {
  color: var(--accent-blue);
}

.message-body {
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 14.5px;
  line-height: 1.6;
}

.message.user .message-body {
  background-color: #20242e;
  border: 1px solid #2e3342;
  color: var(--text-primary);
  align-self: flex-start;
  max-width: 90%;
}

.message.assistant .message-body {
  background-color: transparent;
  color: #e5e7eb;
}

.thought-box {
  background-color: #191b22;
  border-left: 3px solid var(--badge-thinking);
  padding: 8px 12px;
  margin-bottom: 12px;
  border-radius: 0 6px 6px 0;
  font-size: 12.5px;
  color: #d1d5db;
  font-style: italic;
}

.message-body pre {
  background-color: #14161b;
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  margin: 10px 0;
}

.message-body code {
  font-family: 'JetBrains Mono', monospace;
  background-color: #20232b;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 12.5px;
}

/* ==========================================
   INPUT BAR (ANTIGRAVITY STYLE)
   ========================================== */
.input-container {
  padding: 0 24px 20px;
  display: flex;
  justify-content: center;
}

.chat-box {
  width: 100%;
  max-width: 820px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  transition: border-color 0.2s;
}

.chat-box:focus-within {
  border-color: var(--border-active);
}

.chat-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.model-picker-container {
  position: relative;
}

.model-selector-btn {
  background: #22252e;
  border: 1px solid #2d323e;
  color: var(--text-primary);
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  transition: all 0.15s;
}

.model-selector-btn:hover {
  background: #2b2f3b;
}

.badge-speed {
  background: rgba(16, 185, 129, 0.15);
  color: var(--badge-fast);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
}

.system-prompt-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.bullet {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent-blue);
}

#prompt-input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14.5px;
  resize: none;
  outline: none;
  min-height: 48px;
  max-height: 200px;
  line-height: 1.5;
}

#prompt-input::placeholder {
  color: #555b6d;
}

.chat-box-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
}

.hint-text {
  font-size: 11.5px;
  color: var(--text-muted);
}

.btn-send {
  background-color: var(--accent-blue);
  color: white;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-send:hover {
  background-color: var(--accent-hover);
}

/* ==========================================
   MODEL DROPDOWN
   ========================================== */
.model-dropdown {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  width: 320px;
  background-color: #1a1c22;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  padding: 8px;
  z-index: 100;
}

.model-dropdown.hidden {
  display: none;
}

.dropdown-header {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 6px 10px 8px;
  border-bottom: 1px solid var(--border-color);
}

.model-option {
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: background 0.15s;
}

.model-option:hover {
  background-color: #242730;
}

.model-option.active {
  background-color: #282c38;
}

.model-option-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.model-option-name {
  font-size: 13px;
  font-weight: 600;
}

.model-option-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.35;
}

/* ==========================================
   MODALS & DRAWERS
   ========================================== */
.modal, .drawer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden, .drawer.hidden {
  display: none;
}

.modal-overlay, .drawer-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  width: 100%;
  max-width: 520px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.modal-header, .drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input, .form-group textarea {
  background-color: #121317;
  border: 1px solid var(--border-color);
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
}

.form-group input:focus, .form-group textarea:focus {
  border-color: var(--accent-blue);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

/* DRAWER */
.drawer {
  justify-content: flex-end;
}

.drawer-content {
  position: relative;
  width: 480px;
  height: 100%;
  background-color: var(--bg-sidebar);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.actions-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.action-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.action-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-muted);
}

.action-card-desc {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.action-card-details {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  background: #121317;
  padding: 6px 8px;
  border-radius: 4px;
  color: #94a3b8;
  word-break: break-all;
}
