/* huddle-board.css — Huddle people × days board (Activities page).
   Layout only: chips ride the globally-loaded .pv-chip vocabulary from
   milestone-views.css; everything here is namespaced hb-*. */

.hb-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.hb-bar-spacer { flex: 1 1 auto; }
.hb-today-btn, .hb-more-btn { font-size: 0.75rem; flex: none; }
/* The table's copy of this control is width:100% to fill a header cell; in the
   board toolbar it sizes to itself instead. */
.hb-filter { flex: none; width: auto; }
.hb-filter .col-filter-multi-btn { width: auto; min-width: 130px; padding: 5px 10px; }
.hb-filter .col-filter-multi-dd { min-width: 190px; }
.hb-filter-label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); }
.hb-filter-count { font-size: 0.75rem; color: var(--text-muted); }
/* Loud when people are hidden — a standup must never quietly omit someone. */
.hb-filter-count.is-active { color: #b45309; font-weight: 700; }

.hb-wrap {
  overflow: auto;
  max-height: calc(100vh - 180px);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
}

.hb {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  min-width: 900px;
  /* Fixed layout: the auto algorithm has to measure min/max content width for
     every cell before it can size columns, which is O(cells) on each render —
     and the horizon can reach ~180 day columns. Widths come from the header. */
  table-layout: fixed;
}
/* Column widths live on the colgroup so the spanning band rows cannot affect
   them. Wide enough that a chip's subject stays readable — the whole point of
   the board is reading it at a glance. */
.hb-col-lane { width: 170px; }
.hb-col-day { width: 132px; }
.hb-col-overdue, .hb-col-later { width: 200px; }
.hb th, .hb td {
  border-bottom: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
}
.hb th:last-child, .hb td:last-child { border-right: none; }
.hb tbody tr:last-child td { border-bottom: none; }

/* ── Header ── */
.hb thead th {
  position: sticky;
  z-index: 2;
  background: var(--bg-secondary);
  padding: 4px 8px;
  text-align: left;
  vertical-align: bottom;
}
/* Each header row sticks below the one above it. Heights are fixed so the
   offsets stay in step: month 22, week 20, weekday 22. */
.hb-band-month th { top: 0; height: 22px; }
.hb-band-week th { top: 22px; height: 20px; }
.hb thead tr:nth-child(3) th { top: 42px; }
.hb thead tr:nth-child(4) th { top: 64px; }
/* Banded header: month and week span their run of day columns. */
.hb-band-cell {
  font-size: 0.6875rem;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
  padding: 3px 8px !important;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}
.hb-band-month .hb-band-cell { font-size: 0.75rem; color: var(--text-primary); }
.hb-band-week .hb-band-cell { color: var(--text-muted); font-weight: 600; }
.hb-band-pad { background: var(--bg-secondary); }
.hb-th-dow { font-size: 0.75rem; font-weight: 700; color: var(--text-primary); white-space: nowrap; }
.hb-th-date {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.hb-th.is-weekend { background: #eef1f5; }
.hb-th.is-today { background: var(--vmdo-teal); color: #fff; }
.hb-th-overdue { color: #dc2626; }
.hb-th-later, .hb-th-overdue { font-weight: 800; }

/* ── Sticky lane column ── */
.hb-th-lane, .hb-lane {
  position: sticky;
  left: 0;
  background: var(--bg-primary);
}
.hb thead .hb-th-lane { z-index: 4; background: var(--bg-secondary); font-size: 0.75rem; font-weight: 700; }
.hb tbody .hb-lane { z-index: 3; padding: 8px 10px; vertical-align: top; }
.hb-lane-name {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hb-lane-sub { font-size: 0.6875rem; color: var(--text-muted); margin-top: 2px; }
.hb-lane-overdue { color: #dc2626; font-weight: 700; }
.hb-lane-load { color: var(--vmdo-teal); font-weight: 700; }


/* Move button — only rendered on touch devices, where drag does not exist. */
.hb-move {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  line-height: 18px;
  text-align: center;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.75rem;
  cursor: pointer;
}
.hb-chip-wrap { position: relative; }
.hb-slot .hb-move { top: 50%; transform: translateY(-50%); }
/* Keep chip text clear of the Move button. */
.hb-has-move .hb-chip-main,
.hb-has-move .hb-chip-sub { padding-right: 24px; }
.hb-move:focus-visible { outline: 2px solid var(--vmdo-teal); outline-offset: 1px; }

/* ── Cells ── */
.hb-cell {
  padding: 4px;
  vertical-align: top;
  background: var(--bg-primary);
}
.hb-cell.is-weekend { background: #f4f6f9; }
.hb-cell.is-today { background: rgba(79, 70, 229, 0.06); }
.hb-cell-overdue { background: rgba(220, 38, 38, 0.05); }
.hb-cell-later { background: var(--bg-secondary); }
.hb-cell.pv-drop-over { outline: 2px dashed var(--vmdo-teal); outline-offset: -3px; }

/* ── Track slots ──
   Every day cell renders the same number of fixed-height slots in the same
   order, so the segments of one multi-day activity line up across adjacent
   cells with no measurement and no overlay. Empty slots are invisible
   spacers that hold the row open. */
.hb-cell-day { padding: 3px 0; }
.hb-slot {
  /* Tall enough for a two-line subject plus the linked-record line. Fixed,
     because equal slot heights in every cell are what make a bar's segments
     line up across columns. */
  height: 56px;
  margin-bottom: 2px;
  position: relative;
}

/* ── Segments: the pieces of a bar ──
   Horizontal padding lives on the segment, not the cell, and the segment is
   pulled out to the cell's edges so neighbouring pieces meet flush across the
   1px column border — that is what reads as one continuous bar. */
.hb-seg {
  position: absolute;
  inset: 0;
  display: block;
  text-align: left;
  padding: 3px 6px;
  border-radius: 0;
  overflow: hidden;
}
.hb-seg-only  { border-radius: 6px; margin: 0 3px; }
.hb-seg-start { border-radius: 6px 0 0 6px; margin-left: 3px; right: -1px; }
.hb-seg-mid   { left: -1px; right: -1px; }
.hb-seg-end   { border-radius: 0 6px 6px 0; margin-right: 3px; left: -1px; }
/* Runs past the window edge: square that end off and mark it with an arrow. */
.hb-seg-clipl { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; }
.hb-seg-clipr { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; }
.hb-seg-clipl::before,
.hb-seg-clipr::after {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  font-weight: 700;
  opacity: 0.75;
}
.hb-seg-clipl::before { content: '‹'; left: 2px; }
.hb-seg-clipr::after  { content: '›'; right: 3px; }
.hb-seg-clipl .hb-chip-main { padding-left: 8px; }
.hb-seg-done { opacity: 0.55; }
.hb-seg-done .hb-chip-subject { text-decoration: line-through; }

/* ── Chips: block-level two-line variant of pv-chip (Overdue / Later) ── */
.hb-chip {
  display: block;
  width: 100%;
  text-align: left;
  margin: 0 0 3px;
  padding: 3px 6px;
  border-radius: 6px;
}
/* .pv-chip sets white-space:nowrap (milestone-views.css) and that inherits
   into every child — it must be undone here or the subject overflows sideways
   instead of wrapping. */
.hb-chip, .hb-seg { white-space: normal; }
.hb-chip-main { display: flex; align-items: flex-start; gap: 4px; min-width: 0; white-space: normal; }
.hb-chip-main .pv-chip-dot { margin-top: 4px; }
/* Subjects WRAP rather than truncate — reading the task at a glance is the
   whole point of the board. Grid segments clamp at two lines to stay inside
   their slot; the Overdue/Later chips are in normal flow and can grow. */
.hb-chip-subject {
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
  flex: 1;
  min-width: 0;
}
.hb-seg .hb-chip-subject {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hb-chip-date {
  font-size: 0.625rem;
  font-weight: 700;
  color: #dc2626;
  font-variant-numeric: tabular-nums;
  flex: none;
  white-space: nowrap;
  margin-top: 1px;
}
.hb-cell-later .hb-chip-date { color: var(--text-muted); }
.hb-chip-sub {
  display: block;
  font-size: 0.625rem;
  line-height: 1.25;
  color: var(--text-muted);
  white-space: normal;
  overflow-wrap: anywhere;
  margin: 1px 0 0 12px;
}
.hb-seg .hb-chip-sub {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hb-chip-done { opacity: 0.55; }
.hb-chip-done .hb-chip-subject { text-decoration: line-through; }

/* ── Quick-add: hidden until the cell is hovered ── */
.hb-add {
  display: none;
  width: calc(100% - 6px);
  margin: 0 3px;
  border: 1px dashed var(--border-color);
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.3;
  cursor: pointer;
  padding: 1px 0;
}
.hb-cell:hover .hb-add { display: block; }
.hb-add:hover { color: var(--vmdo-teal); border-color: var(--vmdo-teal); }

/* ── Colour swatches in the activity editor ──
   A fixed palette rather than a native colour dialog: faster to hit in a
   standup, and it can only produce valid hex. "None" is the default and the
   board renders it grey. */
.act-colors { display: flex; flex-wrap: wrap; gap: 6px; }
.act-color {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  padding: 0;
}
.act-color-none {
  background: #6b7280;
  position: relative;
}
.act-color.is-selected {
  border-color: var(--text-primary);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.9);
}
.act-color:focus-visible { outline: 2px solid var(--vmdo-teal); outline-offset: 2px; }

/* ── Page header ── */
.act-header-actions {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* The board owns the vertical scroll, not the route view — without this the
   .route-view.active overflow-y:auto and .hb-wrap's own scroller stack up and
   the page shows two vertical scrollbars. */
#huddle-view { overflow: hidden; }
#huddle-host {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#huddle-host .hb-wrap { max-height: 100%; }

@media (max-width: 700px) {
  .hb-col-lane { width: 120px; }
  .hb-col-day { width: 112px; }
  .hb-col-overdue, .hb-col-later { width: 150px; }
.hb-wrap { max-height: calc(100vh - 150px); }
}
