:root {
  --bg: #0b0e14;
  --panel: #10141c;
  --card: #161b25;
  --card-hover: #1d2432;
  --border: #262d3a;
  --border-soft: #1e2531;
  --text: #e6edf3;
  --muted: #8b98a9;
  --faint: #667385;
  --green: #3fb950;
  --red: #f85149;
  --yellow: #d29922;
  --blue: #58a6ff;
  --priority: #ef0155;
  --violet: #a371f7;
  --radius: 9px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  flex: none;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand h1 { font-size: 16px; font-weight: 650; margin: 0; letter-spacing: -0.01em; }
.repo { color: var(--muted); font-size: 12.5px; text-decoration: none; }
.repo:hover { color: var(--blue); text-decoration: underline; }

.controls { display: flex; align-items: center; gap: 10px; margin-left: auto; flex-wrap: wrap; }

.search {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 6px 10px;
  width: 260px;
  font: inherit;
  font-size: 13px;
}
.search:focus, .select:focus, .btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.search::placeholder { color: var(--faint); }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.toggle:hover { color: var(--text); }
.toggle input { accent-color: var(--blue); margin: 0; cursor: pointer; }
.toggle .count { color: var(--faint); font-variant-numeric: tabular-nums; }

.select, .btn {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.btn:hover, .select:hover { background: var(--card-hover); border-color: #37414f; }
.btn[disabled] { opacity: 0.55; cursor: default; }

.meta { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; min-width: 108px; }

.banner {
  background: rgba(248, 81, 73, 0.12);
  border-bottom: 1px solid rgba(248, 81, 73, 0.35);
  color: #ffb3ae;
  padding: 9px 18px;
  font-size: 13px;
  white-space: pre-wrap;
  flex: none;
}

/* ---------- board ---------- */
.board {
  display: grid;
  grid-template-columns: repeat(5, minmax(230px, 1fr));
  gap: 14px;
  padding: 14px 18px 18px;
  flex: 1;
  min-height: 0;
  overflow-x: auto;
}

.col {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  min-height: 0;
  min-width: 260px;
}

.col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  flex: none;
}
.col-head .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.col-head .n {
  margin-left: auto;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 20px;
  padding: 1px 8px;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.col[data-col="todo"]    .dot { background: #7d8590; }
.col[data-col="rereview"] .dot { background: var(--violet); }
.col[data-col="partial"] .dot { background: var(--blue); }
.col[data-col="ready"]   .dot { background: var(--green); }
.col[data-col="blocked"] .dot { background: var(--red); }

.col-body {
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: #2c3543 transparent;
}
.col-body::-webkit-scrollbar { width: 9px; }
.col-body::-webkit-scrollbar-thumb { background: #2c3543; border-radius: 20px; border: 2px solid var(--panel); }

.empty { color: var(--faint); font-size: 12.5px; text-align: center; padding: 18px 6px; font-style: italic; }

/* ---------- card ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 11px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.08s;
}
.card:hover { background: var(--card-hover); border-color: #3a4553; }
.card:active { transform: translateY(1px); }
.card:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

.card.priority {
  border-left: 3px solid var(--priority);
  background: linear-gradient(90deg, rgba(239, 1, 85, 0.11), transparent 62%), var(--card);
}
.card.priority:hover {
  background: linear-gradient(90deg, rgba(239, 1, 85, 0.17), transparent 62%), var(--card-hover);
}
.card.draft { opacity: 0.78; }

.card-top { display: flex; align-items: baseline; gap: 7px; margin-bottom: 3px; }
.state-icon {
  flex: none;
  align-self: flex-start;   /* stay on the first line of a wrapping title */
  margin-top: 2px;
}
.state-icon.open { fill: var(--green); }
.state-icon.draft { fill: var(--muted); }
.num { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; flex: none; }
.title { font-size: 13.2px; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }

.card-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--faint);
  font-size: 11.5px;
  margin-bottom: 7px;
  flex-wrap: wrap;
}
.diff .plus { color: #3fb950; }
.diff .minus { color: #f85149; }

.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chips:not(:empty) { margin-top: 6px; }

.chip {
  font-size: 11px;
  line-height: 1.6;
  padding: 0 7px;
  border-radius: 20px;
  border: 1px solid transparent;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.chip.approve { background: rgba(63, 185, 80, 0.15); border-color: rgba(63, 185, 80, 0.4); color: #56d364; }
.chip.changes { background: rgba(248, 81, 73, 0.15); border-color: rgba(248, 81, 73, 0.4); color: #ff8781; }
.chip.conflict { background: rgba(210, 153, 34, 0.15); border-color: rgba(210, 153, 34, 0.4); color: #e3b341; }
.chip.prio {
  background: rgba(239, 1, 85, 0.2);
  border-color: rgba(239, 1, 85, 0.55);
  color: #ff5c8a;
  font-weight: 650;
  letter-spacing: 0.03em;
}
.chip.draft { background: #21262d; border-color: var(--border); color: var(--muted); }

a.chip.ci { text-decoration: none; cursor: pointer; }
a.chip.ci:hover { filter: brightness(1.25); text-decoration: underline; }
.chip.ci.failing { background: rgba(248, 81, 73, 0.15); border-color: rgba(248, 81, 73, 0.4); color: #ff8781; }
.chip.ci.pending { background: rgba(210, 153, 34, 0.15); border-color: rgba(210, 153, 34, 0.4); color: #e3b341; }
.chip.ci.passing { background: rgba(63, 185, 80, 0.12); border-color: rgba(63, 185, 80, 0.3); color: #56d364; }

@media (max-width: 1100px) {
  .board { grid-template-columns: repeat(5, minmax(230px, 1fr)); }
  .search { width: 180px; }
}

.demo-flag {
  background: rgba(210, 153, 34, 0.16);
  border: 1px solid rgba(210, 153, 34, 0.5);
  color: #e3b341;
  border-radius: 20px;
  padding: 1px 8px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: help;
}

.chip.rereview {
  background: rgba(163, 113, 247, 0.16);
  border-color: rgba(163, 113, 247, 0.45);
  color: #c297ff;
}

/* ---------- dropdown ---------- */
.dropdown { position: relative; }
.btn.active { border-color: rgba(88, 166, 255, 0.6); color: var(--blue); }

.menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  width: 250px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.menu-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 11.5px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.linkbtn {
  background: none;
  border: none;
  color: var(--blue);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
  padding: 0;
  text-transform: none;
  letter-spacing: 0;
}
.linkbtn:hover { text-decoration: underline; }
.menu-head .linkbtn:first-of-type { margin-left: auto; }

.menu-list { max-height: 320px; overflow-y: auto; padding: 4px; scrollbar-width: thin; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12.5px;
  user-select: none;
}
.menu-item:hover { background: var(--card-hover); }
.menu-item input { accent-color: var(--blue); margin: 0; cursor: pointer; flex: none; }
.menu-item .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item .n {
  margin-left: auto;
  color: var(--faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  flex: none;
}
.toggle.disabled { opacity: 0.45; cursor: not-allowed; }
.toggle.disabled input { cursor: not-allowed; }
