:root {
  --bg: #0b1020;
  --bg-2: #0f152b;
  --panel: #131a33;
  --panel-2: #1a2243;
  --border: #243056;
  --text: #e7ecff;
  --muted: #94a3c4;
  --accent: #7c5cff;
  --accent-2: #5b7cff;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --cyan: #06b6d4;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 600px at 10% -10%, #1b2350 0%, transparent 60%),
              radial-gradient(900px 500px at 110% 10%, #2a1b54 0%, transparent 55%),
              var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

a { color: var(--accent-2); }

button {
  cursor: pointer;
  font: inherit;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 10px;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
button:hover { background: var(--panel-2); }
button:active { transform: translateY(1px); }
button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: white;
  font-weight: 600;
}
button.primary:hover { filter: brightness(1.08); }
button.ghost { background: transparent; }
button.danger { background: transparent; border-color: rgba(239,68,68,0.4); color: #ffb4b4; }
button.danger:hover { background: rgba(239,68,68,0.1); }
button.icon { padding: 4px 10px; font-size: 18px; line-height: 1; }

input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124,92,255,0.18);
}
textarea { resize: vertical; }
label { display: block; color: var(--muted); font-size: 12px; }
label > input, label > select, label > textarea, label > div { margin-top: 4px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 16, 32, 0.6);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center;
  font-weight: 800; letter-spacing: 0.5px;
  box-shadow: var(--shadow);
}
.brand-text h1 { margin: 0; font-size: 16px; letter-spacing: 0.3px; }
.brand-text .tagline { font-size: 11px; color: var(--muted); }
.who { display: flex; align-items: center; gap: 8px; }
.who select { width: auto; min-width: 130px; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 24px 0;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 2px; }
.stat .accent-bar {
  position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(var(--accent), var(--accent-2));
}
.stat.green .accent-bar { background: var(--green); }
.stat.amber .accent-bar { background: var(--amber); }
.stat.red .accent-bar { background: var(--red); }

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px;
}
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.filters label { min-width: 130px; }
.filters input[type="search"] { min-width: 220px; margin-top: 16px; }

main { padding: 0 24px 80px; }

.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 1100px) { .board { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stats { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 640px) { .board { grid-template-columns: 1fr; } .stats { grid-template-columns: 1fr; } .toolbar { flex-direction: column; align-items: stretch; } }

.col {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 200px;
}
.col > header {
  padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.col[data-status="todo"] > header { color: #cdd6ff; }
.col[data-status="in_progress"] > header { color: #ffd9a8; }
.col[data-status="blocked"] > header { color: #ffb4b4; }
.col[data-status="done"] > header { color: #b6f1c8; }
.col .count {
  background: var(--panel-2);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
}
.col-body {
  padding: 10px;
  display: flex; flex-direction: column; gap: 10px;
  flex: 1;
  min-height: 80px;
}
.col-body.drag-over { outline: 2px dashed var(--accent); outline-offset: -6px; border-radius: 12px; }

.task {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  cursor: grab;
  transition: transform 0.08s, border-color 0.15s;
}
.task:hover { border-color: var(--accent); }
.task.dragging { opacity: 0.5; }
.task .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.task .title { font-weight: 600; line-height: 1.25; }
.task .meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; color: var(--muted); font-size: 12px; }

.priority { padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.priority.low { background: rgba(34,197,94,0.12); color: #a5f0bd; }
.priority.medium { background: rgba(124,92,255,0.18); color: #d3c8ff; }
.priority.high { background: rgba(245,158,11,0.16); color: #ffd591; }
.priority.urgent { background: rgba(239,68,68,0.18); color: #ffb4b4; }

.due { font-variant-numeric: tabular-nums; }
.due.overdue { color: #ffb4b4; }
.due.soon { color: #ffd591; }

.avatars { display: inline-flex; }
.avatars .avatar { margin-left: -6px; }
.avatars .avatar:first-child { margin-left: 0; }
.avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: inline-grid; place-items: center;
  background: var(--accent);
  color: white; font-size: 11px; font-weight: 700;
  border: 2px solid var(--panel-2);
}

.progress {
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  margin-top: 10px;
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 999px;
  transition: width 0.25s ease;
}
.progress.done > span { background: linear-gradient(90deg, var(--green), #16a34a); }
.progress-row {
  display: flex; align-items: center; gap: 8px; margin-top: 8px;
}
.progress-row input[type="range"] { flex: 1; padding: 0; background: transparent; border: none; }
.progress-row .pct { font-variant-numeric: tabular-nums; color: var(--muted); width: 36px; text-align: right; }

.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tag {
  font-size: 11px; padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  background: rgba(255,255,255,0.02);
}

.list-view { display: flex; flex-direction: column; gap: 10px; }
.list-view .task { cursor: pointer; }

.modal {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0;
  width: min(680px, 92vw);
  box-shadow: var(--shadow);
}
.modal::backdrop { background: rgba(2,4,15,0.65); backdrop-filter: blur(4px); }
.modal form { padding: 18px 20px; }
.modal header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal header h2 { margin: 0; font-size: 16px; }
.modal footer { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.modal footer .grow { flex: 1; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid .span-2 { grid-column: span 2; }
.percent-row { display: flex; align-items: center; gap: 10px; }
.percent-row output { color: var(--muted); width: 44px; text-align: right; font-variant-numeric: tabular-nums; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 6px; min-height: 38px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}
.chip.selected {
  border-color: var(--accent);
  background: rgba(124,92,255,0.18);
}

.member-list { list-style: none; padding: 0; margin: 0 0 12px; max-height: 50vh; overflow: auto; }
.member-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  background: var(--panel-2);
}
.member-list .swatch { width: 14px; height: 14px; border-radius: 50%; }
.member-list .grow { flex: 1; }
.add-member { display: grid; grid-template-columns: 1fr 60px auto; gap: 8px; }
.add-member input[type="color"] { padding: 0; height: 36px; }

.task-detail { display: flex; flex-direction: column; gap: 10px; }
.comments { display: flex; flex-direction: column; gap: 8px; max-height: 28vh; overflow: auto; padding-right: 4px; }
.comment {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
}
.comment .who { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.comment .text { margin-top: 4px; white-space: pre-wrap; }
.comment-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 10;
}

.empty {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 30px;
  text-align: center;
  color: var(--muted);
}
