/* 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; justify-content: flex-end; gap: 6px; margin-bottom: 6px; }
.hb-today-btn, .hb-more-btn { font-size: 0.75rem; }

.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;
}
.hb-th-lane { width: 160px; }
.hb-th-day { width: 118px; }
.hb-th-overdue, .hb-th-later { width: 140px; }
.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;
  top: 0;
  z-index: 2;
  background: var(--bg-secondary);
  padding: 6px 8px;
  text-align: left;
  vertical-align: bottom;
}
.hb-th-label { font-size: 0.75rem; font-weight: 700; color: var(--text-primary); white-space: nowrap; }
.hb-th-sub { font-size: 0.625rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.hb-th.is-weekend { background: #eef1f5; }
.hb-th.is-today { background: var(--color-primary); }
.hb-th.is-today .hb-th-label, .hb-th.is-today .hb-th-sub { color: #fff; }
.hb-th-overdue .hb-th-label { color: #dc2626; }
.hb-th-later .hb-th-label, .hb-th-overdue .hb-th-label { font-weight: 800; }

/* ── Sticky lane column ── */
.hb-th-lane, .hb-lane {
  position: sticky;
  left: 0;
  min-width: 150px;
  max-width: 180px;
  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(--color-primary); font-weight: 700; }

/* Month name on the first column of each month — a long scroll would otherwise
   be a run of ambiguous weekday/number pairs. */
.hb-th-month {
  font-size: 0.5625rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-primary);
}
.hb-th.is-today .hb-th-month { color: #fff; }

/* 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(--color-primary); outline-offset: 1px; }

/* ── Cells ── */
.hb-cell {
  min-width: 110px;
  max-width: 170px;
  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); min-width: 130px; }
.hb-cell-later { background: var(--bg-secondary); min-width: 130px; }
.hb-cell.pv-drop-over { outline: 2px dashed var(--color-primary); 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 {
  height: 38px;
  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;
}
.hb-chip-main { display: flex; align-items: center; gap: 4px; min-width: 0; }
.hb-chip-subject {
  font-size: 0.6875rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.hb-chip-date {
  font-size: 0.625rem;
  font-weight: 700;
  color: #dc2626;
  font-variant-numeric: tabular-nums;
  flex: none;
}
.hb-cell-later .hb-chip-date { color: var(--text-muted); }
.hb-chip-sub {
  display: block;
  font-size: 0.625rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 1px 0 0 12px;
}
.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(--color-primary); border-color: var(--color-primary); }

/* ── View toggle in the Activities header ── */
.act-view-toggle {
  display: inline-flex;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  flex: none; /* the sibling New Activity button is flex-shrink:0; match it */
}
.act-view-btn {
  padding: 6px 14px;
  background: var(--color-bg);
  border: none;
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  white-space: nowrap;
}
.act-view-btn + .act-view-btn { border-left: 1px solid var(--color-border); }
.act-view-btn.active { background: var(--color-primary); color: #fff; }
.act-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 700px) {
  .hb-th-lane, .hb-lane { min-width: 110px; max-width: 110px; }
  .hb-cell { min-width: 96px; }
  .hb-bar { display: flex; justify-content: flex-end; gap: 6px; margin-bottom: 6px; }
.hb-today-btn, .hb-more-btn { font-size: 0.75rem; }

.hb-wrap { max-height: calc(100vh - 150px); }
}
