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

:root {
  /* Finanzfuchs palette — light mode */
  --bg-primary: #ffffff;
  --bg-secondary: #F5F5F5;
  --bg-tertiary: #EEEDF2;
  --border: #e0dce8;
  --text-primary: #242424;
  --text-secondary: #666;
  --text-muted: #999;
  --accent: #411FD1;
  --accent-mid: #5736E3;
  --accent-light: #E5E4FC;
  --accent-bg: rgba(65, 31, 209, 0.08);
  --orange: #FF6038;
  --orange-light: #FF9378;
  --orange-bg: rgba(255, 96, 56, 0.08);
  --green: #16a34a;
  --yellow: #d97706;
  --blue: #5736E3;
  --red: #dc2626;
}

html, body {
  height: 100%;
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
}

/* ===== Top bar ===== */
#topbar {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  gap: 8px;
  height: 48px;
}
.topbar-brand { color: var(--orange); font-weight: bold; font-size: 14px; margin-right: 12px; font-family: 'Proxima Nova', 'Open Sans', sans-serif; }
.topbar-tabs { display: flex; gap: 6px; }
.topbar-tab {
  padding: 6px 14px;
  border-radius: 6px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}
.topbar-tab:hover { color: var(--text-primary); }
.topbar-tab.active {
  background: var(--orange-bg);
  border-color: var(--orange);
  color: var(--text-primary);
  font-weight: bold;
}
.topbar-tab.add-tab { color: var(--text-muted); }
.topbar-right { margin-left: auto; display: flex; gap: 12px; align-items: center; }
.status { font-size: 11px; }
.status.connected { color: var(--green); }
.status.connected::before { content: '● '; }
.status.disconnected { color: #999; }
.status.disconnected::before { content: '● '; }
.status.running { color: var(--orange); animation: pulse 1.5s infinite; }
.status.running::before { content: '● '; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ===== Main layout ===== */
#main-layout { display: flex; height: calc(100vh - 48px); }

/* ===== Sidebar ===== */
#sidebar {
  width: 220px;
  background: var(--bg-primary);
  border-right: 1px solid var(--border);
  padding: 14px;
  overflow-y: auto;
  flex-shrink: 0;
}
.sidebar-section { margin-bottom: 16px; }
.sidebar-heading {
  color: var(--orange);
  font-weight: bold;
  font-size: 10px;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  margin-top: 12px;
}
.sidebar-section:first-child .sidebar-heading:first-child { margin-top: 0; }
.sidebar-line { color: var(--text-secondary); font-size: 11px; margin-bottom: 4px; }
.sidebar-files { font-size: 11px; }
.sidebar-files .file-entry { margin-bottom: 3px; cursor: pointer; color: var(--text-secondary); }
.sidebar-files .file-entry:hover { color: var(--text-primary); }
.file-status-M { color: var(--green); }
.file-status-A, .file-status-\? { color: var(--yellow); }
.file-status-D { color: var(--red); }

/* ===== Main content ===== */
#content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ===== Kanban ===== */
#kanban-wrapper { border-bottom: 1px solid var(--border); }
#kanban-header { display: flex; align-items: center; padding: 10px 16px; }
#kanban-title { color: var(--text-primary); font-weight: bold; font-size: 13px; }
.collapse-btn {
  margin-left: auto;
  background: var(--bg-tertiary);
  border: none;
  color: var(--text-secondary);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  cursor: pointer;
}
#kanban-board { display: flex; gap: 10px; padding: 0 16px 14px; }
#kanban-board.collapsed { display: none; }
.kanban-column {
  flex: 1;
  background: var(--bg-secondary);
  border-radius: 6px;
  padding: 10px;
  min-height: 60px;
}
.kanban-column-header {
  font-size: 10px;
  font-weight: bold;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}
.kanban-column-header.active { color: var(--orange); }
.kanban-column-header.pending { color: var(--accent-mid); }
.kanban-column-header.blocked { color: var(--red); }
.kanban-column-header.done { color: var(--green); }
.kanban-column-header .count { color: var(--text-muted); }

/* Kanban cards */
.kanban-card {
  background: var(--bg-tertiary);
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-primary);
  margin-bottom: 6px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: border-color 0.15s, background 0.15s;
}
.kanban-card:hover { background: #e8e4f0; }
.kanban-card.selected { border-left-color: var(--orange); background: #e8e4f0; }
.kanban-card .card-title { font-weight: bold; }
.kanban-card .card-desc { color: var(--text-secondary); font-size: 10px; margin-top: 3px; }

/* Needs-input badge (Agentic OS) */
.badge-needs-input {
  display: inline-block;
  background: #FFDED6;
  color: var(--orange);
  font-size: 9px;
  font-weight: bold;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 6px;
}

/* Progress bar (Agentic OS) */
.card-progress {
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  margin-top: 6px;
  overflow: hidden;
}
.card-progress-bar {
  height: 100%;
  background: var(--orange);
  border-radius: 1px;
  transition: width 0.3s;
}

.kanban-empty {
  padding: 8px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  border: 1px dashed var(--border);
}

/* Achieved strip (horizontal scroll) */
.achieved-strip {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  overflow-x: auto;
  border-top: 1px dashed var(--border);
}
.achieved-strip:empty { display: none; }
.achieved-strip .achieved-item {
  flex-shrink: 0;
  background: var(--bg-secondary);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}
.achieved-strip .achieved-item::before { content: '✓ '; color: var(--green); }
.achieved-strip-label {
  flex-shrink: 0;
  font-size: 10px;
  color: var(--text-muted);
  padding: 4px 0;
  letter-spacing: 0.5px;
}

/* ===== Task detail panel ===== */
.task-detail {
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  max-height: 200px;
  overflow-y: auto;
  padding: 12px 16px;
}
.task-detail.hidden { display: none; }
.task-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.task-detail-header span { font-weight: bold; font-size: 13px; }
.task-detail-actions { display: flex; gap: 6px; }
#task-detail-body { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }

/* ===== Chat ===== */
#chat-wrapper { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
#chat-messages { flex: 1; overflow-y: auto; padding: 14px 16px; }

.chat-msg { display: flex; gap: 8px; margin-bottom: 12px; }
.chat-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 11px;
  font-weight: bold;
}
.chat-avatar.user { background: var(--orange); }
.chat-avatar.claude { background: var(--accent); }

.chat-bubble {
  border-radius: 8px;
  padding: 10px;
  max-width: 80%;
  font-size: 13px;
  line-height: 1.5;
}
.chat-bubble.user { background: var(--accent-light); }
.chat-bubble.claude { background: var(--bg-secondary); border: 1px solid var(--border); }
.chat-bubble img { max-width: 100%; border-radius: 6px; margin-top: 8px; cursor: pointer; }
.chat-bubble pre {
  background: var(--bg-tertiary);
  padding: 8px;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 12px;
  margin-top: 8px;
}
.chat-bubble code {
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: 12px;
}

.chat-tool-call {
  background: var(--bg-primary);
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  cursor: pointer;
  border-left: 2px solid var(--accent-mid);
}
.chat-tool-call.collapsed .tool-detail { display: none; }

/* Approval gate */
.approval-gate {
  margin-top: 8px;
  padding: 8px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 4px;
}
.approval-gate .gate-title { color: var(--green); font-size: 11px; font-weight: bold; }
.approval-gate .gate-desc { color: var(--text-secondary); font-size: 11px; margin-top: 4px; }
.approval-gate .gate-actions { display: flex; gap: 6px; margin-top: 6px; }
.gate-btn {
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 11px;
  border: none;
  cursor: pointer;
  font-weight: bold;
}
.gate-btn.approve { background: var(--green); color: white; }
.gate-btn.reject { background: #fef2f2; color: var(--red); border: 1px solid #fecaca; }
.gate-btn.diff { background: var(--bg-tertiary); color: var(--text-secondary); }

/* Chat input */
#chat-input-area { padding: 10px 16px; border-top: 1px solid var(--border); }
#chat-attachments { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
#chat-attachments:empty { display: none; }
.pending-attachment {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-tertiary);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  color: var(--text-secondary);
}
.pending-attachment .remove-attach { cursor: pointer; color: var(--red); margin-left: 4px; }
#chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-primary);
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 8px;
}
#chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  resize: none;
  outline: none;
  font-family: inherit;
  max-height: 120px;
}
#chat-toolbar { display: flex; gap: 4px; }
.toolbar-btn {
  background: var(--bg-tertiary);
  border: none;
  padding: 5px 8px;
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
}
.toolbar-btn:hover { color: var(--text-primary); }
.send-btn {
  background: var(--orange);
  border: none;
  padding: 6px 16px;
  border-radius: 9999px;
  color: white;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
}
.send-btn:hover { opacity: 0.9; }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.stop-btn {
  background: var(--red);
  border: none;
  padding: 6px 16px;
  border-radius: 9999px;
  color: white;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
}
.stop-btn.hidden { display: none; }
.stop-btn:hover { opacity: 0.9; }

/* Image expand overlay */
.image-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  cursor: pointer;
}
.image-overlay img { max-width: 90vw; max-height: 90vh; border-radius: 8px; }

/* ===== Modal ===== */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}
.modal.hidden { display: none; }
.modal-content {
  background: var(--bg-primary);
  border-radius: 12px;
  padding: 24px;
  width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}
.modal-content h2 { margin-bottom: 16px; font-size: 18px; }
.form-field { margin-bottom: 14px; }
.form-field label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.form-field input, .form-field select {
  width: 100%;
  padding: 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}
.form-field input:focus { border-color: var(--orange); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.form-btn {
  padding: 8px 20px;
  border-radius: 6px;
  border: none;
  font-size: 13px;
  cursor: pointer;
}
.form-btn.primary { background: var(--orange); color: white; font-weight: bold; border-radius: 9999px; }
.form-btn.secondary { background: var(--bg-tertiary); color: var(--text-secondary); }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }
