/* On the Projects tab the project to-dos live inside the mind-map itself, so the
   right To-do pane is redundant — hide it and let the board breathe full-width.
   Mirrors .layout.notes-mode; only needed ≥1081px (≤1080px already hides .todo). */
@media (min-width: 1081px) {
  .layout.projects-mode {
    grid-template-columns: 290px 1fr;
  }
  .layout.projects-mode .todo {
    display: none;
  }
}

/* ---------- Format dropdown triggers (inline in toolbar) ---------- */
.mm-fmt-inline {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.mm-dd-trigger {
  width: auto;
  gap: 5px;
  padding: 0 8px;
  font-size: var(--fs-sm);
  color: var(--ink);
}

.mm-dd-trigger:active:not(:disabled) {
  transform: scale(0.97);
}

.mm-dd-trigger.is-active {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.mm-fill-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--mm-dot, var(--accent));
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.18);
}

.mm-aa {
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
  letter-spacing: -0.01em;
}

.mm-caret {
  width: 9px;
  height: 6px;
  opacity: 0.55;
  transition: transform var(--dur) var(--ease);
}

.mm-dd-trigger[aria-expanded="true"] .mm-caret {
  transform: rotate(180deg);
}

/* ---------- Popovers (fill / text format) ---------- */
.mm-popover {
  position: fixed;
  z-index: calc(var(--z-modal) + 5);
  min-width: 188px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  transform-origin: top left;
  opacity: 0;
  transform: scale(0.96) translateY(-5px);
  transition: opacity 180ms var(--ease), transform 180ms var(--ease);
}

.mm-popover.is-open {
  opacity: 1;
  transform: none;
}

.mm-pop-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mm-pop-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.01em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mm-pop-val {
  font-weight: 500;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

/* swatches */
.mm-swatch-row {
  display: flex;
  gap: 8px;
}

.mm-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex: none;
  padding: 0;
  border: 2px solid var(--surface);
  cursor: pointer;
  position: relative;
  box-shadow: 0 0 0 1px var(--border);
  transition: transform 140ms var(--ease), box-shadow 140ms var(--ease);
}

.mm-swatch:hover {
  transform: scale(1.12);
  box-shadow: 0 0 0 1px var(--border-strong);
}

.mm-swatch:active {
  transform: scale(0.94);
}

.mm-swatch.is-active {
  box-shadow: 0 0 0 2px var(--accent);
}

.mm-swatch.is-active::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-fg);
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.15);
}

.mm-swatch-auto {
  background: conic-gradient(from 135deg, var(--ink) 0 50%, var(--surface-2) 50% 100%);
}

/* custom-color wheel — a round swatch with a rainbow ring that opens the native picker */
.mm-wheel-wrap {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex: none;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
  background: conic-gradient(#f87171, #fbbf24, #34d399, #60a5fa, #a78bfa, #f472b6, #f87171);
  transition: transform 140ms var(--ease), box-shadow 140ms var(--ease);
}

.mm-wheel-wrap:hover {
  transform: scale(1.12);
  box-shadow: 0 0 0 1px var(--border-strong);
}

.mm-wheel-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.15);
}

.mm-wheel {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  padding: 0;
  border: none;
  cursor: pointer;
}

/* link popover */
#mm-link-pop {
  min-width: 240px;
}

.mm-link-input {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-sm);
}

.mm-link-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent);
}

.mm-link-actions {
  display: flex;
  gap: 6px;
}

.mm-link-action {
  flex: 1;
  height: 30px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background 140ms var(--ease), border-color 140ms var(--ease), color 140ms var(--ease);
}

.mm-link-action:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.mm-link-action.danger:hover {
  color: var(--danger, #dc2626);
  border-color: color-mix(in srgb, var(--danger, #dc2626) 50%, var(--border));
}

.mm-link-action.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

.mm-link-action.primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, #000);
  border-color: color-mix(in srgb, var(--accent) 88%, #000);
  color: var(--accent-fg);
}

/* opacity slider */
.mm-opacity-slider {
  width: 100%;
  height: 4px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* size buttons */
.mm-size-row {
  display: flex;
  gap: 4px;
}

.mm-size-btn {
  flex: 1;
  height: 28px;
  padding: 0;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.mm-size-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.mm-size-btn:active {
  transform: scale(0.96);
}

.mm-size-btn.is-active {
  background: var(--accent-soft);
  color: var(--accent-text);
  border-color: transparent;
}

/* style / align buttons */
.mm-btn-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.mm-subsep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 2px;
  flex: none;
}

.mm-fmt-btn {
  width: 30px;
  height: 30px;
  flex: none;
  border: 1px solid var(--border);
}

.mm-fmt-btn:hover:not(:disabled) {
  background: var(--surface-2);
}

.mm-fmt-btn:active {
  transform: scale(0.95);
}

.mm-fmt-btn svg {
  width: 15px;
  height: 15px;
}

.mm-fmt-btn.is-active {
  background: var(--accent-soft);
  color: var(--accent-text);
  border-color: transparent;
}

/* ---------- Icon picker + icon (sticker) nodes ---------- */
.mm-icon-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  max-width: 252px;
}

.mm-icon-opt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.mm-icon-opt svg {
  width: 20px;
  height: 20px;
}

.mm-icon-opt:hover {
  background: var(--surface-2);
  color: var(--accent-text);
}

.mm-icon-opt:active {
  transform: scale(0.92);
}

.mm-icon-opt.is-active {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.wb-node.wb-icon {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  padding: 8px;
  align-items: center;
  justify-content: center;
  cursor: grab;
}

.wb-node.wb-icon:hover {
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  box-shadow: none;
}

.node-group.selected .wb-icon {
  background: color-mix(in srgb, var(--node-color, var(--accent)) 10%, transparent);
}

.wb-icon-glyph {
  color: var(--node-color, var(--accent));
  display: flex;
  width: 100%;
}

.wb-icon-glyph svg {
  width: 100%;
  height: auto;
  display: block;
}

/* ---------- Paint-format mode cursor ---------- */
.mindmap-canvas.is-paint,
.mindmap-canvas.is-paint .wb-svg,
.mindmap-canvas.is-paint .wb-node {
  cursor: copy;
}

.mm-tool[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent-text);
}

/* ---------- Marquee selection rectangle ---------- */
.wb-marquee {
  fill: color-mix(in srgb, var(--accent) 12%, transparent);
  stroke: var(--accent);
  stroke-width: 1px;
  stroke-dasharray: 4 3;
  pointer-events: none;
}

/* ---------- Per-branch fold / unfold chevrons (one per connector) ----------
   A node carries one chevron per direct child, sitting on that child's connector.
   Expanded branches reveal their chevron on hover/selection (kept clean otherwise);
   folded branches keep theirs visible so you can expand again. The chevron's rotation
   is set inline (it follows the branch angle), animated via the transition below. */
/* The fold circle is the branch-point ORIGIN for child links (NotebookLM-style), so on a
   populated side it stays visible at rest — not just on hover. The "+" adder stays
   hover-only. Unpopulated sides are display:none'd in JS, so only real branches show one. */
.wb-fold {
  opacity: 1;
  cursor: pointer;
  transition: opacity var(--dur) var(--ease), fill var(--dur) var(--ease);
  pointer-events: auto;
}

.wb-fold circle {
  fill: var(--surface);
  stroke: var(--node-color, var(--accent));
  stroke-width: 1.5px;
  transition: fill var(--dur) var(--ease);
  filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.12));
}

.wb-fold:hover circle {
  fill: color-mix(in srgb, var(--node-color, var(--accent)) 14%, var(--surface));
}

.wb-fold-chev {
  fill: none;
  stroke: var(--node-color, var(--accent));
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.26s cubic-bezier(0.34, 1.4, 0.5, 1);
}

.wb-fold:hover .wb-fold-chev {
  stroke-width: 2.4;
}

.wb-fold.is-folded circle {
  fill: var(--node-color, var(--accent));
  stroke: var(--node-color, var(--accent));
}

.wb-fold.is-folded .wb-fold-chev {
  stroke: #fff;
}

@media (prefers-reduced-motion: reduce) {
  .wb-fold-chev {
    transition: none;
  }
}

/* Icon (sticker) nodes don't branch — no "+" adders or fold chevrons. */
.node-group.is-icon-node .wb-adder,
.node-group.is-icon-node .wb-fold {
  display: none !important;
}


/* ---------- Grouped tool flyouts (Insert / Draw) ---------- */
#mm-insert-pop .mm-btn-row,
#mm-draw-pop .mm-btn-row {
  gap: 6px;
}

#mm-insert-pop .mm-fmt-btn,
#mm-draw-pop .mm-fmt-btn {
  width: 34px;
  height: 34px;
}

#mm-insert-pop .mm-fmt-btn svg,
#mm-draw-pop .mm-fmt-btn svg {
  width: 18px;
  height: 18px;
}

#mm-insert-pop .mm-fmt-btn.is-active,
#mm-draw-pop .mm-fmt-btn.is-active {
  background: var(--accent-soft);
  color: var(--accent-text);
  border-color: transparent;
}

/* Table button (Add to board): table icon + a small dropdown chevron */
#mm-insert-pop .mm-table-btn {
  width: auto;
  padding: 0 5px 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

#mm-insert-pop .mm-table-btn .mm-chev {
  width: 12px;
  height: 12px;
  transition: transform var(--dur) var(--ease);
}

#mm-insert-pop .mm-table-btn[aria-expanded="true"] .mm-chev {
  transform: rotate(180deg);
}

/* Table size chooser (Insert flyout) — same grid UX as the Notes tool */
.mm-table-grid {
  display: grid;
  grid-template-columns: repeat(6, 18px);
  gap: 3px;
  padding: 2px;
}

.mm-grid-cell {
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background: none;
  padding: 0;
  cursor: pointer;
}

.mm-grid-cell.on {
  background: var(--accent-soft);
  border-color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {

  .mm-tool,
  .fab-btn,
  .wb-node,
  .wb-adder circle,
  .wb-resize,
  .wb-title-input,
  .wb-note-text {
    transition: none !important;
  }

  .mm-swatch,
  .mm-caret,
  .mm-size-btn,
  .mm-icon-opt {
    transition: none !important;
  }

  .mm-popover {
    transition: opacity 120ms linear;
  }

  .mm-popover:not(.is-open) {
    transform: none;
  }
}

/* (Project to-do right-pane styles removed — project to-dos now live in the
   mind-map; the right pane is Bookmarks-tab General To-dos only.) */