.app-layout {
  display: flex;
  height: 100vh;
  padding-top: 56px;
  overflow: hidden;
}

/* --- Sidebar --- */
.sidebar {
  display: none;
  flex-direction: column;
  width: 280px;
  flex-shrink: 0;
  border-right: 0.5px solid #3a3a3a;
  padding: 2rem 1.25rem;
  overflow-y: auto;
}

.sidebar.visible {
  display: flex;
}

.sidebar-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #555;
  margin-bottom: 1rem;
}

.topic-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.topic-item {
  padding: 0.55rem 0.85rem;
  border-radius: 6px;
  font-size: 13.5px;
  color: #888;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
  line-height: 1.4;
}

.topic-item:hover {
  background-color: #333;
  color: #e0e0e0;
}

.topic-item.active {
  background-color: #333;
  color: #e0e0e0;
}

/* --- Upload container --- */
.upload-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
}

/* --- Chat panel --- */
.chat-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  border-left: 0.5px solid #3a3a3a;
  min-width: 0;
  min-height: 0; 
}

.chat-panel.visible {
  display: flex;
}

.chat-header {
  padding: 1.25rem 2rem;
  border-bottom: 0.5px solid #3a3a3a;
  flex-shrink: 0;
}

.chat-topic-label {
  font-size: 14px;
  font-weight: 500;
  color: #aaa;
  margin: 0;
}

.chat-messages-wrapper {
  flex: 1;
  overflow-y: auto;
  display: flex;
  justify-content: center;
  min-height: 0; 
}

.chat-messages {
  width: 860px;
  max-width: 100%;
  padding: 2rem 2rem 10px 2rem; 
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-sizing: border-box;
}



.chat-message {
  font-size: 14px;
  line-height: 1.7;
  max-width: 75%;
  padding: 0.75rem 1.1rem;
  border-radius: 10px;
}

.chat-message.user {
  background-color: #333;
  color: #e0e0e0;
  align-self: flex-end;
}

.chat-message.assistant {
  background-color: transparent;
  color: #bbb;
  align-self: flex-start;
  max-width: 85%;
}

.chat-message.assistant.streaming {
  color: #777;
}

.chat-input-row {
  display: flex;
  gap: 0.75rem;
  padding: 1.25rem 2rem;
  border-top: 0.5px solid #3a3a3a;
  flex-shrink: 0;
  width: 860px;
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.chat-input {
  flex: 1;
  background-color: #2f2f2f;
  border: 0.5px solid #444;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 14px;
  font-family: Helvetica, Arial, sans-serif;
  color: #e0e0e0;
  outline: none;
  transition: border-color 0.15s;
}

.chat-input:focus {
  border-color: #666;
}

.chat-input::placeholder {
  color: #555;
}

.chat-send-btn {
  background-color: #3a3a3a;
  border: 0.5px solid #555;
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 14px;
  padding: 0.75rem 1.1rem;
  cursor: pointer;
  transition: background-color 0.15s;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background-color: #484848;
}

.chat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.chat-message.assistant p {
  margin: 0 0 0.75rem;
}

.chat-message.assistant p:last-child {
  margin-bottom: 0;
}

.chat-message.assistant strong {
  color: #e0e0e0;
}

.chat-message.assistant ul,
.chat-message.assistant ol {
  padding-left: 1.25rem;
  margin: 0.5rem 0;
}

.chat-message.assistant li {
  margin-bottom: 0.25rem;
}

.chat-message.assistant code {
  background-color: #2a2a2a;
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  font-size: 13px;
  font-family: monospace;
  color: #ccc;
}

.chat-message.assistant pre {
  background-color: #2a2a2a;
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
  margin: 0.75rem 0;
}

.chat-message.assistant pre code {
  background: none;
  padding: 0;
}

/* --- Notebook title bar --- */
.notebook-title-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  justify-content: center;
}

.notebook-title {
  font-size: 13px;
  font-weight: 500;
  color: #e0e0e0;
  white-space: nowrap;
}

.progress-bar-track {
  width: 200px;
  height: 5px;
  background-color: #3a3a3a;
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.progress-label {
  font-size: 12px;
  color: #666;
  white-space: nowrap;
}

/* --- Checklist bar --- */
.checklist-bar {
  padding: 1rem 2rem 0.75rem;
  border-bottom: 0.5px solid #3a3a3a;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-width: 860px;
  width: 100%;
  align-self: center;
  box-sizing: border-box;
}

.checklist-bar:empty {
  display: none;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 12px;
  color: #888;
  cursor: pointer;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  border: 0.5px solid #3a3a3a;
  background-color: #2b2b2b;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
  user-select: none;
}

.checklist-item:hover {
  border-color: #555;
  color: #ccc;
}

.checklist-item.done {
  color: #555;
  border-color: #2f2f2f;
  text-decoration: line-through;
}

.checklist-item .check-icon {
  font-size: 10px;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 0.5px solid #555;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.15s, border-color 0.15s;
}

.checklist-item.done .check-icon {
  background-color: #555;
  border-color: #555;
}