/* views-board.css — Super-admin backlog Board (#/board). Native to the platform
   tokens (tokens.css: --bg-*, --border, --text-*, --accent, --ok/--warn/--danger,
   --r-*, --s*); the layout + interaction design is ported from the FreqOps board
   reference artifact but restyled onto these tokens (no private palette). The two
   status colors the token set doesn't carry (decided=info, idea) are defined as
   locals scoped to .board-view so they never leak globally. */

.board-view {
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--s5) var(--s4) 64px;
  /* per-status colors (mapped to platform tokens where they exist) */
  --st-shipped: var(--ok);
  --st-in-progress: var(--accent);
  --st-decided: #42b6c9;
  --st-open: var(--text-muted);
  --st-blocked: var(--danger);
  --st-idea: #a98bf0;
}

/* ── Header ── */
.board-head { margin-bottom: var(--s4); }
.board-title { margin: 0 0 var(--s1); font-size: 24px; font-weight: 700; letter-spacing: -0.015em; color: var(--text-1); }
.board-sub { margin: 0; font-size: 13.5px; color: var(--text-2); }

/* ── Waiting-on-you headline ── */
.board-waiting-host { margin: var(--s4) 0 var(--s3); }
.board-waiting {
  width: 100%;
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg-card);
  color: var(--text-1);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.board-waiting.has-waiting {
  border-color: color-mix(in srgb, var(--warn) 55%, var(--border));
  background: linear-gradient(0deg, var(--warn-dim), var(--warn-dim)), var(--bg-card);
}
.board-waiting.has-waiting:hover { border-color: var(--warn); }
.board-waiting.on { box-shadow: var(--ring); }
.board-waiting.none { cursor: default; opacity: .8; }
.board-waiting-flag { font-size: 20px; line-height: 1; color: var(--warn); flex: 0 0 auto; }
.board-waiting.none .board-waiting-flag { color: var(--text-muted); }
.board-waiting-label { font-size: 15px; font-weight: 650; }
.board-waiting-hint { font-size: 12.5px; color: var(--text-2); margin-left: auto; }

/* ── Pinned triage strips (Needs your check / Recently shipped) ──
   Mirror the waiting-on-you card (same border/radius/tokens) but hold a LIST of
   entries rather than a single toggle. Hidden entirely when empty. */
.board-strip-host:empty { display: none; }
.board-strip {
  margin: 0 0 var(--s3);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg-card);
  overflow: hidden;
}
.board-strip-check {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  background: linear-gradient(0deg, var(--accent-soft), var(--accent-soft)), var(--bg-card);
}
.board-strip-shipped {
  border-color: color-mix(in srgb, var(--st-shipped) 40%, var(--border));
}
.board-strip-head {
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--border-subtle);
}
.board-strip-icon { font-size: 15px; line-height: 1; flex: 0 0 auto; }
.board-strip-label { font-size: 14px; font-weight: 650; color: var(--text-1); }
.board-strip-check .board-strip-label { color: var(--accent); }
.board-strip-shipped .board-strip-label { color: var(--st-shipped); }
.board-strip-list { padding: var(--s1) var(--s3) var(--s3); }
.board-strip-entry {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2);
  padding: var(--s2) var(--s1);
  border-top: 1px solid var(--border-subtle);
}
.board-strip-list > .board-strip-entry:first-child { border-top: 0; }
.board-strip-jump {
  flex: 1 1 200px; min-width: 0; text-align: left;
  border: 0; background: none; padding: 0; font: inherit; cursor: pointer;
  font-size: 13.5px; font-weight: 540; color: var(--text-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.board-strip-jump:hover { color: var(--accent); text-decoration: underline; }
.board-strip-mark { flex: 0 0 auto; font-size: 12px; padding: 5px 11px; white-space: nowrap; }

/* ── Collapsed "Done — confirmed" section (bottom of the board) ──
   Confirmed-done items (shipped + verified) pulled out of the backlog into a
   single collapsed line, expandable to a list of strip entries. Hidden when
   empty (:empty host) or when a filter/search is active (renderDone bails). */
.board-done-host { margin-top: var(--s4); }
.board-done-host:empty { display: none; }
.board-done-head {
  display: flex; align-items: center; gap: var(--s2); width: 100%;
  background: none; border: 0; cursor: pointer;
  padding: var(--s2) var(--s1);
  color: var(--text-2); font: inherit; text-align: left;
}
.board-done-head:hover { color: var(--text-1); }
.board-done-chevron { width: 1em; display: inline-block; flex: 0 0 auto; }
.board-done-icon { flex: 0 0 auto; line-height: 1; }
.board-done-label { font-weight: 650; }
.board-done-count { color: var(--text-muted); }
.board-done-list {
  display: flex; flex-direction: column; gap: var(--s1);
  padding: var(--s1) 0 var(--s2) var(--s5);
}
.board-done-list > .board-strip-entry:first-child { border-top: 0; }

/* Click-to-jump target highlight (~1.5s) */
.board-row.board-jump-flash {
  animation: boardJumpFlash 1.5s ease-out;
  border-radius: var(--r-sm);
}
@keyframes boardJumpFlash {
  0%   { background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent) inset; }
  100% { background: transparent; box-shadow: 0 0 0 2px transparent inset; }
}

/* ── Stat strip ── */
.board-stats-host { margin-bottom: var(--s4); }
.board-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.board-stat {
  display: flex; flex-direction: column; gap: 3px;
  padding: var(--s3) var(--s4);
  background: var(--bg-card);
  border: 0; text-align: left; font: inherit;
  color: var(--text-1); cursor: pointer;
  transition: background .12s;
}
.board-stat:hover { background: var(--bg-raised); }
.board-stat.on { background: var(--bg-raised); box-shadow: inset 0 -2px 0 var(--accent); }
.board-stat-n { font-family: var(--font-mono); font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1; }
.board-stat-l { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; display: flex; align-items: center; gap: 5px; }
.board-stat-l::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--dot, var(--text-muted)); }
.board-stat.st-shipped { --dot: var(--st-shipped); }
.board-stat.st-in-progress { --dot: var(--st-in-progress); }
.board-stat.st-decided { --dot: var(--st-decided); }
.board-stat.st-open { --dot: var(--st-open); }
.board-stat.st-blocked { --dot: var(--st-blocked); }
.board-stat.st-idea { --dot: var(--st-idea); }
.board-stat.st-shipped .board-stat-n { color: var(--st-shipped); }
.board-stat.st-blocked .board-stat-n { color: var(--st-blocked); }
.board-stat.st-idea .board-stat-n { color: var(--st-idea); }

/* ── Controls ── */
.board-controls { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; margin-bottom: var(--s2); }
.board-search { flex: 1 1 200px; min-width: 160px; }
.board-search input {
  width: 100%;
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text-1);
  border-radius: var(--r-md); padding: 9px 12px; font-size: 13.5px;
}
.board-search input::placeholder { color: var(--text-muted); }
.board-filter {
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text-1);
  border-radius: var(--r-md); padding: 9px 11px; font-size: 13px; cursor: pointer;
}

/* ── Add item ── */
.board-add { display: flex; gap: var(--s2); margin-bottom: var(--s4); flex-wrap: wrap; }
.board-add-title { flex: 1 1 240px; min-width: 180px; }
.board-add-area { flex: 0 1 180px; min-width: 120px; }
.board-add input {
  background: var(--bg-input); border: 1px dashed var(--border); color: var(--text-1);
  border-radius: var(--r-md); padding: 10px 13px; font-size: 13.5px;
}
.board-add input:focus { border-style: solid; border-color: var(--accent); outline: none; }
.board-add-btn { white-space: nowrap; }

/* ── Groups + rows ── */
.board-group {
  margin-bottom: var(--s3);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-card);
}
.board-group-head {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--border-subtle);
}
.board-group-name { font-size: 14px; font-weight: 620; letter-spacing: -0.005em; color: var(--text-1); flex: 1 1 auto; }
.board-group-count { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); }
.board-rows { padding: var(--s1) var(--s3) var(--s3); }

.board-row {
  display: flex; flex-direction: column;
  padding: var(--s3) var(--s2);
  border-top: 1px solid var(--border-subtle);
}
.board-rows > .board-row:first-child { border-top: 0; }
.board-row.needs-input { background: linear-gradient(0deg, var(--warn-dim), var(--warn-dim)); border-radius: var(--r-sm); }
/* Shipped items are folded to a single line — tighter padding + de-emphasised
   title so completed work doesn't crowd the live backlog. Expanding restores it. */
.board-row.collapsed { padding-top: var(--s2); padding-bottom: var(--s2); }
.board-row.collapsed .board-row-title { font-weight: 480; color: var(--text-2); }
/* 2-column grid: title (fluid) + status/comments cluster (auto), so the cluster
   lands in the SAME spot on every row regardless of title length. Children are
   placed explicitly so DOM order can't push the cluster onto a second line. */
.board-row-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: var(--s3);
  row-gap: 3px;
  align-items: baseline;
}
.board-row-title {
  grid-column: 1; grid-row: 1; min-width: 0;
  font-size: 14px; font-weight: 540; color: var(--text-1);
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 7px;
}
.board-row-flag { color: var(--warn); font-size: 13px; flex: 0 0 auto; }
.board-row-note {
  grid-column: 1; grid-row: 2;
  font-size: 12.5px; color: var(--text-2); max-width: 72ch; min-width: 0;
}
.board-row-rt {
  grid-column: 2; grid-row: 1; justify-self: end; align-self: start;
  display: flex; align-items: center; gap: var(--s2);
}

/* PR-ref chips — small monospace pills linking to the GitHub PR */
.board-ref-chips { display: inline-flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.board-ref-chip {
  font-family: var(--font-mono); font-size: 11px; line-height: 1; font-weight: 500;
  padding: 3px 7px; border-radius: var(--r-pill);
  background: var(--bg-raised); border: 1px solid var(--border-subtle);
  color: var(--text-2); text-decoration: none; white-space: nowrap;
}
.board-ref-chip:hover { color: var(--accent); border-color: var(--accent); }

/* Comment-count toggle button */
.board-row-comments {
  border: 1px solid var(--border); background: var(--bg-raised); color: var(--text-2);
  border-radius: var(--r-pill); padding: 4px 10px; font-size: 12px; font-family: var(--font-mono);
  cursor: pointer; white-space: nowrap;
}
.board-row-comments:hover { color: var(--text-1); border-color: var(--accent); }
.board-row-comments.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* ── Status pill (native select styled as a pill) ── */
.board-st { position: relative; display: inline-flex; }
.board-st-sel {
  appearance: none; -webkit-appearance: none;
  border: 1px solid transparent; border-radius: var(--r-pill);
  padding: 4px 27px 4px 12px; font-size: 11px; font-weight: 650;
  font-family: var(--font-mono); letter-spacing: .02em; text-transform: uppercase;
  cursor: pointer;
}
.board-st::after { content: "▾"; position: absolute; right: 11px; top: 50%; transform: translateY(-50%); font-size: 9px; pointer-events: none; opacity: .7; }
.board-st.st-shipped .board-st-sel { background: color-mix(in srgb, var(--st-shipped) 16%, transparent); color: var(--st-shipped); }
.board-st.st-in-progress .board-st-sel { background: var(--accent-soft); color: var(--accent); }
.board-st.st-decided .board-st-sel { background: color-mix(in srgb, var(--st-decided) 16%, transparent); color: var(--st-decided); }
.board-st.st-open .board-st-sel { background: var(--bg-raised); color: var(--text-muted); }
.board-st.st-blocked .board-st-sel { background: color-mix(in srgb, var(--st-blocked) 16%, transparent); color: var(--st-blocked); }
.board-st.st-idea .board-st-sel { background: color-mix(in srgb, var(--st-idea) 16%, transparent); color: var(--st-idea); }

/* ── Expanded detail (needs-input control + comment thread) ── */
.board-detail {
  margin-top: var(--s3);
  padding: var(--s3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  background: var(--bg-1);
}
.board-ni { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s3); }
.board-ni-badge {
  font-size: 12px; font-weight: 600; color: var(--warn);
  background: var(--warn-dim); border-radius: var(--r-pill); padding: 4px 12px;
}
.board-ni-who {
  flex: 1 1 200px; min-width: 160px;
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text-1);
  border-radius: var(--r-md); padding: 7px 11px; font-size: 12.5px;
}
.board-ni-btn { font-size: 12px; padding: 6px 12px; }

.board-thread-label { margin: 0 0 var(--s2); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.board-thread { display: flex; flex-direction: column; gap: var(--s2); margin-bottom: var(--s3); }
.board-thread-empty { margin: 0 0 var(--s3); font-size: 12.5px; color: var(--text-muted); font-style: italic; }
.board-comment {
  border: 1px solid var(--border-subtle); border-radius: var(--r-md);
  padding: var(--s2) var(--s3); background: var(--bg-card);
}
.board-comment-meta { display: flex; align-items: baseline; gap: var(--s2); margin-bottom: 3px; }
.board-comment-author { font-size: 12px; font-weight: 600; color: var(--text-1); }
.board-comment-ts { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
.board-comment-body { font-size: 13px; color: var(--text-2); white-space: pre-wrap; word-break: break-word; }

.board-comment-add { display: flex; gap: var(--s2); align-items: flex-start; }
.board-comment-input {
  flex: 1 1 auto; resize: vertical;
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text-1);
  border-radius: var(--r-md); padding: 8px 11px; font-size: 13px; font-family: inherit;
}
.board-comment-input::placeholder { color: var(--text-muted); }
.board-comment-send { flex: 0 0 auto; }

/* ── Image attachments ── */
/* Composer wrapper: highlights while an image file is dragged over it. */
.board-comment-composer { display: flex; flex-direction: column; gap: var(--s2); border-radius: var(--r-md); }
.board-comment-composer.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: 3px;
  background: var(--accent-soft);
}

/* Pending strip: thumbnails of images added but not yet posted. */
.board-att-pending { display: flex; flex-wrap: wrap; gap: var(--s2); }
.board-att-pending-item {
  position: relative; width: 56px; height: 56px;
  border: 1px solid var(--border); border-radius: var(--r-md);
  overflow: hidden; background: var(--bg-raised);
}
.board-att-pending-item.uploading { opacity: .55; }
.board-att-pending-item.error { border-color: var(--st-blocked, var(--warn)); }
.board-att-pending-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.board-att-pending-remove {
  position: absolute; top: 1px; right: 1px;
  width: 18px; height: 18px; line-height: 16px; padding: 0;
  font-size: 11px; text-align: center; cursor: pointer;
  color: #fff; background: rgba(0, 0, 0, .62);
  border: none; border-radius: var(--r-pill);
}
.board-att-pending-remove:hover { background: rgba(0, 0, 0, .82); }

/* In-thread thumbnails on a posted comment. */
.board-att-thumbs { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s2); }
.board-att-thumb {
  padding: 0; border: 1px solid var(--border-subtle); border-radius: var(--r-md);
  background: var(--bg-raised); overflow: hidden; cursor: zoom-in;
  max-width: 180px; max-height: 180px; line-height: 0;
}
.board-att-thumb:hover { border-color: var(--accent); }
.board-att-thumb img { max-width: 180px; max-height: 180px; object-fit: contain; display: block; }
.board-att-thumb.loading { width: 96px; height: 72px; }
.board-att-thumb.error {
  width: 96px; height: 72px; line-height: 72px; text-align: center;
  color: var(--warn); font-size: 20px; cursor: default;
}

/* Full-size lightbox overlay. */
.board-att-lightbox {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: var(--s4, 24px); background: rgba(0, 0, 0, .82);
}
.board-att-lightbox-img {
  max-width: 92vw; max-height: 92vh; object-fit: contain;
  border-radius: var(--r-md); box-shadow: 0 8px 40px rgba(0, 0, 0, .5);
}
.board-att-lightbox-close {
  position: absolute; top: 16px; right: 20px;
  width: 36px; height: 36px; font-size: 18px; cursor: pointer;
  color: #fff; background: rgba(0, 0, 0, .5);
  border: 1px solid rgba(255, 255, 255, .25); border-radius: var(--r-pill);
}
.board-att-lightbox-close:hover { background: rgba(0, 0, 0, .75); }

@media (max-width: 560px) {
  .board-title { font-size: 21px; }
  /* Collapse the row grid to a single column; children stack in DOM order
     (title, note, status/comments) via auto placement. */
  .board-row-main { grid-template-columns: 1fr; }
  .board-row-title { grid-column: 1; grid-row: auto; }
  .board-row-note { grid-column: 1; grid-row: auto; }
  .board-row-rt { grid-column: 1; grid-row: auto; justify-self: start; margin-top: var(--s2); }
  .board-waiting-hint { display: none; }
}
