.section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  max-height: 120px;
  flex-shrink: 0;
}

.nav-item {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12px;
  min-height: 32px;
}

.nav-item.active {
  border-color: var(--primary);
  background: rgba(236, 72, 153, 0.15);
  color: #fff;
}

.editor-area,
.prompt-area,
.gen-output,
.json-pane {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 10px;
  resize: vertical;
  min-height: 180px;
  white-space: pre-wrap;
  word-break: break-word;
}

.editor-area {
  min-height: 260px;
}

.gen-output {
  margin: 0;
  min-height: 100%;
  border: none;
  background: transparent;
}

.output-wrap {
  margin: 0 12px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  min-height: 160px;
}

.context-box {
  margin: 0 12px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  overflow: hidden;
}

.context-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.context-preview {
  margin: 0;
  padding: 10px;
  max-height: 180px;
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-muted);
}

.gen-context-warn {
  margin: 0;
  padding: 6px 10px;
  font-size: 11px;
  color: #fbbf24;
  border-bottom: 1px solid var(--border);
}

.api-hint {
  margin: 0 12px 8px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

#apiModelSelect {
  min-height: 36px;
}

.btn.small {
  padding: 2px 8px;
  font-size: 11px;
  min-height: 24px;
}

.gen-actions,
.api-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 12px 10px;
  align-items: flex-end;
}

.gen-status {
  font-size: 12px;
  color: var(--text-muted);
}

.gen-status.error {
  color: var(--danger);
}

.tab-bar {
  display: flex;
  gap: 4px;
}

.tab {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  border: 1px solid var(--border);
  min-height: 28px;
}

.tab.active {
  background: rgba(139, 92, 246, 0.2);
  border-color: var(--accent);
}

.preview-stat {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.preview-stat span {
  color: var(--text-muted);
}

.preview-stat .ok {
  color: var(--ok);
}

.preview-cover img {
  width: 100%;
  max-width: 200px;
  border-radius: 8px;
  margin-top: 12px;
}

.cover-placeholder {
  margin-top: 12px;
  padding: 40px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--text-muted);
}

.wb-entry {
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.wb-entry header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface-2);
}

.wb-entry h4 {
  margin: 0;
  font-size: 13px;
}

.wb-pos {
  font-size: 11px;
  color: var(--accent);
}

.wb-body {
  margin: 0;
  padding: 10px;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

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

.json-pane {
  min-height: 200px;
  font-size: 11px;
  overflow: auto;
}

/* Chat panel */
.chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

.chat-head-minimal h2 {
  font-size: 14px;
  font-weight: 600;
}

.chat-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  flex-shrink: 0;
}

.chat-status-dot[data-state="busy"] {
  background: var(--accent);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  50% { opacity: 0.4; }
}

.chat-messages {
  flex: 1;
  min-height: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-task-bar {
  position: absolute;
  top: 48px;
  right: 12px;
  z-index: 20;
  width: min(240px, calc(100% - 24px));
  max-height: min(320px, calc(100% - 128px - var(--bottom-obstruction)));
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.94);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
}

.chat-task-bar.is-dragging {
  cursor: grabbing;
  user-select: none;
}

.task-check-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: rgba(17, 24, 39, 0.98);
  cursor: grab;
  touch-action: none;
}

.task-check-head span:first-child {
  font-size: 12px;
  font-weight: 600;
}

.task-check-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.task-check-list {
  list-style: none;
  margin: 0;
  padding: 6px;
}

.task-check-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.35;
}

.task-check-item.done {
  color: var(--text-muted);
}

.task-check-box {
  width: 16px;
  flex: 0 0 16px;
  color: var(--accent);
  text-align: center;
}

.chat-empty {
  color: var(--text-muted);
  font-size: 13px;
  padding: 20px;
  text-align: center;
  line-height: 1.6;
}

.chat-bubble {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.55;
}

.chat-bubble.user {
  align-self: flex-end;
  background: rgba(236, 72, 153, 0.2);
  border: 1px solid rgba(236, 72, 153, 0.35);
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.chat-bubble.streaming .chat-text::after {
  content: '▍';
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.chat-role {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.chat-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-generated-image {
  margin: 10px 0 0;
}

.chat-generated-image img {
  display: block;
  width: min(100%, 320px);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.chat-compose {
  border-top: 1px solid var(--border);
  padding: 10px 12px;
  flex-shrink: 0;
}

.chat-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  padding: 12px;
  resize: none;
  min-height: 72px;
  margin-bottom: 8px;
  line-height: 1.5;
}

.chat-compose-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Settings modal */
.settings-btn {
  margin-left: 4px;
}

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 56px 16px calc(16px + var(--bottom-obstruction));
}

.settings-panel {
  width: min(400px, 100%);
  max-height: calc(100dvh - 72px - var(--bottom-obstruction));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.settings-head h2 {
  margin: 0;
  font-size: 16px;
}

.settings-body {
  padding: 14px;
  overflow-y: auto;
}

.settings-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.settings-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-bottom: 10px;
}

.settings-status {
  font-size: 12px;
  color: var(--text-muted);
  margin: 8px 0 0;
  line-height: 1.4;
}

.settings-status.error {
  color: var(--danger);
}
