/* ─── The workspace ────────────────────────────────────────────────────────────
   NC Deploy wears the workspace archetype (shared.css) like every other section:
   the folder tree on the rail, one listing in the pane, Tools on the panel. The
   rail runs a touch wider than the 12rem default because a kit-revision folder
   names its kits inside it ("B.0 [PS SHELL]"), which 12rem clips every time.
   ──────────────────────────────────────────────────────────────────────────── */

.nc-workspace {
  --rail-w: 14rem;
  --panel-w: 30.5rem;  /* four tabs with both counts at their widest ("99+"), and the collapse toggle, measured at 477px */
  grid-template-columns: var(--rail-col) minmax(0, 1fr) var(--panel-col);
}

/* the pane stacks its own chrome above the listing */
.nc-pane { display: flex; flex-direction: column; min-height: 0; }

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

/* ─── NC Deploy: change status on the listing and the rail ──────────────────────── */

/* a folder's dots say what's below it · uncommitted, then ready to deploy */
.nc-stage-dots { display: inline-flex; gap: 0.2rem; align-items: center; }
.nc-stage-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; flex: none; }
.nc-stage-dot--uncommitted { background: var(--badge-special-bg); }
.nc-stage-dot--ready { background: var(--info-color); }

/* a changed file's next step sits at the row's far end */
.nc-row-actions { display: inline-flex; gap: 0.35rem; margin-left: auto; }
/* a delete that hasn't gone live · the file is gone from disk, so the name reads struck through */
.nc-encoder-row-ghost .nc-encoder-name { text-decoration: line-through; color: var(--text-muted); }
/* the row the Changes panel just jumped to */
.nc-encoder-row.is-flash { background: var(--row-selected); }

/* ─── NC Deploy: the Changes panel ───────────────────────────────────────────────── */

.nc-changes-body { display: flex; flex-direction: column; gap: 1rem; }
.nc-changes-section { display: flex; flex-direction: column; gap: 0.35rem; }
.nc-changes-section-head { display: flex; align-items: center; gap: 0.4rem; }
.nc-changes-section-title { font-weight: 600; font-size: 0.85rem; }
.nc-changes-hint { margin: 0; font-size: 0.75rem; color: var(--text-muted); }
.nc-changes-empty { font-size: 0.78rem; color: var(--text-faint); }
.nc-change-line { display: flex; align-items: center; gap: 0.4rem; padding: 0.15rem 0.35rem; border-radius: 4px; font-size: 0.8rem; cursor: pointer; min-width: 0; }
.nc-change-line:hover { background: var(--row-hover); }
.nc-change-mark { width: 0.8rem; flex: none; text-align: center; font-weight: 700; font-size: 0.75rem; }
.nc-change-mark--added { color: var(--success); }
.nc-change-mark--modified { color: var(--warning); }
.nc-change-mark--deleted { color: var(--danger); }
.nc-change-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nc-change-dir { color: var(--text-faint); font-size: 0.72rem; }
.nc-commit-message { width: 100%; resize: vertical; font: inherit; font-size: 0.8rem; }
.nc-changes-go { width: 100%; justify-content: center; }
.nc-changes-fix { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: 0.8rem; flex-wrap: wrap; }

/* ─── NC Deploy: the Audit panel ────────────────────────────────────────────────── */

.nc-audit-body { display: flex; flex-direction: column; gap: 0.75rem; }
.nc-audit-summary { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--text-sub); }
.nc-audit-when { flex: 1; }
.nc-audit-running { font-size: 0.78rem; color: var(--info-color); }
.nc-audit-error { font-size: 0.78rem; color: var(--danger); }
.nc-audit-types { display: flex; flex-wrap: wrap; gap: 0.35rem 0.8rem; font-size: 0.78rem; }
.nc-audit-controls { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: space-between; }
/* stays in reach while the list scrolls under it */
.nc-audit-nav { display: flex; align-items: center; gap: 0.5rem; position: sticky; top: 0; z-index: var(--z-raise-1); background: inherit; padding-block: 0.25rem; }
.nc-audit-pos { flex: 1; text-align: center; font-size: 0.78rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.nc-audit-list { display: flex; flex-direction: column; gap: 0.15rem; }
/* an empty list takes the rest of the panel, so its empty state fills it rather than sitting in a strip */
.nc-audit-list:has(> .empty-state) { flex: 1 1 auto; }
.nc-audit-group { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; padding-top: 0.5rem; }
.nc-audit-group-title { font-weight: 600; font-size: 0.82rem; overflow-wrap: anywhere; }
.nc-audit-group .btn-sm { margin-left: auto; }
.nc-audit-item { display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.3rem 0.4rem; border-radius: 4px; cursor: pointer; border-left: 3px solid transparent; }
.nc-audit-item:hover { background: var(--row-hover); }
.nc-audit-item.is-current { background: var(--row-selected); border-left-color: var(--primary); }
.nc-audit-n { font-size: 0.7rem; color: var(--text-faint); min-width: 1.6rem; text-align: right; padding-top: 0.1rem; font-variant-numeric: tabular-nums; }
.nc-audit-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nc-audit-name { font-size: 0.8rem; font-weight: 600; overflow-wrap: anywhere; }
.nc-audit-why { font-size: 0.74rem; color: var(--danger); }
.nc-audit-where { font-size: 0.7rem; color: var(--text-faint); overflow-wrap: anywhere; }

/* ─── NC Deploy: the folder listing ───────────────────────────────────────────── */

/* The listing is the .scroll-panel archetype with a domain-specific modifier class */
.nc-encoder-list {
  background: var(--surface-deep);
}

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

/* A flagged row names a file somewhere below you rather than one in front of you, so it reads as
   a path instead of a name — the only difference between this listing and the folder's own */
.nc-flagged-row { cursor: pointer; }
.nc-flagged-row:hover { background: var(--row-hover); }

.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-row:not(.nc-encoder-row-dir) .nc-encoder-name { cursor: pointer; }
.nc-encoder-row:not(.nc-encoder-row-dir) .nc-encoder-name:hover { color: var(--primary); }

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

/* Wrapper span for a file row's audit badges — display:contents so each badge gets the row's own flex gap instead of bunching inside the wrapper */
.nc-encoder-audit-badge { display: contents; }
.nc-encoder-audit-badge[data-audit-path] { cursor: pointer; }
.chip[data-rename-dir-path] { cursor: pointer; }

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

/* Tools — the workspace's side panel now, so its frame, its fold and its General/Encode/Loop band
   all come from shared.css and shared/workspace.js. What was here was a panel of its own making:
   a vertical TOOLS handle doubling as a drag-resize grip, a second collapse button beside it, and
   a third kind of tab strip. Only the --surface-deep tint survives, which is what makes the panel
   read as a working tray rather than as more page. */
.nc-tools { background: var(--surface-deep); }
.nc-tools .workspace-panel-body { padding: 0.9rem; }

.nc-panel-mode-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

/* Encode tab's action row sits below the entry fields instead of above them — centered, margin-bottom stripped since it's the last thing in the tab */
.nc-encode-footer {
  justify-content: center;
  margin-top: 0.9rem;
  margin-bottom: 0;
}

/* ─── NC Deploy: Loop Creator panel mode ────────────────────────────────────────── */

/* Each section floats as its own --surface card on the panel's --surface-deep body, with a
   --table-surface header bar — same "raised card on a tray" idea as the Loop Files list itself */
.nc-loop-section {
  flex-shrink: 0;  /* the panel body is a flex column that scrolls · without this a tall Loop tab squashes every card and clips it, instead of scrolling */
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 1rem;
  background: var(--surface);
  box-shadow: 0 1px 3px var(--shadow-sm);
}
.nc-loop-section:last-of-type { margin-bottom: 0; }

.nc-loop-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  padding: 0.5rem 0.8rem;
  background: var(--table-surface);
  border-bottom: 1px solid var(--border);
  color: var(--text-sub);
}

.nc-loop-section-body {
  padding: 0.9rem 1rem;
}

.nc-loop-files-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}
.nc-loop-files-actions select {
  padding: 0.25rem 0.4rem;
  font-size: 0.75rem;
}
.nc-loop-files-actions button {
  font-size: 0.75rem;
  padding: 0.3rem 0.6rem;
}

.nc-loop-file-list {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.nc-loop-file-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--cell-border-h);
  cursor: grab;
}
.nc-loop-file-row:last-child { border-bottom: none; }
.nc-loop-file-row:hover { background: var(--row-hover); }
.nc-loop-file-row.selected { background: var(--row-selected); }
.nc-loop-file-row.dragging { opacity: 0.4; }
.nc-loop-file-row.drop-above { box-shadow: 0 -2px 0 0 var(--primary); }

.nc-loop-drag-handle { color: var(--text-faint); font-size: 0.85rem; flex-shrink: 0; }
.nc-loop-case-num { font-size: 0.7rem; font-weight: 700; color: var(--text-faint); width: 1.2rem; flex-shrink: 0; text-align: right; }
.nc-loop-file-name { font-family: monospace; font-size: 0.76rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nc-loop-msg-dot { width: 0.45rem; height: 0.45rem; border-radius: 50%; flex-shrink: 0; }
.nc-loop-msg-dot.warning { background: var(--warning); }
.nc-loop-msg-dot.error   { background: var(--danger); }
.nc-loop-msg-dot.msg     { background: var(--info-color); }

.nc-loop-detected-hint { font-size: 0.7rem; color: var(--info-color); margin-top: 0.5rem; }

.nc-loop-selected-file-empty { font-size: 0.8rem; color: var(--text-faint); font-style: italic; }

.nc-loop-msg-list {
  list-style: none;
  max-height: 90px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 0.5rem;
}
.nc-loop-msg-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem;
  font-size: 0.78rem;
  border-bottom: 1px solid var(--cell-border-h);
}
.nc-loop-msg-list li:last-child { border-bottom: none; }
.nc-loop-msg-list .btn-icon { margin-left: auto; }

.nc-loop-msg-add-row { display: flex; gap: 0.4rem; }
.nc-loop-msg-add-row select { flex: 0 0 6.5rem; font-size: 0.78rem; }
.nc-loop-msg-add-row input { flex: 1; }

.nc-loop-generate {
  width: 100%;
  justify-content: center;
  padding: 0.65rem 1rem;
  font-weight: 600;
}

/* The shared .form-grid's two columns, tightened — the panel is a 22rem rail-side column now
   rather than 40% of the page, so the three-across it used to run would clip every label */
.nc-encode-grid {
  gap: 0 0.75rem;
}

/* ─── NC Deploy: the audit's own chrome ────────────────────────────────────────── */

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

/* 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 Deploy: file contents viewer ──────────────────────────────────────────── */

.nc-file-viewer {
  font-family: monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 55vh;
  overflow-y: auto;
  background: var(--table-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem;
  margin-top: 0.5rem;
}
.nc-file-viewer-line { display: block; }
.nc-file-viewer-line.flagged {
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: 3px;
  margin: 0 -0.3rem;
  padding: 0 0.3rem;
}

.nc-issue-detail-list {
  list-style: none;
  margin-top: 0.5rem;
}
.nc-issue-detail-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  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-issue-detail-list li > button { margin-left: auto; flex-shrink: 0; }

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