/* GTZen — Notes + Open actions · model 0.2-notes */
:root {
  --bg: #f6f5f2;
  --panel: #ffffff;
  --ink: #1c1b19;
  --muted: #6b6964;
  --line: #e4e1da;
  --line-strong: #d0ccc3;
  --accent: #2f5d50;
  --accent-soft: #e8f0ed;
  --warn: #8a5a2b;
  --danger: #8b3a3a;
  --chip: #f0eee8;
  --glass: rgba(255, 255, 255, 0.45);
  --glass-border: rgba(47, 93, 80, 0.22);
  --glass-shine: rgba(255, 255, 255, 0.7);
  --bol: #3d7a68;
  --bol-sel: #1e4a3c;
  --shadow: 0 1px 2px rgba(28, 27, 25, 0.06);
  --radius: 10px;
  --font: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.spacer { flex: 1; }
.muted { color: var(--muted); font-weight: 400; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }

/* Header */
.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.015em;
  white-space: nowrap;
  color: var(--ink);
}
.brand .sub { display: none; }

.tabs { display: flex; gap: 4px; margin-left: 18px; }
.tab {
  border: 1px solid transparent;
  background: transparent;
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
}
.tab:hover { background: var(--chip); color: var(--ink); }
.tab.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #c5ddd4;
}

.btn {
  border: 1px solid var(--line-strong);
  background: var(--panel);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
}
.btn:hover { background: var(--chip); }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--chip); color: var(--ink); }
.btn.sm { padding: 4px 8px; font-size: 12px; }

.status-pill {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--muted);
  font-family: var(--mono);
}
.status-pill.dirty {
  background: #f5ebe0;
  color: var(--warn);
}
.status-pill.ok {
  background: var(--accent-soft);
  color: var(--accent);
}

.toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  user-select: none;
}
.toggle-pill input { accent-color: var(--accent); }

/* Views */
.view {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}
.view[hidden] { display: none !important; }

.panel {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--line);
  min-width: 0;
}
.panel:last-child { border-right: none; }
.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.panel-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}
.panel-body {
  flex: 1;
  overflow: auto;
  padding: 8px;
}

.detail-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
  font-size: 14px;
  padding: 24px;
}

/* Open actions layout */
.view-actions .actions-panel { flex: 1.4; }
.view-actions .action-detail { flex: 0.9; max-width: 420px; padding: 0; }

.quick-add {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #faf9f6;
}
.quick-add input {
  flex: 1;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 7px 10px;
  background: #fff;
}
.quick-add select {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 6px 8px;
  background: #fff;
}

.actions-list { padding: 6px 8px 24px; }

.action-row {
  display: grid;
  grid-template-columns: 44px 28px 72px 1fr minmax(100px, 180px) 100px 28px 28px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  margin-bottom: 2px;
  background: transparent;
  cursor: pointer;
}
.action-row:hover { background: #faf9f6; border-color: var(--line); }
.action-row.selected {
  background: var(--accent-soft);
  border-color: #c5ddd4;
}
.action-row.placeholder-row { opacity: 0.55; }
.action-row .sort-num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}
.action-row .drag-handle {
  color: var(--line-strong);
  cursor: grab;
  text-align: center;
  user-select: none;
}
.action-row.dragging { opacity: 0.45; }
.action-row .type-chip {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--chip);
  color: var(--ink);
  text-align: center;
  text-transform: lowercase;
}
.action-row .title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.action-row .note-ref {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.action-row .note-ref.standalone { font-style: italic; }
.action-row .dod-snip {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  grid-column: 4 / 6;
  margin-top: -2px;
}
.action-row.has-dod {
  grid-template-rows: auto auto;
}
.hold-toggle {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}
.hold-toggle.on {
  background: #f5ebe0;
  border-color: #e0c9ad;
  color: var(--warn);
}
.reorder-btns { display: flex; flex-direction: column; gap: 1px; }
.reorder-btns button {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
  padding: 1px 4px;
}
.reorder-btns button:hover { color: var(--accent); }

/* Action detail */
#actionDetailContent { padding: 16px; display: flex; flex-direction: column; gap: 12px; height: 100%; overflow: auto; }
.detail-head { display: flex; gap: 8px; align-items: center; }
.chip {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--chip);
}
.tag-id {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-left: auto;
}
.fld { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.fld input, .fld textarea, .fld select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  resize: vertical;
}
.row-inline { display: flex; align-items: center; gap: 8px; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

.note-title {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  padding: 4px 0;
  outline: none;
}
.note-body {
  width: 100%;
  border: none;
  background: transparent;
  resize: none;
  min-height: 160px;
  line-height: 1.55;
  font-size: 14px;
  outline: none;
  flex: 1;
}

/* Notes layout */
#noteEmpty[hidden] { display: none !important; }
#noteContent[hidden] { display: none !important; }
.view-notes .tree-panel { width: 280px; flex: 0 0 280px; }
.view-notes .note-panel { flex: 1; }

.tree-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.3;
}
.tree-item:hover { background: var(--chip); }
.tree-item.selected { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.tree-item .label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Glass ball in front of each note. Hollow glass = open, filled glass = collapsed. */
/* 26px hit area around the 14px visual ball, so taps/clicks near the ball still toggle. */
.tree-ball-hit {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  margin: -6px -4px -6px -6px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
span.tree-ball-hit { cursor: inherit; }
.tree-ball-hit:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tree-ball {
  position: relative;
  display: block;
  pointer-events: none;
  width: 14px;
  height: 14px;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid var(--glass-border);
  background:
    radial-gradient(circle at 34% 30%, var(--glass-shine) 0 22%, transparent 48%),
    linear-gradient(160deg, rgba(232, 240, 237, 0.9), rgba(255, 255, 255, 0.4));
  box-shadow: inset 0 -2px 3px rgba(47, 93, 80, 0.1), 0 1px 2px rgba(28, 27, 25, 0.06);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}
.tree-item.is-open > .tree-ball-hit .tree-ball,
.tree-item.is-closed > .tree-ball-hit .tree-ball { border-color: rgba(47, 93, 80, 0.5); }
@media (hover: hover) {
  .tree-item.is-open > .tree-ball-hit:hover .tree-ball,
  .tree-item.is-closed > .tree-ball-hit:hover .tree-ball { transform: scale(1.15); }
}
.tree-item.is-closed > .tree-ball-hit .tree-ball {
  background:
    radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.85) 0 18%, transparent 42%),
    radial-gradient(circle at 50% 60%, var(--bol) 0 55%, rgba(61, 122, 104, 0.75) 100%);
  border-color: var(--bol);
}
.tree-item.is-leaf > .tree-ball-hit .tree-ball { border-color: rgba(47, 93, 80, 0.28); }

.tree-item .kid-count {
  cursor: pointer;
  padding: 2px 4px;
  margin: -2px -4px;
  font-size: 11px;
  color: var(--muted);
  opacity: 0.8;
  font-family: var(--mono);
  flex-shrink: 0;
}
.tree-item .act-count {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--accent);
  opacity: 0.7;
  font-family: var(--mono);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.tree-item .act-count::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--bol);
  opacity: 0.8;
}
.tree-children { margin-left: 14px; border-left: 1px solid var(--line); padding-left: 4px; }

.note-view { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.note-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
.breadcrumb { font-size: 12px; color: var(--muted); }
.breadcrumb button {
  border: none;
  background: transparent;
  color: var(--accent);
  padding: 0 2px;
  font-size: 12px;
}
.breadcrumb button:hover { text-decoration: underline; }
.note-scroll {
  flex: 1;
  overflow: auto;
  padding: 16px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.note-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: #faf9f6;
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 8px;
}
.tag-chip input, .tag-chip select {
  border: none;
  background: transparent;
  outline: none;
  font-size: 12px;
  color: var(--ink);
  min-width: 70px;
}

/* Glass ball */
.glass-section { margin-top: 8px; }
.glass-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 500;
}
.glass-ball {
  position: relative;
  width: min(280px, 100%);
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, var(--glass-shine), transparent 42%),
    radial-gradient(circle at 70% 75%, rgba(47, 93, 80, 0.08), transparent 50%),
    linear-gradient(160deg, rgba(232, 240, 237, 0.65), rgba(255, 255, 255, 0.35));
  border: 1.5px solid var(--glass-border);
  box-shadow:
    inset 0 0 40px rgba(255, 255, 255, 0.35),
    inset 0 -20px 40px rgba(47, 93, 80, 0.06),
    0 8px 24px rgba(28, 27, 25, 0.06);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.glass-inner {
  position: absolute;
  inset: 18%;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 10px;
  padding: 8px;
}
.bolletje {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--bol);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--mono);
  box-shadow: 0 2px 6px rgba(30, 74, 60, 0.25);
  transition: transform 0.12s ease, background 0.12s;
}
.bolletje:hover { transform: scale(1.12); }
.bolletje.selected { background: var(--bol-sel); outline: 2px solid #fff; outline-offset: 2px; }
.bolletje.empty-hint {
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  width: auto;
  height: auto;
  font-family: var(--font);
  font-weight: 400;
  font-size: 12px;
  pointer-events: none;
}
.glass-add {
  position: absolute;
  bottom: 14%;
  right: 14%;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.85);
  color: var(--accent);
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(28, 27, 25, 0.08);
}
.glass-add:hover { background: var(--accent-soft); }

/* ===== Simplenote-style note editor (v3) ===== */
/* Collapse nested note → parent */
.btn-up-parent {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 42%;
  height: 26px;
  padding: 0 10px 0 8px;
  margin-right: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
}
.btn-up-parent:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn-up-parent[hidden] { display: none; }
.btn-up-parent .up-label {
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 400;
  color: var(--muted);
  max-width: 180px;
}
.btn-up-parent:hover .up-label { color: var(--accent); }
.tree-up {
  margin-left: auto;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  opacity: 0;
  cursor: pointer;
  flex-shrink: 0;
}
.tree-item:hover > .tree-up,
.tree-item.selected > .tree-up { opacity: 0.7; }
.tree-item .tree-up:hover { opacity: 1; background: var(--chip); color: var(--accent); }
.tree-item .act-count + .tree-up { margin-left: 2px; }
.tree-item:not(:has(.act-count)) .tree-up { margin-left: auto; }

.sn-toolbar { padding: 8px 16px; border-bottom: none; display: flex; align-items: center; gap: 6px; }
.sn-toolbar .breadcrumb { opacity: 0.85; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sn-info-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  font: italic 600 12px/1 Georgia, "Times New Roman", serif;
  padding: 0;
}
.sn-info-btn:hover { color: var(--ink); background: var(--chip); }
.sn-info-btn[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.sn-scroll { padding: 8px 32px 48px; display: block; }
.sn-page { max-width: 720px; margin: 0 auto; }
.sn-title,
.sn-body {
  display: block;
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  resize: none;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font);
  padding: 0;
  margin: 0;
}
.sn-title {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.015em;
  padding-top: 12px;
}
.sn-body-wrap { position: relative; }
.sn-body,
.sn-mirror {
  font-size: 16px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-wrap: break-word;
  tab-size: 4;
  padding: 6px 0 0;
}
.sn-body { min-height: 42vh; caret-color: var(--accent); }
.sn-title::placeholder, .sn-body::placeholder { color: #b5b1a8; }
.sn-mirror {
  position: absolute;
  top: 0;
  left: 0;
  visibility: hidden;
  pointer-events: none;
  font-family: var(--font);
}
.sn-convert {
  position: absolute;
  right: -4px;
  margin-top: 2px;
  height: 24px;
  padding: 0 10px;
  border-radius: 12px;
  border: 1px solid rgba(47, 93, 80, 0.3);
  background: rgba(255, 255, 255, 0.94);
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 1px 4px rgba(28, 27, 25, 0.08);
  cursor: pointer;
  z-index: 2;
  transform: translateY(2px);
  white-space: nowrap;
}
.sn-convert:hover { background: var(--accent-soft); border-color: var(--accent); }
.sn-convert[hidden] { display: none; }

/* Actions plane under the note (separate from the writing area) */
.sn-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px 12px;
  border-top: none;
}
.actions-plane {
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  border-top: 1px solid var(--line);
  background: #f7f6f2;
  border-radius: 0 0 12px 12px;
  padding: 10px 14px 12px;
}
.actions-plane[hidden] { display: none !important; }
.actions-plane-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.actions-plane-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.actions-plane-count {
  display: inline-block;
  min-width: 1.4em;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(20, 20, 20, 0.06);
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--mono);
  text-transform: none;
  letter-spacing: 0;
}
.actions-plane-list { display: flex; flex-direction: column; gap: 4px; }
.ap-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}
.ap-row.selected { border-color: rgba(20, 20, 20, 0.28); box-shadow: 0 0 0 1px rgba(20, 20, 20, 0.08); }
.ap-row.is-hold { opacity: 0.55; }
.ap-row.just-added { animation: sn-pop 0.45s ease; }
@keyframes sn-pop { 0% { transform: scale(0.96); opacity: 0.4; } 100% { transform: scale(1); opacity: 1; } }
.ap-ball {
  flex: 0 0 10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 32%, rgba(255, 255, 255, 0.55) 0 1px, transparent 2.2px),
    radial-gradient(circle at 50% 50%, #141414 0 5px, transparent 5.5px);
}
.ap-title {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 13.5px;
  color: var(--ink);
  padding: 2px 0;
}
.ap-title::placeholder { color: #b5b1a8; }
.ap-hold {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--warn);
  background: #f5ebe0;
  border-radius: 4px;
  padding: 1px 5px;
}
.ap-open {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  opacity: 0.55;
}
.ap-row:hover .ap-open { opacity: 1; }
.ap-open:hover { background: var(--chip); color: var(--ink); }
.sn-hint {
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  font-size: 11.5px;
  color: var(--muted);
  opacity: 0.75;
  padding: 4px 4px 0;
}
.sn-hint kbd {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 0 4px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #fff;
}

#noteInfo[hidden] { display: none; }
@media (max-width: 900px) {
  .sn-scroll { padding: 8px 18px 40px; }
  .sn-actions { padding: 0 10px 10px; }
  .ap-open { display: none; }
}

/* Objectives */

.obj-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.obj-row .obj-id {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.obj-row input, .obj-row textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
  background: #fff;
}
.obj-row textarea { min-height: 56px; resize: vertical; }

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
  max-width: 90vw;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 900px) {
  .view-actions { flex-direction: column; }
  .view-actions .action-detail { max-width: none; border-top: 1px solid var(--line); max-height: 40vh; }
  .action-row {
    grid-template-columns: 36px 24px 56px 1fr 92px 24px 24px;
  }
  .action-row .note-ref { display: none; }
  .view-notes .tree-panel { width: 220px; flex-basis: 220px; }
}

/* ===== Two kinds of balls: notes = light-blue glass (all identical), actions = small black ball ===== */
:root {
  --note-ball: #8fd0f2;
  --note-ball-deep: #5fb4e4;
  --note-ball-ring: rgba(95, 180, 228, 0.75);
  --action-ball: #141414;
  --glass-border: rgba(95, 180, 228, 0.35);
  --bol: var(--action-ball);
  --bol-sel: #000;
}

/* Notes: one light-blue glass ball everywhere (no open/collapsed/childless variants; collapsed still shows its count) */
.tree-ball,
.tree-item.is-open > .tree-ball-hit .tree-ball,
.tree-item.is-closed > .tree-ball-hit .tree-ball,
.tree-item.is-leaf > .tree-ball-hit .tree-ball {
  border: 1.5px solid var(--note-ball-ring);
  background:
    radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.92) 0 18%, transparent 44%),
    radial-gradient(circle at 50% 60%, var(--note-ball) 0 55%, var(--note-ball-deep) 100%);
  box-shadow: inset 0 -2px 3px rgba(63, 159, 216, 0.25), 0 1px 2px rgba(28, 27, 25, 0.08);
  opacity: 1;
}

/* Actions: small black (glassy) ball */
.tree-item .act-count { color: var(--muted); opacity: 0.9; }
.tree-item .act-count::before {
  width: 7px;
  height: 7px;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.55) 0 14%, var(--action-ball) 45%);
  opacity: 1;
}
.bolletje,
.glass-strip .bolletje {
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 50%;
  font-size: 0; /* no numbers: just a small ball (title tooltip has the action) */
  color: transparent;
  background:
    radial-gradient(circle at 42% 38%, rgba(255, 255, 255, 0.6) 0 1.4px, transparent 2.6px),
    radial-gradient(circle at 50% 50%, var(--action-ball) 0 6px, transparent 6.6px);
  box-shadow: none;
  cursor: pointer;
}
.bolletje:hover { transform: scale(1.25); }
.bolletje.selected,
.glass-strip .bolletje.selected {
  background:
    radial-gradient(circle at 42% 38%, rgba(255, 255, 255, 0.6) 0 1.4px, transparent 2.6px),
    radial-gradient(circle at 50% 50%, #000 0 6px, transparent 6.6px),
    radial-gradient(circle at 50% 50%, transparent 0 7.6px, rgba(20, 20, 20, 0.45) 8px 8.8px, transparent 9.2px);
  outline: none;
}
.bolletje.empty-hint,
.glass-strip .bolletje.empty-hint {
  width: auto;
  height: auto;
  font-size: 11.5px;
  color: var(--muted);
  background: transparent;
  cursor: default;
}
.glass-strip .glass-inner { gap: 2px; }

/* Open actions tab: small black ball in front of each action title */
.action-row .title::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  vertical-align: 1px;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.55) 0 14%, var(--action-ball) 45%);
}

/* The note's glass container stays light-blue glass */
.glass-strip {
  background:
    radial-gradient(ellipse at 25% 20%, rgba(255, 255, 255, 0.85), transparent 60%),
    linear-gradient(160deg, rgba(220, 240, 252, 0.75), rgba(255, 255, 255, 0.45));
  box-shadow: inset 0 -6px 12px rgba(63, 159, 216, 0.07), 0 2px 8px rgba(28, 27, 25, 0.04);
}
.glass-ball {
  background:
    radial-gradient(circle at 32% 28%, var(--glass-shine), transparent 42%),
    radial-gradient(circle at 70% 75%, rgba(63, 159, 216, 0.1), transparent 50%),
    linear-gradient(160deg, rgba(220, 240, 252, 0.7), rgba(255, 255, 255, 0.35));
}
.glass-add { color: #3f9fd8; border-color: var(--glass-border); }
.glass-add:hover { background: rgba(214, 238, 252, 0.9); }

/* Tree note drag & drop */
#tree { position: relative; touch-action: pan-y; }
#tree.is-dragging { touch-action: none; user-select: none; }
body.tree-drag-active { cursor: grabbing; user-select: none; }
#tree.is-dragging .tree-item { cursor: grabbing; }
.tree-item.drop-into {
  background: rgba(143, 208, 242, 0.35);
  outline: 1.5px dashed var(--note-ball-deep, #5fb4e4);
  outline-offset: -1px;
}
.tree-drop-line {
  position: absolute;
  height: 2px;
  background: var(--note-ball-deep, #5fb4e4);
  border-radius: 1px;
  pointer-events: none;
  z-index: 5;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.8);
}
.tree-drop-line::before {
  content: "";
  position: absolute;
  left: -4px;
  top: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--note-ball-deep, #5fb4e4);
}
.tree-drag-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  pointer-events: none;
  padding: 4px 10px 4px 8px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid rgba(95, 180, 228, 0.55);
  box-shadow: 0 4px 14px rgba(28, 27, 25, 0.12);
  font-size: 13px;
  font-weight: 500;
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  will-change: transform;
}
.tree-drag-ghost::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 50%;
  vertical-align: -1px;
  background:
    radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.9) 0 18%, transparent 44%),
    radial-gradient(circle at 50% 60%, #8fd0f2 0 55%, #5fb4e4 100%);
}

/* Delete note (trash) */
.btn-delete-note {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  padding: 0;
  margin-right: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  filter: grayscale(1);
  opacity: 0.75;
}
.btn-delete-note:hover { filter: none; opacity: 1; border-color: #c0392b; background: #fdecea; }

/* Merge drop target: ring around the target ball + "samenvoegen" label */
.tree-item.drop-merge { position: relative; background: rgba(143, 208, 242, 0.18); }
.tree-item.drop-merge > .tree-ball-hit .tree-ball {
  transform: scale(1.25);
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px #2f7fd1, 0 0 10px rgba(47, 127, 209, 0.6);
}
.tree-item.drop-merge::after {
  content: "samenvoegen";
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  padding: 1px 7px;
  border-radius: 999px;
  background: #2f7fd1;
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  pointer-events: none;
  z-index: 6;
}

/* ===== Done / archive ===== */
.row-btns { display: inline-flex; gap: 4px; justify-content: flex-end; }
.done-toggle {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}
.done-toggle:hover { background: #e3f3ea; border-color: #a9d5bb; color: #1f7a45; }
.hold-toggle:hover { background: #f5ebe0; border-color: #e0c9ad; color: var(--warn); }
.tab-count { font-size: 11px; color: var(--muted); font-weight: 400; }
.view-done .done-panel { flex: 1; max-width: 860px; margin: 0 auto; border-right: none; width: 100%; }
.done-list { padding: 6px 8px 24px; }
.done-row {
  display: grid;
  grid-template-columns: 20px 1fr minmax(90px, 200px) 92px 84px;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  margin-bottom: 2px;
}
.done-row:hover { background: #faf9f6; border-color: var(--line); }
.done-row .done-check { color: #1f7a45; font-weight: 700; text-align: center; }
.done-row .title { font-size: 13px; color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(0,0,0,0.25); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.done-row .note-ref { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.done-row .note-ref[data-gotonote] { cursor: pointer; }
.done-row .note-ref[data-gotonote]:hover { color: var(--ink); text-decoration: underline; }
.done-row .note-ref.standalone { font-style: italic; }
.done-row .done-date { font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: right; }
.reopen-btn, .ap-reopen {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}
.reopen-btn:hover, .ap-reopen:hover { background: var(--chip); color: var(--ink); }
.plane-head-btns { display: inline-flex; gap: 6px; align-items: center; }
.plane-done-toggle.on { background: var(--chip); color: var(--ink); }
.ap-done {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  opacity: 0.6;
}
.ap-row:hover .ap-done { opacity: 1; }
.ap-done:hover { background: #e3f3ea; border-color: #a9d5bb; color: #1f7a45; }
.ap-row.is-done { opacity: 0.6; background: #faf9f6; }
.ap-row.is-done .ap-ball { opacity: 0.4; }
.ap-title-done { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); text-decoration: line-through; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-done-date { flex-shrink: 0; font-family: var(--mono); font-size: 11px; color: var(--muted); }
@media (max-width: 900px) {
  .done-row { grid-template-columns: 18px 1fr 80px 76px; }
  .done-row .note-ref { display: none; }
}

/* ===== Objectives tree (objective > sub-objectives > linked notes) ===== */
.view-objectives .obj-tree-panel { width: 360px; flex: 0 0 360px; }
.view-objectives .obj-editor-panel { flex: 1; }
#objTree { position: relative; touch-action: pan-y; padding: 6px 6px 24px; overflow: auto; }
#objTree.is-dragging { touch-action: none; user-select: none; }
#objTree.is-dragging .tree-item { cursor: grabbing; }
#objEmpty[hidden], #objContent[hidden] { display: none !important; }
/* Objective marker: light-blue target ring (hollow ring + centre dot) — notes are filled glass balls, actions small black balls */
.obj-mark {
  display: block;
  pointer-events: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #3f9fd8;
  background: radial-gradient(circle at 50% 50%, #3f9fd8 0 2.4px, transparent 2.9px), #fff;
  box-sizing: border-box;
  transition: transform 0.12s ease;
}
.obj-item { font-weight: 500; }
.obj-item.is-closed .obj-mark { background: radial-gradient(circle at 50% 50%, #3f9fd8 0 2.4px, rgba(143, 208, 242, 0.55) 3px); }
@media (hover: hover) { .obj-item > button.obj-hit:hover .obj-mark { transform: scale(1.15); } }
.obj-item.obj-inactive { opacity: 0.55; }
.obj-item.obj-inactive .label { text-decoration: none; }
.obj-item .obj-period {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 10.5px;
  font-family: var(--mono);
  color: var(--muted);
  font-weight: 400;
}
.obj-note-item { font-weight: 400; color: var(--ink); }
.obj-note-item .label { font-size: 12.5px; }
.obj-note-item .tree-ball { width: 12px; height: 12px; }
.obj-children { border-left-color: rgba(63, 159, 216, 0.25); }

#objContent { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.obj-form { padding: 16px 22px 32px; display: flex; flex-direction: column; gap: 14px; overflow: auto; max-width: 760px; }
.obj-form-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.of-notes { display: flex; flex-direction: column; gap: 2px; }
.of-note { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 6px; }
.of-note:hover { background: var(--chip); }
.of-note .tree-ball-hit { margin: -6px -4px -6px -6px; }
.of-note-open {
  flex: 1;
  min-width: 0;
  text-align: left;
  border: none;
  background: transparent;
  font-size: 13px;
  color: var(--ink);
  padding: 2px 0;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.of-note-open:hover { text-decoration: underline; }
.of-note-unlink {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  cursor: pointer;
}
.of-note-unlink:hover { background: #f5e3e0; color: #b33; }
.fld select.of-link-pick { margin-top: 4px; color: var(--muted); }

/* Note editor: small "Objective" selector in the toolbar */
.obj-pick {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 230px;
  padding: 2px 4px 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
}
.obj-pick .obj-mark { width: 11px; height: 11px; border-width: 1.6px; flex: 0 0 11px; opacity: 0.45; }
.obj-pick.is-set .obj-mark { opacity: 1; }
.obj-pick select {
  border: none;
  background: transparent;
  font-size: 12px;
  color: var(--muted);
  max-width: 200px;
  min-width: 0;
  padding: 2px 0;
  outline: none;
  text-overflow: ellipsis;
}
.obj-pick.is-set select { color: var(--ink); }

@media (max-width: 760px) {
  .view-objectives { flex-direction: column; }
  .view-objectives .obj-tree-panel { width: auto; flex: 0 0 auto; max-height: 45vh; border-right: none; border-bottom: 1px solid var(--line); }
  .obj-form-row { grid-template-columns: 1fr; }
  .obj-pick { max-width: 140px; }
  .obj-pick select { max-width: 110px; }
}

/* ===== Note → line in parent ("→ regel") + labeled delete ===== */
.btn-to-line {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  flex-shrink: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.btn-to-line[hidden] { display: none; }
.btn-to-line:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn-delete-note.btn-delete-labeled {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: auto;
  height: 26px;
  padding: 0 10px 0 8px;
  border-radius: 999px;
  border-color: #e3b5ae;
  color: #a5352a;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  filter: none;
  opacity: 1;
}
.btn-delete-note.btn-delete-labeled:hover { border-color: #c0392b; background: #fdecea; }
.tree-item .tree-to-line { font-size: 12px; }
.tree-item .tree-to-line + .tree-up { margin-left: 0; }
.toast.has-action { pointer-events: auto; display: flex; align-items: center; gap: 12px; }
.toast-btn {
  border: none;
  background: transparent;
  color: #8fd0f2;
  font-weight: 600;
  font-size: 13px;
  padding: 2px 4px;
  cursor: pointer;
  text-decoration: underline;
}
@media (max-width: 900px) {
  .sn-toolbar { flex-wrap: wrap; row-gap: 6px; padding: 8px 12px; }
  .sn-toolbar .breadcrumb { flex-basis: 100%; order: 10; font-size: 12px; }
  .sn-toolbar .btn-up-parent { max-width: 55%; }
}

/* ===== Delegation layer (Wacht op mij / Wacht op anderen / rode stip) ===== */
.red-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d1372e;
  box-shadow: 0 0 0 2px rgba(209, 55, 46, 0.15);
  margin-left: 6px;
  vertical-align: middle;
  flex: 0 0 auto;
}
.red-dot.inline { margin: 0 6px 0 0; }
.tree-item .red-dot { margin-left: 6px; }

.actions-list.waiting-list .action-row.w-row {
  grid-template-columns: 16px minmax(0, 1fr) auto 64px;
  align-items: start;
  padding: 9px 10px;
}
.w-dot-slot { padding-top: 5px; }
.w-dot-slot .red-dot { margin: 0; }
.w-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.w-row .title { white-space: normal; overflow: visible; line-height: 1.35; }
.w-what {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.w-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; max-width: 380px; padding-top: 1px; }
.w-meta .note-ref { font-size: 11px; color: var(--muted); max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.w-meta .note-ref:hover { color: var(--ink); text-decoration: underline; }
.w-owner, .w-due, .w-still, .w-who {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--muted);
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.w-due { background: #eef2f8; color: #3b5578; }
.w-due.overdue { background: #fbe9e7; color: #a33a2f; font-weight: 500; }
.w-still.stalled { background: #fbe9e7; color: #a33a2f; }
.w-who { background: #f3efe6; color: var(--warn); }
.w-who.w-bot { background: #eef2f8; color: #3b5578; }
.w-who.w-extern { background: #f3efe6; color: var(--warn); }
.w-who.w-actie { background: #efeefa; color: #4b4796; }
.action-row .title .w-who { margin-left: 8px; font-weight: 400; vertical-align: middle; }
.ap-row .w-who { margin-left: 6px; font-size: 10px; }
.w-btns { padding-top: 1px; }

.deleg-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 10px 6px;
  margin: 8px 0 10px;
  background: #fbfaf7;
}
.deleg-head { font-size: 12px; font-weight: 600; margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }
.deleg-need { font-size: 11px; font-weight: 400; color: #a33a2f; background: #fbe9e7; padding: 1px 7px; border-radius: 999px; }
.deleg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.deleg-box .fld { margin-bottom: 6px; }
.deleg-box select, .deleg-box input { width: 100%; }
.deleg-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 11px; color: var(--muted); margin-top: 2px; align-items: center; }

.of-stuck { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.of-stuck-row { display: flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.of-stuck-row:hover { background: var(--chip); }
.of-stuck-row .t { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 760px) {
  .actions-list.waiting-list .action-row.w-row { grid-template-columns: 14px minmax(0, 1fr) 56px; }
  .w-meta { grid-column: 2 / 3; justify-content: flex-start; max-width: none; }
  .tabs { flex-wrap: wrap; }
}
#actionDetailContent[hidden], .quick-add[hidden], .toggle-pill[hidden], .deleg-need[hidden], #adTrackerRow[hidden] { display: none !important; }
.detail-empty[hidden] { display: none !important; }
