/* Post-it Board (global: loaded from base so board + colored notes work on every page) */
#postitBoard .tab-pane.show {
  display: flex !important;
}
#postitBoard .tab-pane .postit-board {
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
}
#postitBoard #pane-user .postit-board {
  margin-top: 0;
}
#postitBoard .postit-board-resize-handle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: ew-resize;
  z-index: 30;
}
#postitBoard .postit-board-resize-handle:hover {
  background: rgba(13, 110, 253, 0.15);
}
@media (min-width: 1200px) {
  #postitBoard { --bs-offcanvas-width: 640px; }
}

/* Mobile: full-width panel + flex chain so the cork board scrolls */
@media (max-width: 768px) {
  #postitBoard.offcanvas {
    width: 100% !important;
    max-width: 100% !important;
  }
  #postitBoard .postit-board-resize-handle {
    display: none !important;
  }
  #postitBoard .offcanvas-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: calc(100dvh - 72px) !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }
  #postitBoard #postitPanes.tab-content {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }
  #postitBoard #postitPanes .tab-pane {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }
  #postitBoard #postitPanes .tab-pane.active,
  #postitBoard #postitPanes .tab-pane.show {
    display: flex !important;
    flex-direction: column !important;
  }
  #postitBoard .postit-board {
    flex: 1 1 auto !important;
    min-height: 200px !important;
    max-height: none !important;
    -webkit-overflow-scrolling: touch;
  }
}

/* Board: cork-style background and dashed border */
.postit-board {
  position: relative;
  min-height: 200px;
  background: #e8e4dc;
  background-image: linear-gradient(rgba(0,0,0,.02) 1px, transparent 1px), linear-gradient(90deg, rgba(0,0,0,.02) 1px, transparent 1px);
  background-size: 16px 16px;
  border: 1px dashed #c4b8a8;
  border-radius: 12px;
  padding: 12px;
  overflow: auto;
}

/* Colored post-it notes */
.postit {
  position: absolute;
  width: 220px;
  min-height: 120px;
  padding: 10px 12px 28px 12px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(16,24,40,.15), 0 1px 2px rgba(16,24,40,.08);
  cursor: move;
  white-space: pre-wrap;
  line-height: 1.25;
  font-weight: 600;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
/* When post-it has toolbar (pin, todo, use for client/job, close), reserve top row so controls never overlap text */
.postit.postit-with-toolbar {
  padding-top: 34px;
}
/* Toolbar row: flex so buttons never overlap */
.postit .postit-toolbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  padding: 6px;
  z-index: 10;
}
.postit .postit-toolbar .close-x,
.postit .postit-toolbar .pin-btn,
.postit .postit-toolbar .postit-todo-btn,
.postit .postit-toolbar .postit-ref-btn {
  position: static;
  right: auto;
  left: auto;
  flex-shrink: 0;
}
.postit .postit-body {
  flex: 1;
  overflow-y: auto;
  word-wrap: break-word;
  min-height: 0;
}
.postit .postit-body.editable {
  cursor: text;
}
.postit .postit-body[contenteditable="true"] {
  outline: 2px solid rgba(37, 99, 235, 0.55);
  outline-offset: 2px;
  background: rgba(255,255,255,0.35);
}
.postit .postit-meta {
  display: block;
  color: #334155;
  font-weight: 500;
  margin-top: 6px;
  flex-shrink: 0;
}
.postit small { display: block; color: #334155; font-weight: 500; margin-top: 6px; }
.postit .close-x {
  position: absolute; right: 6px; top: 6px;
  background: rgba(0,0,0,.08); border: 0; border-radius: 50%;
  width: 22px; height: 22px; line-height: 22px; text-align: center;
  font-weight: 800; cursor: pointer;
  z-index: 10;
}
.postit .close-x:hover { background: rgba(0,0,0,.18); }
.postit .pin-btn {
  position: absolute; right: 34px; top: 6px; left: auto;
  background: rgba(0,0,0,.08); border: 0; border-radius: 50%;
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 10;
}
.postit .pin-btn:hover { background: rgba(0,0,0,.18); }
/* Transfer-to-To-Do: left of pin (pin is at 34px, 22px wide → ends at 56px; leave ~14px gap) */
.postit .postit-todo-btn { right: 70px; left: auto; }
/* Use for client / New job from this: left of todo (70 + 22 + 14 = 106, then 142) */
.postit .postit-ref-btn {
  position: absolute; top: 6px; left: auto;
  background: rgba(0,0,0,.08); border: 0; border-radius: 50%;
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 10;
}
.postit .postit-ref-btn:hover { background: rgba(0,0,0,.18); }
.postit .postit-ref-btn { right: 142px; }
.postit .postit-ref-btn ~ .postit-ref-btn { right: 106px; }
/* Small "+" next to briefcase (New job) icon */
.postit-btn-plus {
  font-size: 0.7em;
  font-weight: 700;
  margin-left: 1px;
  line-height: 1;
  vertical-align: super;
}
.postit.pinned { outline: 2px solid rgba(37, 99, 235, 0.55); outline-offset: 2px; }
.postit.pinned .pin-btn { background: rgba(37, 99, 235, 0.20); }
.postit .postit-resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  background: linear-gradient(-45deg, transparent 40%, rgba(0,0,0,.2) 40%, rgba(0,0,0,.2) 50%, transparent 50%, transparent 60%, rgba(0,0,0,.2) 60%, rgba(0,0,0,.2) 70%, transparent 70%);
  z-index: 10;
}
.postit .postit-resize-handle:hover {
  background: linear-gradient(-45deg, transparent 40%, rgba(0,0,0,.4) 40%, rgba(0,0,0,.4) 50%, transparent 50%, transparent 60%, rgba(0,0,0,.4) 60%, rgba(0,0,0,.4) 70%, transparent 70%);
}
/* Yellow, green, blue, pink */
.postit.y { background: #fef3b8; border: 2px solid #f4d34f; color: #1e293b; }
.postit.g { background: #d3f7d6; border: 2px solid #77d38a; color: #1e293b; }
.postit.b { background: #d9edff; border: 2px solid #78aef1; color: #1e293b; }
.postit.p { background: #ffd9ea; border: 2px solid #f884b1; color: #1e293b; }
.postit.unread { outline: 2px dashed #ef4444; outline-offset: 2px; }
