:root {
  color-scheme: light dark;
  --ok: #1ea672;
  --warn: #d28f00;
  --bad: #c53333;
  --muted: #667085;
  --accent: #3b82f6;
}

body {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  margin: 0;
  padding: 1rem;
  max-width: 1400px;
  margin-inline: auto;
}

.board-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.board-controls .repo-chips {
  margin-bottom: 0;
}

.board-controls .filter-bar {
  margin-bottom: 0;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  align-items: end;
  gap: 0.5rem;
}

.toolbar-left input {
  width: 220px;
}

button {
  padding: 0.55rem 0.9rem;
  border-radius: 10px;
  border: 1px solid #999;
  cursor: pointer;
  background: transparent;
}

button:hover {
  background: #8881;
}

#addTaskBtn {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

#addTaskBtn:hover {
  opacity: 0.9;
}

/* Repo chips */
.repo-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid #8884;
  font-size: 0.85rem;
}

.chip.repo-filter {
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, color 0.15s;
}

.chip.repo-filter.active {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.chip.repo-filter .chip-label {
  cursor: pointer;
}

.chip .remove-chip {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: var(--muted);
}

/* Filter bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.last-synced {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--muted);
}

.filter-btn {
  font-size: 0.85rem;
  padding: 0.35rem 0.75rem;
}

.filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Board */
.board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  align-items: start;
}

@media (max-width: 900px) {
  .board {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 500px) {
  .board {
    grid-template-columns: 1fr;
  }
}

.board-column {
  background: #f6f8fa;
  border-radius: 12px;
  padding: 0.6rem;
  min-height: 120px;
}

@media (prefers-color-scheme: dark) {
  .board-column {
    background: #161b22;
  }
}

.column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  padding: 0 0.3rem;
}

.column-title {
  font-weight: 700;
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.column-count {
  font-size: 0.78rem;
  font-weight: 600;
  background: #8883;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
}

.column-cards {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Task cards */
.task-card {
  border: 1px solid #8884;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: #fff;
}

@media (prefers-color-scheme: dark) {
  .task-card {
    background: #0d1117;
  }
}

.task-card.closed {
  opacity: 0.6;
}

.task-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 0.3rem;
}

.task-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
}

.assignee-badge {
  font-size: 0.75rem;
  color: var(--muted);
}

.task-title {
  font-weight: 600;
  margin: 0;
  font-size: 1rem;
}

.task-title a {
  color: inherit;
  text-decoration: none;
}

.task-title a:hover {
  text-decoration: underline;
}

.task-number {
  color: var(--muted);
  font-size: 0.85rem;
}

.task-meta {
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.task-body {
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 0.2rem;
  white-space: pre-wrap;
  max-height: 60px;
  overflow: hidden;
}

.repo-badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-weight: 500;
}

.state-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

.state-badge.open {
  background: #dcfce7;
  color: #166534;
}

.state-badge.closed {
  background: #e5e7eb;
  color: #374151;
}

.label-badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  margin-right: 0.2rem;
}

/* Dialog */
dialog {
  width: min(520px, 95vw);
  border-radius: 14px;
  border: 1px solid #8886;
}

label {
  display: block;
  margin-top: 0.7rem;
  font-size: 0.9rem;
}

input, select, textarea {
  width: 100%;
  padding: 0.5rem;
  border-radius: 8px;
  border: 1px solid #999;
  margin-top: 0.2rem;
  box-sizing: border-box;
  font-family: inherit;
}

menu {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0;
}

#createTaskBtn {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.hint {
  font-size: 0.86rem;
  color: var(--muted);
}

.loading {
  text-align: center;
  color: var(--muted);
  padding: 2rem;
}

.hidden { display: none; }
