/* ============================================================
   Boards — Drone, Horizon and Content follow-ups, projects, notes
   (page-board.js, lib/board-ui.js) and the lead, follow-up and
   note forms. Prefix bd-. Tokens only, so a re-theme is a swap.
   ============================================================ */

.bd-subtitle { font-size: 14px; color: hsl(var(--muted-foreground)); margin-top: 4px; }

/* ── tabs ───────────────────────────────────────────────────────── */

.bd-tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--gray-border);
  margin-bottom: var(--space-lg);
  overflow-x: auto;
  scrollbar-width: none;
}
.bd-tabs::-webkit-scrollbar { display: none; }
.bd-tab {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  margin-bottom: -1px;
  border: 0; border-bottom: 2px solid transparent;
  background: transparent;
  font-weight: 600; font-size: 14.5px;
  color: hsl(var(--muted-foreground));
  cursor: pointer; white-space: nowrap;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.bd-tab:hover { color: var(--black); }
.bd-tab[aria-selected="true"] { color: var(--black); border-bottom-color: var(--cyan); }
.bd-tab-count {
  font-size: 12px; font-weight: 700; line-height: 1;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: var(--gray-soft); border: 1px solid var(--gray-border);
  color: var(--gray-muted-text);
}
.bd-tab-count:empty { display: none; }
.bd-pane[hidden] { display: none; }

.bd-panel { padding-top: var(--space-md); }

.bd-filters { margin-bottom: var(--space-md); }

/* ── status colours: the pills, the select and the group bars ───── */

.bd-st-new  { color: var(--gray-muted-text); background-color: var(--gray-soft);    border-color: var(--gray-border); }
.bd-st-me   { color: var(--cyan-ink);        background-color: var(--cyan-tint);    border-color: var(--cyan-line); }
.bd-st-them { color: var(--warning-ink);     background-color: var(--warning-tint); border-color: var(--warning-line); }
.bd-st-ice  { color: var(--danger-ink);      background-color: var(--danger-tint);  border-color: var(--danger-line); }
.bd-st-done { color: var(--success-ink);     background-color: var(--success-tint); border-color: var(--success-line); }

.bd-pill {
  display: inline-flex; align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--gray-border);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}

/* The status pill is a real <select>, so it works with a thumb on any phone. */
.bd-status {
  -webkit-appearance: none; appearance: none;
  width: 100%; max-width: 190px;
  min-height: 38px;
  padding: 6px 30px 6px 12px;
  border: 1px solid var(--gray-border);
  border-radius: var(--radius-full);
  font-size: 13px; font-weight: 600; line-height: 1.2;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 15px center, right 10px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  transition: box-shadow var(--dur-fast) var(--ease);
}
.bd-status:hover:not(:disabled) { box-shadow: 0 0 0 2px var(--cyan-line); }
.bd-status:disabled { cursor: default; opacity: 0.85; background-image: none; padding-right: 12px; }
.bd-status option { color: var(--black); background: var(--white); }

.bd-rating {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  white-space: nowrap;
}
.bd-rating-hot  { color: var(--danger-ink);  background: var(--danger-tint);  border-color: var(--danger-line); }
.bd-rating-warm { color: var(--warning-ink); background: var(--warning-tint); border-color: var(--warning-line); }
.bd-rating-cold { color: var(--cyan-ink);    background: var(--cyan-tint);    border-color: var(--cyan-line); }

.bd-tag {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--gray-soft); border: 1px solid var(--gray-border);
  font-size: 12px; font-weight: 600; color: var(--black);
  white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.bd-meta { font-size: 13px; color: hsl(var(--muted-foreground)); }
.bd-due-late { color: var(--danger-ink); font-weight: 600; }
.bd-due-now  { color: var(--warning-ink); font-weight: 700; }
.bd-why { font-size: 12.5px; color: var(--danger-ink); }
.bd-today { font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--cyan-ink); }

/* ── groups ─────────────────────────────────────────────────────── */

.bd-groups { display: flex; flex-direction: column; gap: var(--space-lg); }

.bd-group { --bd-accent: var(--chart-muted); border-left: 4px solid var(--bd-accent); padding-left: var(--space-sm); }
.bd-group-me   { --bd-accent: var(--cyan); }
.bd-group-them { --bd-accent: var(--warning); }
.bd-group-ice  { --bd-accent: var(--danger); }
.bd-group-done { --bd-accent: var(--success); }

.bd-group-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); }
.bd-group-toggle {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 6px 4px;
  border: 0; background: transparent;
  font-weight: 700; font-size: 15.5px; letter-spacing: -0.01em; color: var(--black);
  cursor: pointer;
}
.bd-group-caret {
  width: 8px; height: 8px;
  border: solid var(--gray-muted-text); border-width: 0 2px 2px 0;
  transform: rotate(45deg); margin-top: -3px;
  transition: transform var(--dur-fast) var(--ease);
}
.bd-group-toggle[aria-expanded="false"] .bd-group-caret { transform: rotate(-45deg); margin-top: 0; }
.bd-group-count {
  font-size: 12px; font-weight: 700;
  padding: 2px 8px; border-radius: var(--radius-full);
  background: var(--gray-soft); border: 1px solid var(--gray-border); color: var(--gray-muted-text);
}
.bd-group-add { min-height: 36px; }
.bd-group-empty { padding: 6px 12px 10px; font-size: 13px; color: hsl(var(--muted-foreground)); }

/* ── rows: two lines by default, a full table on wide screens ───── */

.bd-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) auto;
  grid-template-areas:
    "status main due"
    "status meta meta";
  column-gap: var(--space-md);
  row-gap: 4px;
  align-items: center;
  padding: 10px 8px;
  border-top: 1px solid var(--gray-border);
}
.bd-group-body > .bd-row:nth-child(2) { border-top: 0; }
.bd-row-head { display: none; }

.bd-c-status { grid-area: status; align-self: start; padding-top: 4px; }
.bd-c-main   { grid-area: main; }
.bd-c-due    { grid-area: due; text-align: right; white-space: nowrap; }
.bd-c-meta   { grid-area: meta; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-width: 0; }
.bd-c-meta > div:empty { display: none; }

button.bd-c-main {
  display: flex; flex-direction: column; justify-content: center; gap: 1px;
  min-width: 0; width: 100%; min-height: 44px;
  padding: 2px 0;
  border: 0; background: transparent;
  text-align: left; cursor: pointer;
}
.bd-who  { font-size: 12.5px; font-weight: 600; color: hsl(var(--muted-foreground)); overflow-wrap: anywhere; }
.bd-what { font-size: 14.5px; font-weight: 600; color: var(--black); line-height: 1.35; overflow-wrap: anywhere; }
button.bd-c-main:hover .bd-what { text-decoration: underline; text-decoration-color: var(--cyan); text-underline-offset: 3px; }
.bd-row-done .bd-what { color: hsl(var(--muted-foreground)); }

.bd-ice-ask {
  grid-column: 1 / -1;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-tint); border: 1px solid var(--danger-line);
}
.bd-ice-ask .lbl { color: var(--danger-ink); }
.bd-ice-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bd-ice-row .input { flex: 1 1 220px; min-width: 0; }
.bd-ice-row .btn { min-height: 44px; }

@media (min-width: 1600px) {
  .bd-row {
    grid-template-columns: 150px minmax(200px, 2fr) 116px 116px 84px 64px 56px minmax(110px, 1fr) 64px;
    grid-template-areas: none;
    column-gap: 10px;
  }
  .bd-c-status, .bd-c-main, .bd-c-due { grid-area: auto; }
  .bd-c-due { text-align: left; }
  .bd-c-status { align-self: center; padding-top: 0; }
  .bd-c-meta { display: contents; }
  .bd-c-meta > div:empty { display: block; }
  .bd-row-head {
    display: grid;
    padding-top: 4px; padding-bottom: 6px;
    border-top: 0; border-bottom: 1px solid var(--gray-border);
    font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
    color: hsl(var(--muted-foreground));
  }
  .bd-proj-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ── projects ───────────────────────────────────────────────────── */

.bd-project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: var(--space-lg); }
.bd-project {
  --bd-accent: var(--cyan);
  display: flex; flex-direction: column; gap: 10px;
  background: var(--white);
  border: 1px solid var(--gray-border);
  border-top: 4px solid var(--bd-accent);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  min-width: 0;
}
.bd-project-on_ice { --bd-accent: var(--danger); }
.bd-project-done   { --bd-accent: var(--success); }
.bd-project-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-sm); }
.bd-project-name { font-size: 16.5px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.3; overflow-wrap: anywhere; }
.bd-project-goal {
  font-size: 13.5px; color: hsl(var(--muted-foreground)); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.bd-project-meta { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 12.5px; color: hsl(var(--muted-foreground)); }
.bd-project-latest { flex: 1; background: var(--gray-soft); border-radius: var(--radius-sm); padding: 10px 12px; }
.bd-project-latest-when { font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: hsl(var(--muted-foreground)); }
.bd-project-latest-body {
  font-size: 13.5px; line-height: 1.5; margin-top: 3px; white-space: pre-line; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.bd-project-foot { display: flex; justify-content: flex-end; }
.bd-project-foot .btn { min-height: 40px; }
.bd-done-projects { margin-top: var(--space-xl); }
.bd-done-projects .bd-project-grid { margin-top: var(--space-sm); }

/* ── notes ──────────────────────────────────────────────────────── */

.bd-jot { display: flex; flex-direction: column; gap: 8px; }
.bd-jot-host { margin-bottom: var(--space-md); padding-bottom: var(--space-md); border-bottom: 1px solid var(--gray-border); }
textarea.bd-jot-text { min-height: 84px; }
.bd-jot-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 14px; }
.bd-jot-project { width: auto; flex: 1 1 180px; max-width: 320px; }
.bd-jot-save { min-height: 44px; }
.bd-jot-pin { min-height: 44px; }

.bd-notes { display: flex; flex-direction: column; }
.bd-note .note-head { flex-wrap: wrap; }
.bd-note-body { color: var(--black); white-space: pre-wrap; overflow-wrap: anywhere; }
.bd-note-who { font-size: 12px; color: hsl(var(--muted-foreground)); }
.bd-note.is-pinned { border-left: 3px solid var(--cyan); padding-left: 12px; }
.note-kind.bd-pin-tag { color: var(--cyan-ink); background: var(--cyan-tint); border-color: var(--cyan-line); }
.bd-note-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.bd-note-actions .btn { min-height: 36px; }
.bd-note-edit-row { margin-top: 8px; }
.bd-notes-empty { padding: var(--space-xl) var(--space-md); }

/* ── the drawer (a wide modal) ──────────────────────────────────── */

.bd-plan {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px var(--space-md);
  padding: 10px 14px;
  background: var(--gray-soft); border: 1px solid var(--gray-border); border-radius: var(--radius-sm);
  font-size: 13.5px;
}
.bd-plan .btn { min-height: 40px; }
.bd-log { border-top: 1px solid var(--gray-border); margin-top: var(--space-md); padding-top: var(--space-md); }
.bd-log-title { font-size: 12.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: hsl(var(--muted-foreground)); margin-bottom: var(--space-sm); }
.bd-log .bd-jot { margin-bottom: var(--space-sm); }
.note-list.bd-log-list { max-height: 340px; }

.bd-linked { display: flex; flex-direction: column; gap: 6px; }
.bd-linked-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 44px;
  padding: 8px 12px;
  background: var(--white); border: 1px solid var(--gray-border); border-radius: var(--radius-sm);
  text-align: left; cursor: pointer;
}
.bd-linked-item:hover { border-color: var(--cyan-line); }
.bd-linked-title { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.bd-linked-none { font-size: 13px; padding: 4px 0; }
.bd-linked-add { align-self: flex-start; margin-top: 4px; }

.bd-del { margin-right: auto; }
.modal-actions:has(.bd-del) { flex-wrap: wrap; }

.bd-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px var(--space-md); margin: 0 0 var(--space-md); }
.bd-facts dt { font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: hsl(var(--muted-foreground)); }
.bd-facts dd { margin: 3px 0 0; font-size: 14px; }
.bd-detail {
  white-space: pre-wrap; overflow-wrap: anywhere;
  font-size: 14px; line-height: 1.55;
  background: var(--gray-soft); border-radius: var(--radius-sm); padding: 10px 12px;
  margin-bottom: var(--space-md);
}
.bd-project-read { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: var(--space-md); }
.bd-move .bd-status { max-width: 240px; min-height: 44px; }

/* ── forms: lead, follow-up, note ───────────────────────────────── */

.bd-form .form-card .field:last-child { margin-bottom: 0; }
.bd-form textarea.input { min-height: 88px; }
.bd-form-loading { padding: var(--space-sm) 0; font-size: 14px; color: hsl(var(--muted-foreground)); }
.bd-form-none { font-size: 13.5px; color: hsl(var(--muted-foreground)); }
.bd-form [data-bd-ice] .lbl { color: var(--danger-ink); }
.bd-form [data-bd-new] { margin-top: var(--space-md); padding-top: var(--space-md); border-top: 1px solid var(--gray-border); }
.bd-form .form-card-title .muted { text-transform: none; letter-spacing: 0; font-weight: 500; }

/* ── narrow screens ─────────────────────────────────────────────── */

@media (max-width: 900px) {
  .bd-filters .input, .bd-filters .grow { flex: 1 1 150px; min-width: 0; width: auto; }
  .bd-filters .grow { flex-basis: 100%; }
}

@media (max-width: 640px) {
  .bd-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "main main"
      "status due"
      "meta meta";
    padding: 12px 2px;
  }
  .bd-c-status { padding-top: 0; align-self: center; }
  .bd-status { min-height: 44px; }
  .bd-group { padding-left: 10px; }
  .bd-project-grid { grid-template-columns: minmax(0, 1fr); }
  .bd-facts { grid-template-columns: 1fr; }
  .bd-jot-project { max-width: none; flex-basis: 100%; }
  .bd-jot-save { flex: 1; }
  .bd-tab { padding: 10px 12px; }
}
