:root {
  --bg: #0f1115;
  --bg-2: #161922;
  --bg-3: #1d2230;
  --bg-hover: #232a3b;
  --border: #2a3142;
  --text: #e6e8ec;
  --text-dim: #8a90a0;
  --text-muted: #5d6478;
  --accent: #7aa2f7;
  --accent-2: #a78bfa;
  --done: #4ade80;
  --high: #f87171;
  --warn: #fbbf24;
  --shadow: 0 4px 20px rgba(0,0,0,.35);
  --radius: 10px;
  --radius-sm: 6px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body { max-width: 880px; margin: 0 auto; padding: 0 16px 80px; }

.topbar { display: flex; align-items: center; justify-content: space-between;
  padding: 18px 4px; position: sticky; top: 0; background: var(--bg);
  z-index: 10; border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: baseline; gap: 8px; }
.logo { font-size: 22px; color: var(--accent); }
.brand-name { font-weight: 600; letter-spacing: 0.5px; font-size: 18px; }

.icon-btn { background: transparent; border: 1px solid var(--border);
  color: var(--text); width: 36px; height: 36px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 16px; display: inline-flex;
  align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--bg-2); border-color: var(--accent); }
.icon-btn.voice.recording { background: var(--high); border-color: var(--high); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: 0.6 } }

.project-tabs { display: flex; flex-wrap: wrap; gap: 6px;
  padding: 12px 0; overflow-x: auto; }
.project-tabs button { background: var(--bg-2); border: 1px solid var(--border);
  color: var(--text-dim); padding: 6px 12px; border-radius: 20px;
  font-size: 13px; cursor: pointer; white-space: nowrap; }
.project-tabs button:hover { background: var(--bg-hover); color: var(--text); }
.project-tabs button.active { background: var(--accent); border-color: var(--accent);
  color: #0f1115; font-weight: 600; }
.project-tabs button .count { display: inline-block; margin-left: 6px;
  background: rgba(255,255,255,0.1); padding: 1px 6px; border-radius: 8px;
  font-size: 11px; font-weight: 600; }
.project-tabs button.active .count { background: rgba(15,17,21,0.25); color: #0f1115; }

.capture { margin: 16px 0; padding: 14px; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: var(--radius); }
.capture textarea { width: 100%; background: var(--bg-3); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; font: inherit; resize: vertical; min-height: 64px; }
.capture textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.capture-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px;
  align-items: center; }
.capture-row .pill { background: var(--bg-3); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 6px 10px; font: inherit; cursor: pointer; }
.capture-row button { font: inherit; }
button.primary { background: var(--accent); color: #0f1115; border: none;
  padding: 8px 18px; border-radius: var(--radius-sm); cursor: pointer;
  font-weight: 600; }
button.primary:hover { filter: brightness(1.1); }
button.ghost { background: transparent; color: var(--text-dim);
  border: 1px solid var(--border); padding: 8px 14px; border-radius: var(--radius-sm);
  cursor: pointer; }
button.danger { background: transparent; color: var(--high);
  border: 1px solid var(--high); padding: 8px 14px; border-radius: var(--radius-sm);
  cursor: pointer; }
.voice-status { color: var(--text-muted); font-size: 12px; margin-top: 6px;
  min-height: 16px; }

.capture.dragover { border-color: var(--accent); background: var(--bg-3);
  box-shadow: 0 0 0 2px var(--accent); }
.attachments-preview { display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 10px; }
.attachments-preview:empty { display: none; }
.attachment-thumb { position: relative; width: 80px; height: 80px;
  border-radius: var(--radius-sm); overflow: hidden;
  border: 1px solid var(--border); background: var(--bg-3); }
.attachment-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attachment-thumb.uploading { opacity: 0.5; animation: pulse 1.2s infinite; }
.attachment-remove { position: absolute; top: 2px; right: 2px;
  width: 22px; height: 22px; border-radius: 50%; border: none;
  background: rgba(0,0,0,0.7); color: #fff; cursor: pointer; font-size: 14px;
  line-height: 20px; padding: 0; }
.attachment-remove:hover { background: var(--high); }

.item-thumb { flex: 0 0 auto; width: 48px; height: 48px;
  border-radius: var(--radius-sm); overflow: hidden;
  border: 1px solid var(--border); position: relative;
  display: block; text-decoration: none; }
.item-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item-thumb .thumb-count { position: absolute; bottom: 0; right: 0;
  background: rgba(0,0,0,0.75); color: #fff; font-size: 10px;
  padding: 1px 5px; border-top-left-radius: 4px; }

.toast { position: fixed; left: 50%; top: 20px; transform: translateX(-50%) translateY(-20px);
  background: var(--bg-2); border: 1px solid var(--accent); color: var(--text);
  padding: 10px 16px; border-radius: var(--radius); box-shadow: var(--shadow);
  font-size: 14px; opacity: 0; transition: opacity .25s ease, transform .25s ease;
  cursor: pointer; z-index: 200; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast b { color: var(--accent); }
.toast .conf { color: var(--text-muted); font-size: 12px; }
.toast .sug { color: var(--text-muted); font-size: 12px; }
.toast a { color: var(--accent-2); text-decoration: none; }
.toast a:hover { text-decoration: underline; }

.similar-strip { margin: -2px 0 6px 0; padding: 6px 12px; background: var(--bg-3);
  border-left: 3px solid var(--accent-2); border-radius: var(--radius-sm);
  font-size: 12px; color: var(--text-dim); }
.similar-strip a { color: var(--accent-2); text-decoration: none; margin-right: 8px; }

.done-toggle { padding: 8px 12px; color: var(--text-muted); font-size: 13px;
  cursor: pointer; text-align: center; border-radius: var(--radius-sm);
  margin-top: 4px; user-select: none; }
.done-toggle:hover { background: var(--bg-2); color: var(--text); }

.icon-btn svg { display: block; }
.icon-btn.voice.recording svg { color: #fff; }
.icon-btn.active { background: var(--accent); color: #0f1115; border-color: var(--accent); }

.topbar-actions { display: flex; gap: 6px; align-items: center; }

.graph-container { margin-top: 12px; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px; }
.graph-container.hidden { display: none; }
.list.hidden { display: none; }
.graph-toolbar { display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px; padding: 0 4px; }
.graph-stats { color: var(--text-dim); font-size: 12px; }
#graph-canvas { width: 100%; height: 70vh; background: var(--bg);
  border-radius: var(--radius-sm); border: 1px solid var(--border); }

.list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.item { background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
  display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.item:hover { background: var(--bg-3); border-color: var(--accent); }
.item.done { opacity: 0.5; }
.item.done .summary { text-decoration: line-through; }
.item .check { flex: 0 0 auto; width: 18px; height: 18px;
  border: 2px solid var(--text-muted); border-radius: 4px;
  cursor: pointer; margin-top: 2px; }
.item.done .check { background: var(--done); border-color: var(--done); }
.item.done .check::after { content: "✓"; color: #0f1115; font-weight: 700;
  font-size: 14px; line-height: 14px; display: block; text-align: center; }
.item .body { flex: 1; min-width: 0; }
.item .summary { font-size: 14px; word-wrap: break-word; }
.item .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px;
  font-size: 11px; color: var(--text-muted); align-items: center; }
.item .tag { background: var(--bg-3); padding: 2px 8px; border-radius: 10px;
  border: 1px solid var(--border); }
.item .tag.kind { color: var(--accent-2); }
.item .tag.high { color: var(--high); border-color: var(--high); }
.item .tag.deadline { color: var(--warn); }
.item .tag.hard { color: var(--high); border-color: var(--high); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  padding: 16px; }
.modal.hidden { display: none; }
.modal-card { background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; width: 100%; max-width: 480px;
  box-shadow: var(--shadow); max-height: 90vh; overflow-y: auto; }
.modal-card h2 { margin: 0 0 12px; font-size: 18px; }
.modal-card label { display: block; margin-bottom: 10px; font-size: 13px;
  color: var(--text-dim); }
.modal-card label .hint { color: var(--text-muted); font-weight: normal; }
.modal-card input, .modal-card textarea, .modal-card select {
  width: 100%; background: var(--bg-3); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 10px; font: inherit; margin-top: 4px; }
.modal-card .row { display: flex; gap: 10px; }
.modal-card .row label { flex: 1; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; align-items: center; }
.modal-actions .spacer { flex: 1; }

@media (max-width: 560px) {
  body { padding: 0 10px 60px; }
  .capture-row { gap: 6px; }
  .capture-row .pill { padding: 5px 8px; font-size: 13px; }
}
