* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0f1420;
  color: #e6e9ef;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: #141b2e;
  border-bottom: 1px solid #232c42;
}
.brand { font-weight: 700; font-size: 18px; letter-spacing: 0.3px; }
.project-badge {
  font-size: 12px;
  background: #1f3a5f;
  color: #bcd7ff;
  padding: 4px 10px;
  border-radius: 999px;
}
.layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  height: calc(100vh - 53px);
}
.panel { padding: 20px; overflow-y: auto; }
.setup-panel {
  background: #10182a;
  border-right: 1px solid #232c42;
}
.setup-panel h2 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.6px; color: #8fa3c9; margin-top: 24px; }
.setup-panel h2:first-child { margin-top: 0; }
label { display: block; font-size: 12.5px; color: #9aa7c2; margin: 10px 0 4px; }
input, textarea, select {
  width: 100%;
  background: #1a2338;
  border: 1px solid #2a3550;
  color: #e6e9ef;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13.5px;
  font-family: inherit;
  resize: vertical;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: #4a7dff; }
button {
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
button.primary { background: #3d6dff; color: white; }
button.primary:disabled { background: #2a3550; color: #6b7690; cursor: not-allowed; }
button.secondary { background: #232c42; color: #dbe3f5; }
button.secondary:disabled { color: #5c6683; cursor: not-allowed; }
#btn-create-project, #btn-generate { width: 100%; margin-top: 14px; }
.upload-row { margin-bottom: 12px; }
.upload-row input[type=file] { font-size: 12px; }
.hint { font-size: 12px; color: #7f8bab; margin-top: 6px; min-height: 16px; }

.chat-panel { display: flex; flex-direction: column; background: #0f1420; }
.chat-window {
  flex: 1;
  overflow-y: auto;
  border: 1px solid #232c42;
  border-radius: 12px;
  padding: 16px;
  background: #10182a;
  margin-bottom: 14px;
}
.empty-state { color: #6b7690; font-size: 14px; line-height: 1.6; }
.msg { margin-bottom: 18px; max-width: 90%; }
.msg.user { margin-left: auto; }
.msg .bubble {
  padding: 12px 14px;
  border-radius: 10px;
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 13.8px;
}
.msg.user .bubble { background: #3d6dff; color: white; }
.msg.assistant .bubble { background: #1a2338; border: 1px solid #2a3550; }
.msg .role { font-size: 11px; color: #7f8bab; margin-bottom: 4px; }

.chat-input-row { display: flex; gap: 10px; }
.chat-input-row input { flex: 1; }
.approve-row { display: flex; gap: 10px; margin-top: 12px; }
.approve-row button { flex: 1; }

h3 { margin: 14px 0 6px; font-size: 14px; color: #bcd7ff; }

.hint-inline { font-size: 10.5px; color: #7f8bab; text-transform: none; letter-spacing: 0; font-weight: 400; }
.library-list { margin-bottom: 10px; display: flex; flex-direction: column; gap: 6px; }
.library-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1a2338;
  border: 1px solid #2a3550;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12.5px;
}
.library-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-meta { color: #7f8bab; font-size: 11px; }
.library-remove {
  background: transparent;
  border: none;
  color: #ff8080;
  padding: 2px 6px;
  font-size: 13px;
}
