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

:root {
  --bg: #09090b;
  --surface: #111113;
  --surface2: #1a1a1f;
  --surface3: #222228;
  --border: #2a2a30;
  --text: #e4e4e7;
  --text-dim: #71717a;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --green: #22c55e;
  --green-dim: rgba(34,197,94,0.12);
  --yellow: #eab308;
  --yellow-dim: rgba(234,179,8,0.12);
  --red: #ef4444;
  --red-dim: rgba(239,68,68,0.12);
  --orange: #f97316;
  --orange-dim: rgba(249,115,22,0.12);
  --blue: #3b82f6;
  --blue-dim: rgba(59,130,246,0.12);
  --magenta: #d946ef;
  --magenta-dim: rgba(217,70,239,0.12);
  --cyan: #06b6d4;
  --cyan-dim: rgba(6,182,212,0.12);
  --radius: 10px;
  --radius-sm: 6px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 13px;
  min-height: 100vh;
}

/* --- Header --- */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 20px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
}

header h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.5px;
  white-space: nowrap;
}

header h1::before {
  content: "◎ ";
  color: var(--accent);
}

.quick-add {
  flex: 1;
  max-width: 400px;
}

.quick-add input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 14px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.quick-add input:focus {
  border-color: var(--accent);
}

.quick-add input::placeholder {
  color: var(--text-dim);
}

/* --- Search Box --- */

.search-box {
  position: relative;
  flex: 0 0 200px;
}

.search-box input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 28px 6px 14px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, width 0.2s;
}

.search-box input:focus {
  border-color: var(--accent);
  width: 280px;
}

.search-box input::placeholder {
  color: var(--text-dim);
}

.search-box .clear-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface3);
  border: none;
  color: var(--text-dim);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  padding-bottom: 2px;
}

.search-box .clear-btn:hover {
  background: var(--red);
  color: white;
}

.stats {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}

.stats .stat { display: flex; align-items: center; gap: 4px; }
.stats .num { font-weight: 700; color: var(--text); font-size: 14px; }

/* --- Main --- */

main {
  padding: 20px 24px;
  max-width: 1400px;
  margin: 0 auto;
}

/* --- Kanban Board --- */

.board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.column {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 300px;
  display: flex;
  flex-direction: column;
}

.col-header {
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.col-count {
  background: var(--surface3);
  color: var(--text-dim);
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 700;
}

.col-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-in-progress { background: var(--yellow); }
.dot-todo { background: var(--blue); }
.dot-backlog { background: var(--text-dim); }
.dot-done { background: var(--green); }

.col-body {
  padding: 8px;
  flex: 1;
  overflow-y: auto;
  max-height: 60vh;
}

/* --- Task Card --- */

.task-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}

.task-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(99,102,241,0.1);
}

.task-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.card-pri {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-top: 6px;
}

.pri-critical { background: var(--red); }
.pri-high { background: var(--orange); }
.pri-medium { background: var(--yellow); }
.pri-low { background: var(--text-dim); }

.card-title {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  word-break: break-word;
}

.card-id {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.card-domain {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 3px;
  font-weight: 600;
}

.domain-engineering { background: var(--blue-dim); color: var(--blue); }
.domain-business { background: rgba(34,197,94,0.12); color: var(--green); }
.domain-marketing { background: var(--magenta-dim); color: var(--magenta); }
.domain-personal { background: var(--yellow-dim); color: var(--yellow); }
.domain-design { background: var(--cyan-dim); color: var(--cyan); }
.domain-ops { background: var(--red-dim); color: var(--red); }
.domain-data { background: var(--orange-dim); color: var(--orange); }

.card-effort {
  font-size: 10px;
  color: var(--text-dim);
}

.card-due {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 600;
}

.due-overdue { background: var(--red-dim); color: var(--red); }
.due-today { background: var(--yellow-dim); color: var(--yellow); }
.due-soon { background: var(--surface3); color: var(--text-dim); }

.card-progress {
  margin-top: 6px;
}

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

.progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 2px;
  transition: width 0.3s;
}

.progress-label {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 2px;
}

.card-actions {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.15s;
}

.task-card:hover .card-actions {
  opacity: 1;
}

.card-btn {
  background: var(--surface3);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.card-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.card-btn.btn-danger:hover {
  background: var(--red);
  border-color: var(--red);
}

/* --- Bottom Row --- */

.bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.panel h2 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}

/* --- Charts --- */

.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.chart-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-label {
  font-size: 11px;
  font-weight: 600;
  min-width: 70px;
}

.chart-bar-wrap {
  flex: 1;
  height: 8px;
  background: var(--surface3);
  border-radius: 4px;
  overflow: hidden;
}

.chart-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.chart-value {
  font-size: 11px;
  color: var(--text-dim);
  min-width: 30px;
  text-align: right;
}

/* --- Priority Chart (donut-like) --- */

.priority-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.priority-item {
  text-align: center;
  padding: 8px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
}

.priority-item .p-num {
  font-size: 20px;
  font-weight: 700;
  display: block;
}

.priority-item .p-label {
  font-size: 10px;
  color: var(--text-dim);
}

/* --- Focus List --- */

.focus-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.focus-item:hover {
  border-color: var(--accent);
}

.focus-rank {
  font-size: 16px;
  font-weight: 800;
  color: var(--accent);
  min-width: 20px;
  line-height: 1;
  padding-top: 2px;
}

.focus-body { flex: 1; }

.focus-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 3px;
}

.focus-meta {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.focus-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 3px;
  font-style: italic;
}

/* --- Modal --- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 560px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  word-break: break-word;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 22px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

.modal-close:hover { color: var(--text); }

.modal-body {
  padding: 20px;
}

.detail-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 13px;
}

.detail-label {
  color: var(--text-dim);
  min-width: 70px;
  font-size: 12px;
}

.detail-value {
  flex: 1;
}

/* Status buttons in modal */
.status-buttons {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.status-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.status-btn:hover { border-color: var(--accent); color: var(--text); }

.status-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.status-btn.active[data-status="done"] { background: var(--green); border-color: var(--green); }
.status-btn.active[data-status="in-progress"] { background: var(--yellow); border-color: var(--yellow); color: #000; }

/* Subtasks in modal */
.subtask-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.subtask-section h4 {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.subtask-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  font-size: 13px;
}

.subtask-item .st-status {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}

.subtask-item .st-status.st-done {
  background: var(--green);
  border-color: var(--green);
}

.subtask-item .st-status.st-done::after {
  content: "✓";
  color: white;
  font-size: 10px;
}

.subtask-item .st-title { flex: 1; }
.subtask-item .st-title.st-title-done { text-decoration: line-through; color: var(--text-dim); }

.subtask-item .st-id { color: var(--text-dim); font-size: 11px; }

/* Notes in modal */
.notes-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.notes-section h4 {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.notes-content {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
  word-break: break-word;
}

/* --- Empty --- */

.empty {
  text-align: center;
  color: var(--text-dim);
  padding: 24px;
  font-size: 12px;
}

/* --- Toast --- */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface);
  border: 1px solid var(--green);
  color: var(--green);
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  z-index: 300;
  animation: toastIn 0.2s ease, toastOut 0.3s ease 1.7s forwards;
}

@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-10px); } }

/* --- Responsive --- */

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

@media (max-width: 600px) {
  .board { grid-template-columns: 1fr; }
  header { flex-direction: column; align-items: stretch; gap: 10px; }
  .header-left { flex-direction: column; }
  main { padding: 12px; }
}
