/* 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: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.brand .sub { font-size: 11px; color: var(--muted); margin-top: 1px; }

.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) 56px 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 */
.view-notes .tree-panel { width: 280px; flex: 0 0 280px; }
.view-notes .note-panel { flex: 1; }

.tree-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.tree-item:hover { background: var(--chip); }
.tree-item.selected { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.tree-item .twisty {
  width: 16px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  padding: 0;
}
.tree-item .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  opacity: 0.55;
  flex-shrink: 0;
}
.tree-item .counts { margin-left: auto; font-size: 11px; color: var(--muted); font-family: var(--mono); }
.tree-children { margin-left: 14px; border-left: 1px solid var(--line); padding-left: 4px; }
.tree-children.collapsed { display: none; }

.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); }

/* Objectives */
.view-objectives .objectives-panel { flex: 1; max-width: 720px; margin: 0 auto; border-right: none; width: 100%; }
.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 48px 24px 24px;
  }
  .action-row .note-ref { display: none; }
  .view-notes .tree-panel { width: 220px; flex-basis: 220px; }
}
