:root {
  color-scheme: dark;
  --bg: #14161a;
  --panel: #1e2127;
  --panel-2: #262a32;
  --border: #333944;
  --text: #eee;
  --muted: #9aa1ac;
  --accent: #4a7cff;
  --danger: #e05555;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
}

header h1 { font-size: 1.1rem; margin: 0; }

button {
  border: none;
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  font-size: 0.95rem;
  cursor: pointer;
  background: var(--panel-2);
  color: var(--text);
}

button.primary { background: var(--accent); color: white; }
button.danger { background: var(--danger); color: white; }
button:disabled { opacity: 0.5; cursor: default; }

main#board {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  overflow-x: auto;
  align-items: flex-start;
}

.column {
  background: var(--panel);
  border-radius: 12px;
  min-width: 260px;
  max-width: 300px;
  flex: 1 0 260px;
  padding: 0.6rem;
  max-height: calc(100vh - 90px);
  display: flex;
  flex-direction: column;
}

.column h2 {
  font-size: 0.9rem;
  margin: 0.2rem 0.3rem 0.6rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}

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

.card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  cursor: pointer;
}

.card .card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.4rem; }
.card .title { font-weight: 600; font-size: 0.95rem; margin-bottom: 0.3rem; flex: 1; }
.card .meta { display: flex; flex-wrap: wrap; gap: 0.3rem; font-size: 0.78rem; color: var(--muted); }
.card .chip { background: #33394a; color: #cfd6ff; border-radius: 999px; padding: 0.1rem 0.5rem; }
.card .due { color: #ffb84a; }

.card .move-row {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  gap: 0.3rem;
}
.card .move-row button { flex: 1; padding: 0.3rem; font-size: 1rem; }

.drag-handle {
  touch-action: none;
  cursor: grab;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
  user-select: none;
  flex-shrink: 0;
}
.drag-handle:active { cursor: grabbing; background: var(--panel); }

.card.dragging-source { opacity: 0.35; }

.card-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 50;
  opacity: 0.92;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transform-origin: top left;
}

.card-placeholder {
  border: 2px dashed var(--accent);
  border-radius: 10px;
  background: rgba(74, 124, 255, 0.1);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  padding: 1rem;
}
.modal.hidden { display: none; }

.modal-content {
  background: var(--panel);
  border-radius: 12px;
  padding: 1.2rem;
  width: min(92vw, 420px);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content h2 { margin-top: 0; font-size: 1.05rem; }

.modal-content label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.7rem 0 0.25rem;
}

.modal-content input, .modal-content textarea, .modal-content select {
  width: 100%;
  padding: 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0f1114;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
}

#client-results {
  margin-top: 0.3rem;
  max-height: 140px;
  overflow-y: auto;
}
#client-results .option {
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
}
#client-results .option:hover { background: var(--panel-2); }

.chip { display: inline-flex; align-items: center; gap: 0.4rem; background: #33394a; color: #cfd6ff; border-radius: 999px; padding: 0.25rem 0.7rem; margin-top: 0.4rem; font-size: 0.85rem; }
.chip button { background: none; padding: 0; color: inherit; font-size: 0.9rem; line-height: 1; }
.chip.hidden { display: none; }

.modal-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.1rem;
}
.modal-actions button { flex: 1; }

.err { color: #ff6b6b; font-size: 0.85rem; margin-top: 0.6rem; min-height: 1.2em; }

.empty { color: var(--muted); font-size: 0.85rem; padding: 0.5rem; text-align: center; }
