/* ============================================================================
   Kanban board view (?view=kanban)
   Self-contained styles for the Hub's pipeline board. Reuses the Hub design
   tokens (--matrix / --bg-card / --text / Figtree / Playfair) so it reads as
   native chrome in both dark and light themes. All selectors are namespaced
   `.pbk-` to avoid colliding with the 16k-line Hub stylesheet.
   Desktop-optimized: columns scroll horizontally; a guard panel shows on
   narrow viewports.
   ========================================================================== */

/* Full-screen surface, mounted below the live Hub header (top set by JS,
   mirroring #blog-view / #mail-view). Hidden until the view activates. */
#kanban-view {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg, #0e0f12);
  z-index: 90;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
#kanban-view.on { display: flex; }
body.kanban-view-active { overflow: hidden; }

/* ── Toolbar ───────────────────────────────────────────────────────────── */
.pbk-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border, rgba(245,243,239,0.12));
  background: var(--bg-card, #1e2024);
  flex-wrap: wrap;
}
.pbk-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 19px;
  font-weight: 600;
  color: var(--text, #f5f3ef);
  letter-spacing: 0.2px;
  margin-right: 4px;
}
.pbk-title .pbk-count {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-muted, rgba(245,243,239,0.55));
  margin-left: 8px;
}

.pbk-toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pbk-toolbar-spacer { flex: 1 1 auto; }
.pbk-group-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted, rgba(245,243,239,0.55));
  margin-right: 2px;
}

/* Kind toggles (Clients / Leads) — pill buttons that filter the board. */
.pbk-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: 'Figtree', sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-soft, rgba(245,243,239,0.80));
  background: var(--bg-2, #161821);
  border: 1px solid var(--border, rgba(245,243,239,0.12));
  border-radius: 999px;
  padding: 6px 13px 6px 11px;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s, opacity .15s;
  user-select: none;
}
.pbk-toggle:hover { border-color: var(--matrix-border, rgba(62,207,142,0.32)); }
.pbk-toggle .pbk-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: currentColor; flex: 0 0 auto;
}
.pbk-toggle.pbk-kind-client  { --pbk-kc: #4aa3ff; }
.pbk-toggle.pbk-kind-lead    { --pbk-kc: #c98bff; }
.pbk-toggle.pbk-kind-project { --pbk-kc: #3ecf8e; }
.pbk-toggle.pbk-filter-fav      { --pbk-kc: var(--amber, #f0a500); }
.pbk-toggle.pbk-filter-priority { --pbk-kc: var(--red, #ff4444); }
.pbk-toggle .pbk-dot { color: var(--pbk-kc, var(--matrix, #3ecf8e)); }
/* Filter toggles use the ★ / 🚩 glyph in place of the round dot. */
.pbk-filter-fav .pbk-dot,
.pbk-filter-priority .pbk-dot {
  width: auto; height: auto; background: none; border-radius: 0;
  font-size: 12px; line-height: 1; color: var(--pbk-kc);
}
.pbk-toggle.on {
  color: var(--text, #f5f3ef);
  background: color-mix(in srgb, var(--pbk-kc, #3ecf8e) 14%, var(--bg-2, #161821));
  border-color: var(--pbk-kc, var(--matrix, #3ecf8e));
}
.pbk-toggle.off { opacity: 0.45; }
.pbk-toggle.off .pbk-dot { background: var(--text-muted, #777); color: var(--text-muted, #777); }
.pbk-toggle .pbk-toggle-n {
  font-family: 'DM Mono', monospace;
  font-size: 10.5px;
  color: var(--text-muted, rgba(245,243,239,0.55));
}

/* Per-column sort dropdown */
.pbk-sort {
  font-family: 'Figtree', sans-serif;
  font-size: 11px;
  color: var(--text-soft, rgba(245,243,239,0.80));
  background: var(--bg-2, #161821);
  border: 1px solid var(--border, rgba(245,243,239,0.14));
  border-radius: 6px;
  padding: 2px 4px;
  margin-left: 6px;
  cursor: pointer;
  max-width: 92px;
}
.pbk-sort:hover { border-color: var(--matrix-border, rgba(62,207,142,0.32)); }
.pbk-sort:focus { outline: none; border-color: var(--matrix, #3ecf8e); }

/* Icon legend ($ paid / 🚩 urgent / ★ favourite) */
.pbk-legend {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: 'Figtree', sans-serif;
  font-size: 11.5px;
  color: var(--text-muted, rgba(245,243,239,0.55));
}
.pbk-legend span { display: inline-flex; align-items: center; gap: 5px; }
.pbk-legend .pbk-lg-ico { font-size: 13px; line-height: 1; }
.pbk-lg-paid { color: var(--matrix, #3ecf8e); font-weight: 700; }
.pbk-lg-urgent { color: var(--red, #ff4444); }
.pbk-lg-fav { color: var(--amber, #f0a500); }

.pbk-refresh {
  font-family: 'Figtree', sans-serif;
  font-size: 12px;
  color: var(--text-soft, rgba(245,243,239,0.80));
  background: var(--bg-2, #161821);
  border: 1px solid var(--border, rgba(245,243,239,0.12));
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
}
.pbk-refresh:hover { border-color: var(--matrix-border, rgba(62,207,142,0.32)); }

/* ── Board ─────────────────────────────────────────────────────────────── */
.pbk-board {
  flex: 1 1 auto;
  display: flex;
  gap: 16px;
  padding: 18px 22px 26px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
}
.pbk-board::-webkit-scrollbar { height: 10px; }
.pbk-board::-webkit-scrollbar-thumb {
  background: var(--border, rgba(245,243,239,0.18));
  border-radius: 6px;
}

.pbk-col {
  flex: 0 0 300px;
  width: 300px;
  display: flex;
  flex-direction: column;
  background: var(--bg-card, #1e2024);
  border: 1px solid var(--border, rgba(245,243,239,0.12));
  border-top: 3px solid var(--pbk-stage, var(--matrix, #3ecf8e));
  border-radius: 12px;
  max-height: 100%;
}
.pbk-col-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 10px;
}
.pbk-col-name {
  font-family: 'Figtree', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text, #f5f3ef);
}
.pbk-col-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--pbk-stage, var(--matrix, #3ecf8e));
  flex: 0 0 auto;
}
.pbk-col-count {
  margin-left: auto;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-muted, rgba(245,243,239,0.55));
  background: var(--bg-2, #161821);
  border-radius: 999px;
  padding: 2px 8px;
}
.pbk-col-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 4px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 60px;
}
.pbk-col-body::-webkit-scrollbar { width: 8px; }
.pbk-col-body::-webkit-scrollbar-thumb {
  background: var(--border, rgba(245,243,239,0.16));
  border-radius: 5px;
}
/* Drop target highlight while dragging a card over a column */
.pbk-col.pbk-drag-over {
  border-color: var(--matrix, #3ecf8e);
  background: var(--matrix-pale, rgba(62,207,142,0.10));
}
.pbk-col.pbk-drag-over .pbk-col-body { outline: 2px dashed var(--matrix-border, rgba(62,207,142,0.4)); outline-offset: -4px; border-radius: 8px; }

.pbk-col-empty {
  font-family: 'Figtree', sans-serif;
  font-size: 12px;
  color: var(--text-muted, rgba(245,243,239,0.45));
  text-align: center;
  padding: 22px 8px;
  border: 1px dashed var(--border, rgba(245,243,239,0.14));
  border-radius: 8px;
}

/* ── Card ──────────────────────────────────────────────────────────────── */
.pbk-card {
  position: relative;
  background: var(--bg-2, #161821);
  border: 1px solid var(--border, rgba(245,243,239,0.12));
  border-left: 3px solid var(--pbk-kind, var(--matrix, #3ecf8e));
  border-radius: 10px;
  padding: 11px 12px 10px;
  cursor: grab;
  transition: border-color .14s, box-shadow .14s, transform .06s;
}
.pbk-card:hover {
  border-color: var(--matrix-border, rgba(62,207,142,0.4));
  box-shadow: var(--shadow, 0 4px 24px rgba(0,0,0,0.45));
}
.pbk-card.pbk-dragging {
  opacity: 0.5;
  cursor: grabbing;
  transform: scale(0.98);
}

.pbk-card-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
  min-height: 18px;
}
.pbk-kind-chip {
  font-family: 'DM Mono', monospace;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--pbk-kind, var(--matrix, #3ecf8e));
  border: 1px solid color-mix(in srgb, var(--pbk-kind, #3ecf8e) 45%, transparent);
  border-radius: 4px;
  padding: 1px 5px;
}
.pbk-card-badges { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
/* Clickable badge toggles ($ paid / 🚩 urgent / ★ favourite) */
.pbk-badge {
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  opacity: 0.28;
  transition: opacity .14s, transform .1s;
  background: none; border: none; padding: 0; color: inherit;
}
.pbk-badge:hover { transform: scale(1.18); }
.pbk-badge.on { opacity: 1; }
.pbk-badge-paid.on { color: var(--matrix, #3ecf8e); font-weight: 800; }
.pbk-badge-urgent.on { color: var(--red, #ff4444); }
.pbk-badge-fav.on { color: var(--amber, #f0a500); }

.pbk-card-name {
  font-family: 'Figtree', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #f5f3ef);
  line-height: 1.3;
  margin-bottom: 4px;
}
.pbk-card-note {
  font-family: 'Figtree', sans-serif;
  font-size: 12px;
  color: var(--text-muted, rgba(245,243,239,0.55));
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
}

/* Service tags */
.pbk-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 9px; }
.pbk-tag {
  font-family: 'Figtree', sans-serif;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-soft, rgba(245,243,239,0.80));
  background: var(--matrix-pale, rgba(62,207,142,0.10));
  border: 1px solid var(--matrix-border, rgba(62,207,142,0.28));
  border-radius: 5px;
  padding: 2px 7px;
  white-space: nowrap;
}

.pbk-card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pbk-due {
  font-family: 'DM Mono', monospace;
  font-size: 10.5px;
  color: var(--text-muted, rgba(245,243,239,0.55));
}
.pbk-due.overdue { color: var(--red, #ff4444); }
.pbk-open {
  margin-left: auto;
  font-family: 'Figtree', sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--matrix, #3ecf8e);
  background: var(--matrix-pale, rgba(62,207,142,0.10));
  border: 1px solid var(--matrix-border, rgba(62,207,142,0.32));
  border-radius: 7px;
  padding: 4px 11px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background .14s, border-color .14s;
}
.pbk-open:hover {
  background: var(--matrix, #3ecf8e);
  color: var(--bg, #0e0f12);
  border-color: var(--matrix, #3ecf8e);
}

/* ── States: loading / empty / not-configured ─────────────────────────── */
.pbk-state {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted, rgba(245,243,239,0.55));
  font-family: 'Figtree', sans-serif;
  font-size: 14px;
  text-align: center;
  padding: 40px;
}
.pbk-state .pbk-state-emoji { font-size: 30px; opacity: 0.7; }
.pbk-spinner {
  width: 26px; height: 26px;
  border: 3px solid var(--border, rgba(245,243,239,0.2));
  border-top-color: var(--matrix, #3ecf8e);
  border-radius: 50%;
  animation: pbk-spin 0.8s linear infinite;
}
@keyframes pbk-spin { to { transform: rotate(360deg); } }

/* ── Desktop-only guard ───────────────────────────────────────────────── */
.pbk-narrow-guard {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 5;
  background: var(--bg, #0e0f12);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 32px;
  color: var(--text-soft, rgba(245,243,239,0.80));
  font-family: 'Figtree', sans-serif;
}
.pbk-narrow-guard .pbk-state-emoji { font-size: 34px; }
@media (max-width: 860px) {
  .pbk-narrow-guard { display: flex; }
}
