:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --muted: #888;
  --accent: #7c6af7;
  --before: #e05252;
  --after: #52c07a;
  --font: system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, 'Cascadia Code', monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  padding-top: 5.5rem;
}

/* ─── Banner ─────────────────────────────────────────────────── */
.board-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.board-banner .badge {
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.68rem;
}

.board-banner .badge-before {
  background: #3a1a1a;
  color: var(--before);
  border: 1px solid #5a2a2a;
}

.board-banner .badge-after {
  background: #1a3a28;
  color: var(--after);
  border: 1px solid #2a5a3a;
}

.board-banner .reflow-time {
  font-weight: 700;
  color: var(--text);
  transition: color 0.2s;
}

.board-banner .reflow-time.slow { color: var(--before); }
.board-banner .reflow-time.fast { color: var(--after); }

.board-banner .hint {
  margin-left: auto;
  font-size: 0.65rem;
  color: #555;
}

/* ─── Board ──────────────────────────────────────────────────── */
.kanban-board {
  display: flex;
  gap: 0.875rem;
  padding: 1rem 1.25rem 2rem;
  overflow-x: auto;
  min-height: calc(100vh - 7rem);
  align-items: flex-start;
}

/* ─── Column ─────────────────────────────────────────────────── */
.kanban-column {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.875rem;
  width: 252px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.125rem;
  padding-bottom: 0.625rem;
  border-bottom: 1px solid var(--border);
}

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

.column-count {
  font-size: 0.65rem;
  font-family: var(--mono);
  font-weight: 700;
  background: #222;
  color: var(--muted);
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  min-width: 1.8rem;
  text-align: center;
}

/* ─── Card ───────────────────────────────────────────────────── */
.kanban-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2), 0 0 0 0 transparent;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.kanban-card:focus-within {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(124,106,247,0.15);
}

.card-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.55rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
}

.card-id {
  font-size: 0.58rem;
  font-family: var(--mono);
  color: #555;
  flex: 1;
}

.priority-badge {
  font-size: 0.56rem;
  font-weight: 700;
  padding: 0.1rem 0.38rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.priority-low      { background: #1a2a1a; color: #52c07a; border: 1px solid #2a4a2a; }
.priority-medium   { background: #2a2a1a; color: #f0a04a; border: 1px solid #4a4a2a; }
.priority-high     { background: #3a1a1a; color: #e05252; border: 1px solid #5a2a2a; }
.priority-critical { background: #3a1a2a; color: #c07aff; border: 1px solid #5a2a4a; }

.card-title {
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text);
  background: none;
  border: none;
  outline: none;
  resize: none;
  width: 100%;
  font-family: var(--font);
  overflow: hidden;
  padding: 0;
  margin: 0;
  min-height: 2.3em;
}

.card-title:focus {
  background: rgba(124,106,247,0.05);
  border-radius: 4px;
  padding: 0.2rem;
  margin: -0.2rem;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.tag {
  font-size: 0.58rem;
  padding: 0.1rem 0.38rem;
  border-radius: 3px;
  font-weight: 600;
}

.tag-frontend  { background: #1a2a3a; color: #7ab8f0; border: 1px solid #2a3a5a; }
.tag-backend   { background: #1a3a2a; color: #7af0a0; border: 1px solid #2a5a3a; }
.tag-api       { background: #2a1a3a; color: #b07af0; border: 1px solid #3a2a5a; }
.tag-design    { background: #3a2a1a; color: #f0b07a; border: 1px solid #5a3a2a; }
.tag-infra     { background: #1a3a3a; color: #7af0f0; border: 1px solid #2a5a5a; }
.tag-testing   { background: #3a3a1a; color: #e8e87a; border: 1px solid #5a5a2a; }
.tag-perf      { background: #3a1a1a; color: #f07a7a; border: 1px solid #5a2a2a; }
.tag-security  { background: #2a1a1a; color: #f0a07a; border: 1px solid #4a2a2a; }
.tag-mobile    { background: #1a1a3a; color: #7a7af0; border: 1px solid #2a2a5a; }
.tag-docs      { background: #222;    color: #888;    border: 1px solid #333;    }

.card-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-progress {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.progress-bar {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
}

.progress-label {
  font-size: 0.56rem;
  font-family: var(--mono);
  color: #555;
  min-width: 2.2em;
  text-align: right;
}

.card-due {
  font-size: 0.56rem;
  font-family: var(--mono);
  color: #555;
  flex-shrink: 0;
}

/* ─── Light theme ────────────────────────────────────────────── */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f8f8f8;
    --surface: #ffffff;
    --border: #e2e2e2;
    --text: #111111;
    --muted: #777777;
    --accent: #6c5ce7;
    --before: #c94040;
    --after: #389a5e;
  }

  :root:not([data-theme="dark"]) .column-count { background: #f5f5f5; }
  :root:not([data-theme="dark"]) .kanban-card { box-shadow: 0 1px 4px rgba(0,0,0,0.07); }

  :root:not([data-theme="dark"]) .priority-low      { background: #eef8ee; color: #389a5e; border-color: #c8e8d0; }
  :root:not([data-theme="dark"]) .priority-medium   { background: #fff8ee; color: #c87a20; border-color: #e8d8b8; }
  :root:not([data-theme="dark"]) .priority-high     { background: #fff0ee; color: #c94040; border-color: #f5b8b8; }
  :root:not([data-theme="dark"]) .priority-critical { background: #f8eeff; color: #8040c0; border-color: #d8b8f0; }

  :root:not([data-theme="dark"]) .tag-frontend  { background: #eef4ff; color: #3a7ad0; border-color: #b8d0f0; }
  :root:not([data-theme="dark"]) .tag-backend   { background: #eef8f0; color: #2a7a50; border-color: #b8d8c0; }
  :root:not([data-theme="dark"]) .tag-api       { background: #f4eeff; color: #6040c0; border-color: #d0b8f0; }
  :root:not([data-theme="dark"]) .tag-design    { background: #fff4ee; color: #c07020; border-color: #f0d0b8; }
  :root:not([data-theme="dark"]) .tag-infra     { background: #eef8ff; color: #2070a0; border-color: #b8d8f0; }
  :root:not([data-theme="dark"]) .tag-testing   { background: #f8f8ee; color: #707020; border-color: #e0e0b8; }
  :root:not([data-theme="dark"]) .tag-perf      { background: #fff0f0; color: #c04040; border-color: #f0c8c8; }
  :root:not([data-theme="dark"]) .tag-security  { background: #fff4ee; color: #a05030; border-color: #f0c8b0; }
  :root:not([data-theme="dark"]) .tag-mobile    { background: #eeeefc; color: #4040c0; border-color: #c8c8f0; }
  :root:not([data-theme="dark"]) .tag-docs      { background: #f5f5f5; color: #777;    border-color: #ddd;    }

  :root:not([data-theme="dark"]) .board-banner .badge-before { background: #fde8e8; border-color: #f5b8b8; }
  :root:not([data-theme="dark"]) .board-banner .badge-after  { background: #e8f5ee; border-color: #b8e5c8; }
}

html[data-theme="light"] {
  --bg: #f8f8f8;
  --surface: #ffffff;
  --border: #e2e2e2;
  --text: #111111;
  --muted: #777777;
  --accent: #6c5ce7;
  --before: #c94040;
  --after: #389a5e;
}

html[data-theme="light"] .column-count { background: #f5f5f5; }
html[data-theme="light"] .kanban-card { box-shadow: 0 1px 4px rgba(0,0,0,0.07); }
html[data-theme="light"] .priority-low      { background: #eef8ee; color: #389a5e; border-color: #c8e8d0; }
html[data-theme="light"] .priority-medium   { background: #fff8ee; color: #c87a20; border-color: #e8d8b8; }
html[data-theme="light"] .priority-high     { background: #fff0ee; color: #c94040; border-color: #f5b8b8; }
html[data-theme="light"] .priority-critical { background: #f8eeff; color: #8040c0; border-color: #d8b8f0; }
html[data-theme="light"] .tag-frontend  { background: #eef4ff; color: #3a7ad0; border-color: #b8d0f0; }
html[data-theme="light"] .tag-backend   { background: #eef8f0; color: #2a7a50; border-color: #b8d8c0; }
html[data-theme="light"] .tag-api       { background: #f4eeff; color: #6040c0; border-color: #d0b8f0; }
html[data-theme="light"] .tag-design    { background: #fff4ee; color: #c07020; border-color: #f0d0b8; }
html[data-theme="light"] .tag-infra     { background: #eef8ff; color: #2070a0; border-color: #b8d8f0; }
html[data-theme="light"] .tag-testing   { background: #f8f8ee; color: #707020; border-color: #e0e0b8; }
html[data-theme="light"] .tag-perf      { background: #fff0f0; color: #c04040; border-color: #f0c8c8; }
html[data-theme="light"] .tag-security  { background: #fff4ee; color: #a05030; border-color: #f0c8b0; }
html[data-theme="light"] .tag-mobile    { background: #eeeefc; color: #4040c0; border-color: #c8c8f0; }
html[data-theme="light"] .tag-docs      { background: #f5f5f5; color: #777;    border-color: #ddd;    }
html[data-theme="light"] .board-banner .badge-before { background: #fde8e8; border-color: #f5b8b8; }
html[data-theme="light"] .board-banner .badge-after  { background: #e8f5ee; border-color: #b8e5c8; }
