/* Beta Cohort view. Palette + resets + .btn* + .lf-skel* come from theme.css. */

.beta-cohort-root {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - var(--lf-nav-h));
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Top bar */
.bc-top {
  background: var(--lf-panel);
  border-bottom: 1px solid var(--lf-border);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.bc-top-left { display: flex; align-items: center; gap: 12px; }
.bc-top-left h1 { font-size: 17px; font-weight: 700; color: var(--lf-text); }
.bc-count {
  background: var(--lf-btn-bg);
  color: var(--lf-text-muted);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
}

/* Search + add inputs */
.bc-search {
  background: var(--lf-bg);
  border: 1px solid var(--lf-border-strong);
  border-radius: 7px;
  padding: 7px 14px;
  font-size: 12px;
  color: var(--lf-text);
  min-width: 280px;
  outline: none;
}
.bc-search::placeholder { color: var(--lf-text-dim); }
.bc-search:focus { border-color: var(--lf-accent); }
.bc-controls { display: flex; gap: 8px; align-items: center; }
.bc-filter {
  background: var(--lf-bg);
  border: 1px solid var(--lf-border-strong);
  border-radius: 7px;
  padding: 7px 12px;
  font-size: 12px;
  color: var(--lf-text);
  outline: none;
}
.bc-filter:focus { border-color: var(--lf-accent); }

/* Intro blurb */
.bc-intro {
  color: var(--lf-text-muted);
  font-size: 12px;
  line-height: 1.6;
  padding: 14px 20px 0;
  max-width: 760px;
  flex-shrink: 0;
}
.bc-intro strong { color: var(--lf-text); }

/* Manual add-by-MAC row */
.bc-add {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 14px 20px 6px;
  flex-shrink: 0;
}
.bc-add:empty { display: none; }
.bc-add-mac { flex: 1 1 auto; }

/* Single scroll region holding both sections (device cohort + beta users).
   The root is fixed-height/overflow-hidden, so one inner scroller owns all
   the content below the top bar. */
.bc-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

/* Table body block (one per section, no longer the scroller itself) */
.bc-body {
  padding: 12px 20px 20px;
}

/* Stacked sections (beta testers, then device cohort). The divider sits
   only between the two sections, never above the first. */
.bc-users + .bc-users {
  border-top: 1px solid var(--lf-border);
  margin-top: 8px;
}
.bc-users-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 0;
  flex-wrap: wrap;
}
.bc-users-head h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--lf-text);
}

/* Table */
.bc-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--lf-panel);
  border: 1px solid var(--lf-border);
  border-radius: 10px;
  overflow: hidden;
}
.bc-table thead th {
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--lf-text-muted);
  font-weight: 600;
  padding: 11px 14px;
  border-bottom: 1px solid var(--lf-border);
  background: var(--lf-panel-alt);
}
.bc-th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.bc-th.sortable:hover { color: var(--lf-text); }
.bc-th.active { color: var(--lf-text); }
.bc-sort-caret {
  display: inline-block;
  width: 12px;
  font-size: 9px;
  color: var(--lf-accent);
}
.bc-table tbody td {
  padding: 11px 14px;
  font-size: 12px;
  color: var(--lf-text);
  border-bottom: 1px solid var(--lf-border);
}
.bc-table tbody tr:last-child td { border-bottom: 0; }
.bc-table tbody tr.bc-row-on { background: var(--lf-success-bg); }
.bc-mono {
  font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  font-size: 11px;
  color: var(--lf-text);
}
.bc-dim { color: var(--lf-text-dim); }
.bc-th-toggle, .bc-td-toggle { text-align: center; width: 84px; }

/* Firmware-releases section: the Channel column carries toggle + label, so it
   needs a bit more room than the bare-toggle column used by the device cohort. */
.bc-th-channel, .bc-td-channel { text-align: center; width: 140px; }
.bc-channel-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.bc-channel-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--lf-text-muted);
}
.bc-channel-label.on { color: var(--lf-success); }

/* Inline "(?)" tooltip badge on column headers. The browser tooltip carries
   the actual explanation (the th's title attribute); the icon just makes it
   discoverable. cursor:help signals that hovering reveals the hint. */
.bc-help {
  display: inline-block;
  width: 14px;
  height: 14px;
  line-height: 13px;
  border-radius: 50%;
  background: var(--lf-btn-bg);
  border: 1px solid var(--lf-border-strong);
  color: var(--lf-text-muted);
  font-size: 9px;
  font-weight: 700;
  text-align: center;
  margin-left: 6px;
  vertical-align: middle;
  cursor: help;
}
.bc-help:hover { color: var(--lf-text); border-color: var(--lf-accent); }

/* On/off toggle switch */
.bc-toggle {
  width: 40px;
  height: 22px;
  border-radius: 11px;
  border: 1px solid var(--lf-border-strong);
  background: var(--lf-btn-bg);
  padding: 0;
  cursor: pointer;
  position: relative;
  transition: background 0.15s, border-color 0.15s;
  vertical-align: middle;
}
.bc-toggle .bc-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--lf-text-dim);
  transition: left 0.15s, background 0.15s;
}
.bc-toggle.on {
  background: var(--lf-success-bg);
  border-color: var(--lf-success-border);
}
.bc-toggle.on .bc-knob {
  left: 20px;
  background: var(--lf-success);
}
.bc-toggle:disabled { opacity: 0.5; cursor: default; }

/* Read-only beta badge (operators without ota write) */
.bc-badge {
  font-size: 10px;
  padding: 3px 10px;
  border-radius: 10px;
  color: var(--lf-text-dim);
  background: var(--lf-btn-bg);
  border: 1px solid var(--lf-border-strong);
}
.bc-badge.on {
  color: var(--lf-success);
  background: var(--lf-success-bg);
  border-color: var(--lf-success-border);
}

/* Empty + error states */
.bc-empty {
  color: var(--lf-text-dim);
  font-size: 13px;
  text-align: center;
  padding: 48px 20px;
}
.bc-error {
  color: var(--lf-error);
  background: var(--lf-error-bg);
  border: 1px solid var(--lf-error-border);
  border-radius: 8px;
  font-size: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
}

/* Pagination footer */
.bc-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 14px 0 4px;
}
.bc-pager-info { font-size: 12px; color: var(--lf-text-muted); }
.bc-pager .btn[disabled] { opacity: 0.4; cursor: default; }

@media (max-width: 768px) {
  .bc-top { flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
  .bc-controls { width: 100%; }
  .bc-search { min-width: 0; flex: 1 1 160px; }
  .bc-intro, .bc-add, .bc-body { padding-left: 14px; padding-right: 14px; }
  .bc-users-head { padding-left: 14px; padding-right: 14px; }
}
