/* Flex the whole tab to the viewport so the pending-list can take "whatever's left" instead
   of guessing a magic-number height — avoids the list overrunning the viewport and forcing
   a page-level scrollbar. */
#tab-nc_deploy.active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 53px - 4rem); /* navbar (52px + border) + .content's 2rem top/bottom padding */
}

#tab-nc_deploy .page-header,
#tab-nc_deploy .section-sep,
#tab-nc_deploy > .tab-bar {
  flex-shrink: 0;
}

#tab-nc_deploy .system-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* ─── NC Deploy: pending-commit list ──────────────────────────────────────────── */
/* Only this wrapper scrolls — background/border/radius/overflow come from .scroll-panel */

.nc-pending-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
  flex: 1;
  min-height: 0;
}

.nc-commit-tabs {
  flex-shrink: 0;
  margin-bottom: 0;
}

.nc-commit-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.1rem;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.nc-commit-author  { font-weight: 600; }
.nc-commit-message  { color: var(--text-muted); flex: 1; }
.nc-commit-time     { color: var(--text-faint); font-size: 0.75rem; }

.nc-file-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0;
  font-size: 0.85rem;
}

.nc-file-path { font-family: monospace; }

.nc-deploy-actions {
  justify-content: center;
  margin: 1rem 0;
}

/* ─── NC Deploy: Browse subtab (drill-down + Encoder) ──────────────────────────── */

.nc-browse-actions {
  flex-shrink: 0;
  margin-bottom: 0.75rem; /* separate from the tree-toggle tab-bar sitting right above it */
}

/* Shared Dev/Prod toggle used by both Browse and Audit — a .tab-bar nested inline in
   a filter-row, so it needs the default .tab-bar bottom-margin stripped */
.nc-tree-toggle {
  margin-bottom: 0;
}

/* Back button + current-directory breadcrumb — its own row, directly above the drill-down list */
.nc-encoder-nav {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
  margin-bottom: 0.75rem;
}

.nc-encoder-breadcrumb {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.nc-encoder-crumb {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
  color: var(--primary);
  cursor: pointer;
}
.nc-encoder-crumb:hover { text-decoration: underline; }
.nc-encoder-crumb:last-child { color: var(--text); cursor: default; text-decoration: none; }

.nc-encoder-crumb-sep {
  margin: 0 0.35rem;
  color: var(--text-faint);
}

/* File list + encode panel sit side by side; the list takes whatever's left */
.nc-browse-body {
  display: flex;
  gap: 1rem;
  flex: 1;
  min-height: 0;
}

.nc-encoder-list {
  flex: 1;
  min-height: 0;
}

.nc-encoder-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
  border-radius: 4px;
}

.nc-encoder-row-dir {
  cursor: pointer;
  font-weight: 600;
}
.nc-encoder-row-dir:hover { background: var(--row-hover); }
.nc-encoder-row-dir .nc-encoder-name::before { content: '▸  '; color: var(--text-faint); }

.nc-encoder-select-spacer { width: 13px; flex-shrink: 0; }

/* Bulk-select toolbar — hidden until at least one file is checked */
.nc-bulk-toolbar {
  justify-content: space-between;
  flex-shrink: 0;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.nc-bulk-actions {
  display: flex;
  gap: 0.5rem;
}

/* Detected-encoding panel — a collapsible sidebar to the right of the file list, always
   visible (when expanded) while browsing nc-dev, so you can see (and override) what's
   about to be encoded instead of only finding out inside a modal */
.nc-encode-panel {
  flex-shrink: 0;
  width: 460px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  transition: width 0.15s ease;
}

.nc-encode-panel.collapsed {
  width: 2.5rem;
}
.nc-encode-panel.collapsed .nc-encode-panel-header h4,
.nc-encode-panel.collapsed .nc-encode-panel-body {
  display: none;
}

.nc-encode-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.nc-encode-panel-header h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-sub);
}

.nc-encode-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nc-encode-panel-body {
  padding: 1rem;
  overflow-y: auto;
}

/* Overrides the shared .form-grid's 2-column default — 3 fields per row, each with
   room to breathe (the panel is wide enough that this isn't cramped when expanded) */
.nc-encode-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 0 1rem;
}

/* ─── NC Deploy: Audit subtab ──────────────────────────────────────────────────── */

.nc-audit-actions {
  justify-content: space-between;
  margin: 1rem 0;
  flex-shrink: 0;
}

.nc-audit-list {
  flex: 1;
  min-height: 0;
}

/* Center an empty-state message within the already-full-height list instead of leaving it pinned to the top */
.nc-pending-list:has(.empty-state),
.nc-encoder-list:has(.empty-state),
.nc-audit-list:has(.empty-state) {
  display: flex;
  align-items: center;
  justify-content: center;
}

#nc-audit-summary {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

/* Wraps a scrollable list so its badge-key info button can float in the bottom-right corner */
.nc-list-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
}
.nc-list-wrap > .scroll-panel { flex: 1; min-height: 0; }

.nc-list-legend-btn {
  position: absolute;
  bottom: 0.6rem;
  right: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 1.9rem;
  height: 1.9rem;
  font-size: 1.1rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: background 0.1s;
}
.nc-list-legend-btn:hover { background: var(--row-selected); }

/* Icon + label rows inside the badge-key modal */
.nc-legend-key-list {
  list-style: none;
}
.nc-legend-key-list li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.nc-legend-key-list li:last-child { border-bottom: none; }
.nc-legend-key-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--danger);
  color: var(--on-primary);
  flex-shrink: 0;
}
.nc-legend-key-icon.nc-legend-key-icon--muted { background: var(--text-faint); }

/* Issue-type filter checkboxes above the flagged-file list */
.nc-audit-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.nc-audit-filter-all {
  font-weight: 600;
  padding-right: 0.9rem;
  border-right: 1px solid var(--border);
}

.nc-audit-filter-all,
.nc-audit-filter-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

/* Each flagged file's issues collapse to one icon per check — click the row for full detail */
.nc-issue-symbol,
.nc-change-symbol {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.35rem;
}
.nc-issue-symbol svg,
.nc-change-symbol svg { display: block; }

.nc-audit-list .nc-file-row,
.nc-pending-list .nc-file-row[data-file-idx] { cursor: pointer; }
.nc-audit-list .nc-file-row:hover,
.nc-pending-list .nc-file-row[data-file-idx]:hover { background: var(--row-hover); }

.nc-issue-detail-list {
  list-style: none;
  margin-top: 0.5rem;
}
.nc-issue-detail-list li { padding: 0.35rem 0; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.nc-issue-detail-list li:last-child { border-bottom: none; }

/* ─── NC Deploy: Encode Flagged Files modal ────────────────────────────────────── */

.nc-encode-group {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 1rem;
}
.nc-encode-group:last-child { margin-bottom: 0; }

.nc-encode-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.nc-encode-group-files {
  list-style: none;
  margin-top: 0.75rem;
  max-height: 100px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.nc-encode-group-files li { padding: 0.15rem 0; }

/* ─── NC Deploy: Enforce Naming Convention preview modal ───────────────────────── */

.nc-rename-preview {
  list-style: none;
  max-height: 300px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 0.85rem;
}
.nc-rename-preview li { padding: 0.3rem 0; border-bottom: 1px solid var(--border); }
.nc-rename-preview li:last-child { border-bottom: none; }

/* ─── NC Deploy: Proof & Move Testing Files modal ──────────────────────────────── */

.nc-proof-select-all {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 600;
}

.nc-proof-list {
  list-style: none;
  max-height: 340px;
  overflow-y: auto;
}

.nc-proof-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.nc-proof-row:last-child { border-bottom: none; }

.nc-proof-row .nc-file-path {
  flex: 0 1 auto;
  max-width: 32%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nc-proof-arrow {
  color: var(--text-faint);
  flex-shrink: 0;
}

.nc-proof-dest {
  flex: 1;
  min-width: 0;
  font-family: monospace;
  font-size: 0.8rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
}

/* Location-picker rows — shown in openViewModal when a BOM module/file's NC files were found in
   more than one place (Controls/Env combo); a single match skips this and jumps straight to Browse */
.nc-location-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--table-surface);
  margin-bottom: 0.4rem;
  cursor: pointer;
}
.nc-location-row:hover { background: var(--row-hover); }
.nc-location-label { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.nc-location-count { font-size: 0.72rem; color: var(--text-faint); margin-left: auto; white-space: nowrap; }
