:root {
  --bg: #0f1115;
  --panel: #161a22;
  --panel-2: #1d222c;
  --border: #2a3140;
  --text: #e7eaf0;
  --muted: #8b95a7;
  --accent: #5b9dff;
  --waiting: #9aa4b8;
  --progress: #f0ad4e;
  --done: #4caf7d;
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.topbar h1 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.02em;
}

.meta {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}

button {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}
button:hover { background: #232936; }

.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 20px;
  max-width: 1600px;
  margin: 0 auto;
}

.column {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
}

.column header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.column h2 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0;
}

.count {
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.column[data-bucket="waiting"] h2 { color: var(--waiting); }
.column[data-bucket="in_progress"] h2 { color: var(--progress); }
.column[data-bucket="done"] h2 { color: var(--done); }

.cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  flex: 1;
}

.card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.card .project {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.card .name {
  font-size: 14px;
  font-weight: 600;
  margin: 4px 0 6px;
  line-height: 1.3;
}

.card .desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card .footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
}

.card .progress {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.bar {
  width: 60px;
  height: 6px;
  background: #232936;
  border-radius: 3px;
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.empty {
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
  padding: 12px;
  text-align: center;
}

.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); }
.modal-panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: min(900px, 92vw);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}
.modal-panel header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-panel header h2 { font-size: 16px; margin: 0; }
.modal-panel .close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}
.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
}

.story {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--panel-2);
}
.story .row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}
.story .id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--muted);
}
.story .title { font-weight: 600; font-size: 13px; }
.story .pass { font-size: 11px; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--border); }
.story .pass.yes { color: var(--done); border-color: var(--done); }
.story .pass.no { color: var(--muted); }
.story ul { margin: 6px 0 0 18px; padding: 0; color: var(--muted); font-size: 12px; }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 14px; margin-bottom: 14px; font-size: 13px; }
.kv .k { color: var(--muted); }

.raw {
  background: #0a0d12;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-x: auto;
  max-height: 300px;
  overflow-y: auto;
}

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