* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
  background: #0b0f19;
  color: #f8fafc;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* App Layout */
.app-layout {
  display: flex;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  position: relative;
}

/* Sidebar */
.sidebar {
  width: 290px;
  min-width: 290px;
  background: #090d16;
  border-right: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
}

.sidebar-header {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #1e293b;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 16px;
  color: #38bdf8;
}

.brand-icon {
  font-size: 18px;
}

.brand small {
  font-size: 11px;
  color: #94a3b8;
  background: #1e293b;
  padding: 2px 6px;
  border-radius: 4px;
}

.close-sidebar-btn {
  display: none;
}

.sidebar-actions {
  padding: 12px 14px;
  border-bottom: 1px solid #1e293b;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
}

.btn-primary {
  background: #0284c7;
  color: #ffffff;
  width: 100%;
}

.btn-primary:hover {
  background: #0369a1;
}

.btn-danger {
  background: #ef4444;
  color: #ffffff;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11px;
  border-radius: 6px;
}

.icon-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background: #1e293b;
  color: #f8fafc;
}

.sidebar-scrollable {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-scrollable::-webkit-scrollbar {
  width: 5px;
}
.sidebar-scrollable::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 4px;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.section-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #64748b;
  padding: 0 4px 6px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-action-btn {
  background: #1e293b;
  color: #38bdf8;
  border: 1px solid #334155;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.section-action-btn:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

.topbar-action-btn {
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.topbar-action-btn:hover {
  background: #0284c7;
  border-color: #0284c7;
}

/* Modal Dialog */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 14px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-pop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-pop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
}

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

.modal-hint {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.5;
}

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

.form-group label {
  font-size: 12px;
  font-weight: 700;
  color: #cbd5e1;
}

.form-group input {
  background: #090d16;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: #f8fafc;
  outline: none;
  transition: border-color 0.15s;
}

.form-group input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.quick-projects-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.quick-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #64748b;
}

.quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quick-tag {
  background: #1e293b;
  color: #38bdf8;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.quick-tag:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid #1e293b;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: #090d16;
}

.btn-secondary {
  background: #1e293b;
  color: #cbd5e1;
}
.btn-secondary:hover {
  background: #334155;
  color: #f8fafc;
}

.item-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.list-item {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: all 0.15s;
}

.list-item:hover {
  background: #1e293b;
  color: #f8fafc;
}

.list-item.active {
  background: #0c4a6e;
  color: #38bdf8;
  font-weight: 600;
}

.list-item-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.deliverable-download-link {
  color: #38bdf8;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  background: #0f172a;
  border: 1px solid #0284c7;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}
.deliverable-download-link:hover {
  background: #0284c7;
  color: #ffffff;
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid #1e293b;
  background: #070a10;
}

.node-status-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #0f172a;
  border: 1px solid #1e293b;
}

.status-indicator-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #eab308;
}

.status-indicator-dot.online {
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

.status-indicator-dot.offline {
  background: #ef4444;
}

.status-info {
  display: flex;
  flex-direction: column;
}

.status-title {
  font-size: 12px;
  font-weight: 700;
  color: #f8fafc;
}

.status-subtitle {
  font-size: 10px;
  color: #64748b;
}

/* Main Content Area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #0b0f19;
}

/* Topbar */
.topbar {
  height: 56px;
  min-height: 56px;
  background: #090d16;
  border-bottom: 1px solid #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  z-index: 10;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-toggle-btn {
  display: none;
}

.current-project-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.project-badge {
  background: #0369a1;
  color: #bae6fd;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}

.project-name {
  font-size: 14px;
  font-weight: 700;
  color: #f8fafc;
}

.project-path {
  font-size: 11px;
  color: #64748b;
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #0f172a;
  border: 1px solid #1e293b;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #eab308;
}

.badge-pill.connected .badge-dot {
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
}
.badge-pill.connected {
  border-color: #166534;
  color: #86efac;
}

/* Task Tracker Banner */
.task-tracker-bar {
  background: #0f172a;
  border-bottom: 1px solid #0284c7;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: pulse-bg 2s infinite ease-in-out;
}

.task-tracker-bar.hidden {
  display: none;
}

.task-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #38bdf8;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.task-details {
  flex: 1;
}

.task-title {
  font-size: 12px;
  font-weight: 700;
  color: #38bdf8;
}

.task-desc {
  font-size: 11px;
  color: #94a3b8;
}

/* Chat Messages */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chat-container::-webkit-scrollbar {
  width: 6px;
}
.chat-container::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 4px;
}

.welcome-banner {
  margin: auto;
  max-width: 580px;
  text-align: center;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.welcome-icon {
  font-size: 36px;
  background: #0f172a;
  border: 1px solid #1e293b;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.welcome-banner h2 {
  font-size: 20px;
  font-weight: 800;
  color: #f8fafc;
}

.welcome-banner p {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.5;
}

.feature-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 10px;
}

.pill {
  background: #1e293b;
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 12px;
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}

.msg-row {
  display: flex;
  gap: 12px;
  width: 100%;
}

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.msg-row.user .msg-avatar {
  background: #0284c7;
  color: #fff;
}

.msg-row.assistant .msg-avatar {
  background: #10b981;
  color: #fff;
}

.msg-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.msg-sender {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
}

.msg-content {
  font-size: 14px;
  line-height: 1.6;
  color: #e2e8f0;
  word-break: break-word;
}

.msg-content p {
  margin-bottom: 8px;
}

.msg-content pre {
  background: #070a10;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 13px;
  margin: 10px 0;
}

.msg-content code {
  background: #1e293b;
  color: #38bdf8;
  padding: 2px 5px;
  border-radius: 4px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12px;
}

.msg-content pre code {
  background: transparent;
  padding: 0;
  color: #e2e8f0;
}

/* Tool Execution Box */
.tool-card {
  background: #070a10;
  border: 1px solid #1e293b;
  border-left: 3px solid #0284c7;
  border-radius: 6px;
  margin: 8px 0;
  overflow: hidden;
}

.tool-header {
  padding: 8px 12px;
  background: #0c1322;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: #38bdf8;
}

.tool-body {
  padding: 10px 12px;
  font-family: 'Consolas', monospace;
  font-size: 12px;
  color: #94a3b8;
  white-space: pre-wrap;
  max-height: 220px;
  overflow-y: auto;
}

/* Deliverable Card */
.deliverable-card {
  background: #0c1a2e;
  border: 1px solid #0284c7;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 12px 0;
}

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

.deliverable-icon {
  font-size: 28px;
}

.deliverable-title {
  font-size: 14px;
  font-weight: 700;
  color: #f8fafc;
}

.deliverable-meta {
  font-size: 11px;
  color: #64748b;
}

/* Input Area */
.input-footer {
  padding: 14px 20px;
  background: #090d16;
  border-top: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-card {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 8px 12px;
  transition: border-color 0.2s;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}

.input-card:focus-within {
  border-color: #0284c7;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

#promptInput {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #f8fafc;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  max-height: 180px;
  padding: 4px 0;
}

#promptInput::placeholder {
  color: #64748b;
}

.send-btn {
  background: #0284c7;
  color: #fff;
  border: none;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}

.send-btn:hover {
  background: #0369a1;
}

.input-hint {
  font-size: 11px;
  color: #64748b;
  text-align: center;
}

/* Responsive Mobile Layout */
@media (max-width: 768px) {
  .menu-toggle-btn {
    display: flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .close-sidebar-btn {
    display: flex;
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 99;
  }

  .sidebar-backdrop.active {
    display: block;
  }

  .project-path {
    display: none;
  }

  .chat-container {
    padding: 14px;
  }

  .input-footer {
    padding: 10px 14px;
  }
}
