/* The product tree-grid (grid.js) — skins Tabulator's midnight theme into the
   command-room palette (styles.css owns the variables; load it first). */

.pgrid { display: flex; flex-direction: column; gap: 10px; min-height: 0; position: relative; }
.pgrid-table { flex: 1; min-height: 0; }

/* ── Toolbar ── */
.pgrid-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pgrid-spacer { flex: 1; }
.pgrid-search,
.pgrid-add,
.pgrid-group {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink);
  font: 0.82rem var(--ui);
  padding: 7px 10px;
}
.pgrid-search:focus-visible,
.pgrid-add:focus-visible,
.pgrid-group:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.pgrid-search { width: 180px; }
.pgrid-add { width: 240px; }
.pgrid-toast {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-3);
  border: 1px solid var(--bad);
  color: var(--ink);
  border-radius: var(--r-sm);
  padding: 8px 14px;
  font: 0.8rem var(--ui);
  z-index: 30;
}

/* ── Tabulator reskin ── */
.pgrid .tabulator {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font: 0.82rem var(--ui);
}
.pgrid .tabulator .tabulator-header {
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-strong);
  color: var(--ink-soft);
}
.pgrid .tabulator .tabulator-header .tabulator-col {
  background: var(--surface-2);
  border-right: 1px solid var(--line);
}
.pgrid .tabulator .tabulator-header .tabulator-col .tabulator-col-title { font-weight: 600; }
.pgrid .tabulator .tabulator-header input,
.pgrid .tabulator .tabulator-header select {
  background: var(--surface-3);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 6px;
}
.pgrid .tabulator .tabulator-tableholder { background: var(--surface); }
.pgrid .tabulator .tabulator-row { background: var(--surface); border-bottom: 1px solid var(--line); color: var(--ink); }
.pgrid .tabulator .tabulator-row.tabulator-row-even { background: var(--surface); }
.pgrid .tabulator .tabulator-row:hover { background: var(--surface-2); }
.pgrid .tabulator .tabulator-row .tabulator-cell { border-right: 1px solid var(--line); }
.pgrid .tabulator .tabulator-row .tabulator-cell.tabulator-editing {
  border: 1px solid var(--accent);
  background: var(--surface-3);
}
.pgrid .tabulator .tabulator-row .tabulator-cell.tabulator-editing input,
.pgrid .tabulator .tabulator-row .tabulator-cell.tabulator-editing select { color: var(--ink); }
.pgrid .tabulator .tabulator-row.tabulator-moving { border: 1px solid var(--accent); background: var(--surface-3); }
.pgrid .tabulator .tabulator-group {
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-strong);
  color: var(--ink-soft);
  font-weight: 600;
}
.pgrid .tabulator .tabulator-placeholder .tabulator-placeholder-contents { color: var(--ink-faint); }
.pgrid .tabulator .tabulator-data-tree-control {
  border: 1px solid var(--ink-faint);
  color: var(--ink-soft);
}
.pgrid .tabulator .tabulator-data-tree-control:hover { border-color: var(--accent); color: var(--accent); }
.pgrid .tabulator-edit-list {
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font: 0.82rem var(--ui);
}
.pgrid .tabulator-edit-list .tabulator-edit-list-item.active,
.pgrid .tabulator-edit-list .tabulator-edit-list-item:hover {
  background: var(--accent-dim);
  color: var(--ink);
}

/* ── Cells ── */
.pgrid-open {
  background: none;
  border: none;
  color: var(--ink-faint);
  cursor: pointer;
  font-size: 0.8rem;
  margin-left: 6px;
}
.pgrid-open:hover { color: var(--accent); }
.pgrid-dim { color: var(--ink-faint); font-style: italic; }
.pgrid-chip {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-size: 0.72rem;
  color: var(--ink-soft);
}
.pgrid-priority-urgent { color: var(--bad); border-color: var(--bad); }
.pgrid-priority-high { color: var(--warn); border-color: var(--warn); }
.pgrid-priority-medium { color: var(--ink); }
.pgrid-disposition-queued { color: var(--accent-2); border-color: var(--accent); }
.pgrid-disposition-wont_do { color: var(--ink-faint); text-decoration: line-through; }
.pgrid-disposition-inbox { color: var(--machine); border-color: var(--machine); border-style: dashed; } /* machine draft awaiting confirm */
.pgrid-customer { margin-right: 4px; color: var(--ink); background: var(--surface-2); }
.pgrid-demand {
  display: inline-block;
  min-width: 1.5em;
  border-radius: 999px;
  background: var(--accent-faint);
  color: var(--accent-2);
  font: 600 0.74rem var(--mono);
  padding: 1px 6px;
}
.pgrid-status-not_started { color: var(--ink-faint); }
.pgrid-status-in_progress { color: var(--stage-building); border-color: var(--stage-building); }
.pgrid-status-shipped { color: var(--ok); border-color: var(--ok); }
.pgrid-progress {
  display: inline-block;
  width: 64px;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
  vertical-align: middle;
}
.pgrid-progress-bar { display: block; height: 100%; background: var(--ok); border-radius: 999px; }
.pgrid-progress-num { margin-left: 8px; color: var(--ink-faint); font-size: 0.72rem; }
.pgrid-tag {
  display: inline-block;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--accent-faint);
  color: var(--accent-2);
  font: 0.72rem var(--mono);
}
