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

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --green: #2ea043;
  --red: #f85149;
  --purple: #bc8cff;
  --orange: #d29922;
  --tobi: #1f3a5f;
  --tobi-text: #79c0ff;
  --claw: #2a1f3f;
  --claw-text: #bc8cff;
  --prio1: #f85149;
  --prio2: #d29922;
  --prio3: #58a6ff;
  --prio4: #8b949e;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Top Nav */
.top-nav {
  display: flex; align-items: center; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  height: 44px; gap: 0;
}

.top-nav .logo {
  font-size: 14px; font-weight: 700; margin-right: 20px;
  color: var(--text); text-decoration: none; white-space: nowrap;
}

.top-nav .logo span { color: var(--accent); }

.top-nav a {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px; color: var(--text-dim); text-decoration: none;
  font-size: 13px; font-weight: 500; border-bottom: 2px solid transparent;
  height: 44px; transition: color 0.1s;
}

.top-nav a:hover { color: var(--text); }
.top-nav a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
  flex-wrap: wrap;
}

.header h1 { font-size: 18px; font-weight: 600; white-space: nowrap; }
.header h1 span { color: var(--accent); }

.header-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.header-actions select {
  padding: 6px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  max-width: 120px;
}

.view-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.view-toggle button {
  padding: 5px 10px;
  background: var(--surface);
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
}

.view-toggle button.active {
  background: var(--border);
  color: var(--text);
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
}

/* Quick Add */
.quick-add {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: center;
}

.quick-add input[type="text"] {
  flex: 1;
  min-width: 150px;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.quick-add input[type="text"]:focus { border-color: var(--accent); }

.quick-add input[type="date"] {
  padding: 6px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  color-scheme: dark;
}

.quick-add select {
  padding: 7px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}

.quick-add button {
  padding: 7px 14px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.quick-add button:hover { background: var(--accent-hover); }

/* Board */
.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  min-height: calc(100vh - 154px);
}

.column {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.column:last-child { border-right: none; }

.column-header {
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.column-header .count {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
}

.column-header .dot { width: 8px; height: 8px; border-radius: 50%; }
.column[data-state="todo"] .dot { background: var(--text-dim); }
.column[data-state="doing"] .dot { background: var(--accent); }
.column[data-state="done"] .dot { background: var(--green); }

.column-body {
  flex: 1;
  padding: 8px;
  overflow-y: auto;
  min-height: 100px;
}

.column-body.drag-over { background: rgba(88, 166, 255, 0.05); }

/* Story Card */
.story-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}

.story-header {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  flex-wrap: wrap;
}

.story-header:hover { background: rgba(88, 166, 255, 0.05); }

.type-icon { font-size: 14px; }

.story-title {
  font-size: 13px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
}

.story-tasks {
  border-top: 1px solid var(--border);
  padding: 4px 8px;
}

/* Task Card */
.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
  cursor: grab;
  transition: border-color 0.15s;
  position: relative;
}

.task-card:hover { border-color: var(--accent); }
.task-card.dragging { opacity: 0.5; }

.task-card.child-task {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  margin-bottom: 0;
  padding: 6px 4px;
}

.task-card.child-task:last-child { border-bottom: none; }

.task-card .prio-bar {
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
}

.child-task .prio-bar { display: none; }

.task-card[data-prio="1"] .prio-bar { background: var(--prio1); }
.task-card[data-prio="2"] .prio-bar { background: var(--prio2); }
.task-card[data-prio="3"] .prio-bar { background: var(--prio3); }
.task-card[data-prio="4"] .prio-bar { background: var(--prio4); }

.task-main {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding-left: 8px;
}

.child-task .task-main { padding-left: 0; }

.task-check {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 1px;
}

.task-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  flex: 1;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 32px;
  margin-top: 4px;
}

.child-task .task-meta { padding-left: 24px; }

.task-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: none;
  gap: 2px;
}

.task-card:hover .task-actions { display: flex; }

.task-actions button {
  width: 22px;
  height: 22px;
  border: none;
  background: var(--bg);
  color: var(--text-dim);
  border-radius: 4px;
  cursor: pointer;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.task-actions button:hover { color: var(--text); background: var(--border); }

/* Badges */
.badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.badge-tobi { background: var(--tobi); color: var(--tobi-text); }
.badge-claw { background: var(--claw); color: var(--claw-text); }
.badge-unassigned { background: var(--surface); color: var(--text-dim); border: 1px solid var(--border); }

/* Due dates */
.due-date {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}

.due-date.overdue { color: var(--red); font-weight: 600; }
.overdue { color: var(--red); }

.done-text { text-decoration: line-through; color: var(--text-dim); }

.progress {
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* List View */
.list-view { padding: 8px 16px; }

.list-story {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}

.list-story-header {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  flex-wrap: wrap;
}

.list-story-header:hover { background: rgba(88, 166, 255, 0.05); }

.list-area {
  font-size: 10px;
  color: var(--text-dim);
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.list-tasks { border-top: 1px solid var(--border); }

.list-task {
  padding: 8px 12px 8px 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  cursor: pointer;
}

.list-task:last-child { border-bottom: none; }
.list-task:hover { background: rgba(88, 166, 255, 0.03); }

.list-task span:first-of-type { flex: 1; }

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  width: min(480px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
}

.modal h2 { font-size: 15px; margin-bottom: 12px; }

.modal label {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 4px;
  margin-top: 10px;
}

.modal input, .modal select, .modal textarea {
  width: 100%;
  padding: 7px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}

.modal input[type="date"] { color-scheme: dark; }
.modal textarea { min-height: 70px; resize: vertical; }

.modal-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  justify-content: flex-end;
}

.modal-actions button {
  padding: 7px 14px;
  border-radius: 6px;
  border: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-danger { background: var(--red); color: #fff; }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
}

.status-dot.error { background: var(--red); }
.empty-state { padding: 20px; text-align: center; color: var(--text-dim); font-size: 13px; }

@keyframes spin { to { transform: rotate(360deg); } }
.refreshing { animation: spin 0.6s linear infinite; }

/* Mobile */
@media (max-width: 768px) {
  .board { grid-template-columns: 1fr; }
  .column { border-right: none; border-bottom: 1px solid var(--border); }
  .column-body { min-height: 60px; }
  .task-actions { display: flex; }
  .header { padding: 10px 12px; }
  .quick-add { padding: 8px 12px; }
  .modal-row { grid-template-columns: 1fr; }
  .header-actions select { max-width: 90px; font-size: 11px; }
}
