/* 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; }

/* ── 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); }
/* 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; }

@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; }
}
