/* ── Reset & Base ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-2: #232736;
  --border: #2d3246;
  --text: #e2e4ea;
  --text-muted: #8b90a5;
  --accent: #6c8cff;
  --accent-hover: #8ba4ff;
  --green: #34d399;
  --yellow: #fbbf24;
  --red: #f87171;
  --orange: #fb923c;
  --radius: 10px;
  --radius-sm: 6px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
}
body { min-height: 100dvh; padding-bottom: 80px; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font: inherit; color: var(--text); }
a { color: var(--accent); text-decoration: none; }

/* ── Header ─────────────────────────────────────────── */
header {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px 0;
}
header h1 { font-size: 1.25rem; margin-bottom: 8px; }
nav { display: flex; gap: 4px; }
.tab {
  flex: 1; padding: 10px 8px; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: 0.9rem; font-weight: 600; color: var(--text-muted);
  transition: all 0.15s;
}
.tab.active { background: var(--bg); color: var(--accent); }
.tab:hover:not(.active) { color: var(--text); background: var(--surface-2); }

/* ── Sections ───────────────────────────────────────── */
.section { display: none; padding: 16px; max-width: 900px; margin: 0 auto; }
.section.active { display: block; }
.section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.section-header h2 { font-size: 1.1rem; }

/* ── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  font-size: 0.85rem; font-weight: 600;
  background: var(--accent); color: #fff;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface-2); color: var(--text); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #ef4444; }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }

/* ── Kanban ─────────────────────────────────────────── */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.column {
  min-width: 260px; flex: 1;
  background: var(--surface); border-radius: var(--radius);
  padding: 12px;
}
.column-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.column-header h3 { font-size: 0.9rem; }
.count {
  background: var(--surface-2); padding: 2px 8px; border-radius: 10px;
  font-size: 0.75rem; color: var(--text-muted);
}
.cards { display: flex; flex-direction: column; gap: 8px; }

/* ── Task Card ──────────────────────────────────────── */
.card {
  background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 10px 12px; border: 1px solid transparent;
  transition: border-color 0.15s;
}
.card:hover { border-color: var(--border); }
.card-title {
  font-weight: 600; font-size: 0.9rem;
  word-break: break-word; margin-bottom: 4px;
}
.card-meta {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
  font-size: 0.75rem; color: var(--text-muted); margin-bottom: 6px;
}
.card-actions { display: flex; gap: 4px; justify-content: flex-end; }
.card-desc {
  font-size: 0.8rem; color: var(--text-muted);
  margin-bottom: 6px; white-space: pre-wrap; word-break: break-word;
}
.priority-badge {
  padding: 1px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 600;
}
.prio-4 { background: var(--red); color: #fff; }
.prio-3 { background: var(--orange); color: #000; }
.prio-2 { background: var(--yellow); color: #000; }
.prio-1 { background: #60a5fa; color: #fff; }

/* ── Notes & Goals ──────────────────────────────────── */
.note-item, .goal-item {
  background: var(--surface); border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px; border: 1px solid var(--border);
}
.note-title, .goal-title {
  font-weight: 600; font-size: 0.95rem; margin-bottom: 4px;
  word-break: break-word;
}
.note-content {
  font-size: 0.85rem; color: var(--text-muted);
  white-space: pre-wrap; word-break: break-word;
  margin-bottom: 6px;
}
.goal-desc {
  font-size: 0.85rem; color: var(--text-muted);
  white-space: pre-wrap; word-break: break-word; margin-bottom: 6px;
}
.goal-status {
  display: inline-block; padding: 1px 8px; border-radius: 4px;
  font-size: 0.7rem; font-weight: 600;
}
.goal-active { background: var(--green); color: #000; }
.goal-achieved { background: var(--yellow); color: #000; }
.goal-abandoned { background: var(--surface-2); color: var(--text-muted); }
.item-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 6px;
}

/* ── Modal ──────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal.hidden { display: none; }
.modal-content {
  background: var(--surface); border-radius: var(--radius);
  padding: 20px; width: 100%; max-width: 480px;
  border: 1px solid var(--border);
  position: relative; max-height: 90dvh; overflow-y: auto;
}
.modal-close {
  position: absolute; top: 12px; right: 12px;
  font-size: 1.2rem; color: var(--text-muted); line-height: 1;
}

/* ── Forms ──────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: 0.85rem; font-weight: 600;
  margin-bottom: 4px; color: var(--text-muted);
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%; padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 0.9rem;
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group select { appearance: auto; }
.form-actions {
  display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px;
}

/* ── Confirm dialog ─────────────────────────────────── */
.confirm-box { max-width: 360px; text-align: center; }
.confirm-box p { margin-bottom: 16px; font-size: 0.95rem; }
.confirm-actions { display: flex; gap: 8px; justify-content: center; }

/* ── Empty state ────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 32px 16px;
  color: var(--text-muted); font-size: 0.9rem;
}

/* ── Toast ──────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 0.85rem; z-index: 200;
  animation: fadeIn 0.2s, fadeOut 0.3s 2s forwards;
}
@keyframes fadeIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes fadeOut { to { opacity: 0; transform: translateX(-50%) translateY(10px); } }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 640px) {
  .kanban {
    flex-direction: column;
    overflow-x: visible;
  }
  .column { min-width: unset; }
  header h1 { font-size: 1.1rem; }
  .section { padding: 12px; }
}